<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <p>BTW, to recreate the problem, you can do it on the actual test
      instance</p>
    <p><br>
    </p>
    <p>do something like</p>
    <p><br>
    </p>
    <p>route-map LARGE-OUT permit 10<br>
       set large-community 4635:0:0 4635:1:906 4635:1:2906 4635:1:4515
      4635:1:4594 4635:1:4641 4635:1:4760 4635:1:7979 4635:1:9253
      4635:1:9293 4635:1:9304 4635:1:9908 4635:1:13335 4635:1:16265
      4635:1:17924 4635:1:18013 4635:1:20940 4635:1:22822 4635:1:24429
      4635:1:24482 4635:1:32590 4635:1:32934 4635:1:36692 4635:1:38008
      4635:1:38819 4635:1:41378 4635:1:45753 4635:1:46489 4635:1:49544
      4635:1:51847 4635:1:54574 4635:1:54994 4635:1:55720 4635:1:56059
      4635:1:57724 4635:1:65021 4635:1:134823 4635:1:136907
      4635:1:146961 24115:0:24115 24115:1:906 24115:1:2906 24115:1:4515
      24115:1:4594 24115:1:4641 24115:1:4760 24115:1:7979 24115:1:9253
      24115:1:9293 24115:1:9304 24115:1:9908 24115:1:13335 24115:1:16265
      24115:1:17924 24115:1:18013 24115:1:20940 24115:1:22822
      24115:1:24429 24115:1:24482 24115:1:32590 24115:1:32934
      24115:1:36692 24115:1:38008 24115:1:38819 24115:1:41378
      24115:1:45753 24115:1:46489 24115:1:49544 24115:1:51847
      24115:1:54574 24115:1:54994 24115:1:55720 24115:1:56059
      24115:1:57724 24115:1:65021 24115:1:134823 24115:1:136907
      24115:1:100000 24115:1:100001 24115:1:100002<br>
      exit</p>
    <p>And it will crash the sender.</p>
    <p>    ---Mike<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 4/20/2023 10:52 AM, mike tancsa
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:ada30d5f-46b0-4cc5-9aca-c6fdc6fc9918@sentex.net">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Thanks. Just to be clear, this will need to be applied to ALL
        my bgp speakers first, otherwise it will just propagate the
        issue to all my ibgp peers and then they will crash.</p>
      <p>Is there a way to drop these large communities to protect
        things ?</p>
      <p>    ---Mike<br>
      </p>
      <p><br>
      </p>
      <div class="moz-cite-prefix">On 4/20/2023 10:46 AM, Donald Sharp
        wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:CAP3NpQtndL=V9t1f=3YoMR-oO=LLa_-AYto1DDnses=8bcmKcg@mail.gmail.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <div dir="ltr">Please try this patch:
          <div><br>
          </div>
          <div>diff --git a/bgpd/bgp_lcommunity.c
            b/bgpd/bgp_lcommunity.c<br>
            index 15bf419868..c61684f21e 100644<br>
            --- a/bgpd/bgp_lcommunity.c<br>
            +++ b/bgpd/bgp_lcommunity.c<br>
            @@ -197,7 +197,7 @@ static void set_lcommunity_string(struct
            lcommunity *lcom, bool make_json,<br>
                    }<br>
             <br>
                    /* 1 space + lcom->size lcom strings + null
            terminator */<br>
            -       size_t str_buf_sz = BUFSIZ;<br>
            +       size_t str_buf_sz = BUFSIZ * 10;<br>
                    str_buf = XCALLOC(MTYPE_LCOMMUNITY_STR, str_buf_sz);<br>
             <br>
                    for (i = 0; i < lcom->size; i++) {<br>
          </div>
          <div><br>
          </div>
          <div>we are creating a string that is not big enough for the
            community.  We need to look at this a bit more precisely
            than my multiplication by 10</div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Thu, Apr 20, 2023 at
            10:33 AM mike tancsa <<a href="mailto:mike@sentex.net"
              moz-do-not-send="true" class="moz-txt-link-freetext">mike@sentex.net</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">On 4/20/2023 9:30 AM,
            mike tancsa wrote:<br>
            > On 4/18/2023 5:28 AM, Kurt Jaeger wrote:<br>
            >> Hi!<br>
            >><br>
            >>> This caused bgpd to terminate on several boxes
            this morning:<br>
            >>><br>
            >>> 2023/04/18 08:43:47 BGP:
            bgpd/bgp_lcommunity.c:236: <br>
            >>> set_lcommunity_string(): assertion ((unsigned
            int)len < str_buf_sz) <br>
            >>> failed<br>
            >>> BGP: Received signal 6 at 1681800227 (si_addr
            0x0); aborting...<br>
            >>><br>
            >>> OS: FreeBSD 13.1p3. frr was 8.4.x and 8.5. So
            someone is sending<br>
            >>> strange things... ?<br>
            >>><br>
            >>> 7.5.1 is not affected...<br>
            >>><br>
            >>> Any ideas on how to avoid the assert ?<br>
            >> There's the lookup for community aliases added in
            that function:<br>
            >><br>
            >>                  const char *com2alias =<br>
            >>                          translate_alias ?
            bgp_community2alias(lcsb) <br>
            >> : lcsb;<br>
            >>                    len = strlcat(str_buf,
            com2alias, str_buf_sz);<br>
            >><br>
            >> and it seems to trigger the issue.<br>
            ><br>
            ><br>
            > I am seeing this crash as well. Sadly the patch in the
            freebsd pr does <br>
            > not seem to work around the issue.  If its an issue of
            communities, is <br>
            > there an easy way to strip out communities from peers
            for now ?<br>
            ><br>
            Adding some debugging. It seems to be a large community that
            is bigger <br>
            than 1024 bytes.  Looking at the pcap,<br>
            <br>
            <br>
            09:27:57.240613 IP (tos 0xc0, ttl 1, id 22455, offset 0,
            flags [DF], <br>
            proto TCP (6), length 1500)<br>
                 192.168.158.77.179 > 192.168.158.78.64274: Flags
            [.], cksum 0x96a5 <br>
            (correct), seq 4567154:4568614, ack 964, win 31913, length
            1460: BGP [|BGP]<br>
                     Update Message (2), length: 81<br>
                       Origin (1), length: 1, Flags [T]: IGP<br>
                       AS Path (2), length: 18, Flags [T]: 174 45758
            55808 147027<br>
                       Next Hop (3), length: 4, Flags [T]:
            192.168.158.77<br>
                       Multi Exit Discriminator (4), length: 4, Flags
            [O]: 64070<br>
                       Community (8), length: 8, Flags [OT]: 174:21001,
            174:22013<br>
                       Updated routes:<br>
                         <a href="http://110.164.235.0/24"
              rel="noreferrer" target="_blank" moz-do-not-send="true">110.164.235.0/24</a><br>
                         <a href="http://110.164.234.0/24"
              rel="noreferrer" target="_blank" moz-do-not-send="true">110.164.234.0/24</a><br>
                     Update Message (2), length: 1021<br>
                       Origin (1), length: 1, Flags [T]: IGP<br>
                       AS Path (2), length: 22, Flags [T]: 174 3491
            60068 983 38136<br>
                       Next Hop (3), length: 4, Flags [T]:
            192.168.158.77<br>
                       Multi Exit Discriminator (4), length: 4, Flags
            [O]: 15030<br>
                       Community (8), length: 8, Flags [OT]: 174:21000,
            174:22013<br>
                       Large Community (32), length: 936, Flags [OTE]:<br>
                         4635:0:0, 4635:1:906, 4635:1:2906, 4635:1:4515,
            <br>
            4635:1:4594, 4635:1:4641, 4635:1:4760, 4635:1:7979,
            4635:1:9253, <br>
            4635:1:9293, 4635:1:9304, 4635:1:9908, 4635:1:13335,
            4635:1:16265, <br>
            4635:1:17924, 4635:1:18013, 4635:1:20940, 4635:1:22822,
            4635:1:24429, <br>
            4635:1:24482, 4635:1:32590, 4635:1:32934, 4635:1:36692,
            4635:1:38008, <br>
            4635:1:38819, 4635:1:41378, 4635:1:45753, 4635:1:46489,
            4635:1:49544, <br>
            4635:1:51847, 4635:1:54574, 4635:1:54994, 4635:1:55720,
            4635:1:56059, <br>
            4635:1:57724, 4635:1:65021, 4635:1:134823, 4635:1:136907,
            4635:1:146961, <br>
            24115:0:24115, 24115:1:906, 24115:1:2906, 24115:1:4515,
            24115:1:4594, <br>
            24115:1:4641, 24115:1:4760, 24115:1:7979, 24115:1:9253,
            24115:1:9293, <br>
            24115:1:9304, 24115:1:9908, 24115:1:13335, 24115:1:16265,
            24115:1:17924, <br>
            24115:1:18013, 24115:1:20940, 24115:1:22822, 24115:1:24429,
            <br>
            24115:1:24482, 24115:1:32590, 24115:1:32934, 24115:1:36692,
            <br>
            24115:1:38008, 24115:1:38819, 24115:1:41378, 24115:1:45753,
            <br>
            24115:1:46489, 24115:1:49544, 24115:1:51847, 24115:1:54574,
            <br>
            24115:1:54994, 24115:1:55720, 24115:1:56059, 24115:1:57724,
            <br>
            24115:1:65021, 24115:1:134823, 24115:1:136907,
            24115:1:146961<br>
                       Updated routes:<br>
                         <a href="http://103.135.103.0/24"
              rel="noreferrer" target="_blank" moz-do-not-send="true">103.135.103.0/24</a><br>
                     Update Message (2), length: 77<br>
                       Origin (1), length: 1, Flags [T]: IGP<br>
                       AS Path (2), length: 18, Flags [T]: 174 262589
            14259 16921<br>
                       Next Hop (3), length: 4, Flags [T]:
            192.168.158.77<br>
                       Multi Exit Discriminator (4), length: 4, Flags
            [O]: 48050<br>
                       Community (8), length: 8, Flags [OT]: 174:21001,
            174:22013<br>
                       Updated routes:<br>
                         <a href="http://200.108.121.0/24"
              rel="noreferrer" target="_blank" moz-do-not-send="true">200.108.121.0/24</a><br>
                     Update Message (2), length: 73<br>
                       Origin (1), length: 1, Flags [T]: IGP<br>
                       AS Path (2), length: 14, Flags [T]: 174 1239
            54174<br>
                       Next Hop (3), length: 4, Flags [T]:
            192.168.158.77<br>
                       Multi Exit Discriminator (4), length: 4, Flags
            [O]: 15030<br>
                       Community (8), length: 8, Flags [OT]: 174:21000,
            174:22013<br>
                       Updated routes:<br>
                         <a href="http://208.21.37.0/24"
              rel="noreferrer" target="_blank" moz-do-not-send="true">208.21.37.0/24</a><br>
                     Update Message (2), length: 81<br>
                       Origin (1), length: 1, Flags [T]: IGP<br>
                       AS Path (2), length: 22, Flags [T]: 174 1299 6939
            6939 398704<br>
                       Next Hop (3), length: 4, Flags [T]:
            192.168.158.77<br>
                       Multi Exit Discriminator (4), length: 4, Flags
            [O]: 1<br>
                       Community (8), length: 8, Flags [OT]: 174:21000,
            174:22003<br>
                       Updated routes:<br>
                         <a href="http://205.198.124.0/24"
              rel="noreferrer" target="_blank" moz-do-not-send="true">205.198.124.0/24</a><br>
            <br>
            With some added debugging, it seems its exceeding the size
            of the buffer<br>
            zlog_warn("set_lcommunity_string: str_buf_sz=%lu [%s]
            [%s]\n", <br>
            str_buf_sz, lcsb, str_buf);<br>
            <br>
            Apr 20 10:02:25 cogent-2023 bgpd[43237]: [SH1YD-SM74V] <br>
            set_lcommunity_string: str_buf_sz=1024 [24115:1:136907]
            [4635:0:0 <br>
            4635:1:906 4635:1:2906 4635:1:4515 4635:1:4594 4635:1:4641
            4635:1:4760 <br>
            4635:1:7979 4635:1:9253 4635:1:9293 4635:1:93<br>
            04 4635:1:9908 4635:1:13335 4635:1:16265 4635:1:17924
            4635:1:18013 <br>
            4635:1:20940 4635:1:22822 4635:1:24429 4635:1:24482
            4635:1:32590 <br>
            4635:1:32934 4635:1:36692 4635:1:38008 4635:1:38819
            4635:1:41378 <br>
            4635:1:45753 4635:1:46489 4635:1:49544 4<br>
            635:1:51847 4635:1:54574 4635:1:54994 4635:1:55720
            4635:1:56059 <br>
            4635:1:57724 4635:1:65021 4635:1:134823 4635:1:136907
            4635:1:146961 <br>
            24115:0:24115 24115:1:906 24115:1:2906 24115:1:4515
            24115:1:4594 <br>
            24115:1:4641 24115:1:4760 24115:1:7979 2<br>
            4115:1:9253 24115:1:9293 24115:1:9304 24115:1:9908
            24115:1:13335 <br>
            24115:1:16265 24115:1:17924 24115:1:18013 24115:1:20940
            24115:1:22822 <br>
            24115:1:24429 24115:1:24482 24115:1:32590 24115:1:32934
            24115:1:36692 <br>
            24115:1:38008 24115:1:38819 2411<br>
            5:1:41378 24115:1:45753 24115:1:46489 24115:1:49544
            24115:1:51847 <br>
            24115:1:54574 24115:1:54994 24115:1:55720 24115:1:56059
            24115:1:57724 <br>
            24115:1:65021 24115:1:134823 ]<br>
            Apr 20 10:02:25 cogent-2023 bgpd[43237]: [SH1YD-SM74V] <br>
            set_lcommunity_string: str_buf_sz=1024 [24115:1:146961]
            [4635:0:0 <br>
            4635:1:906 4635:1:2906 4635:1:4515 4635:1:4594 4635:1:4641
            4635:1:4760 <br>
            4635:1:7979 4635:1:9253 4635:1:9293 4635:1:93<br>
            04 4635:1:9908 4635:1:13335 4635:1:16265 4635:1:17924
            4635:1:18013 <br>
            4635:1:20940 4635:1:22822 4635:1:24429 4635:1:24482
            4635:1:32590 <br>
            4635:1:32934 4635:1:36692 4635:1:38008 4635:1:38819
            4635:1:41378 <br>
            4635:1:45753 4635:1:46489 4635:1:49544 4<br>
            635:1:51847 4635:1:54574 4635:1:54994 4635:1:55720
            4635:1:56059 <br>
            4635:1:57724 4635:1:65021 4635:1:134823 4635:1:136907
            4635:1:146961 <br>
            24115:0:24115 24115:1:906 24115:1:2906 24115:1:4515
            24115:1:4594 <br>
            24115:1:4641 24115:1:4760 24115:1:7979 2<br>
            4115:1:9253 24115:1:9293 24115:1:9304 24115:1:9908
            24115:1:13335 <br>
            24115:1:16265 24115:1:17924 24115:1:18013 24115:1:20940
            24115:1:22822 <br>
            24115:1:24429 24115:1:24482 24115:1:32590 24115:1:32934
            24115:1:36692 <br>
            24115:1:38008 24115:1:38819 2411<br>
            5:1:41378 24115:1:45753 24115:1:46489 24115:1:49544
            24115:1:51847 <br>
            24115:1:54574 24115:1:54994 24115:1:55720 24115:1:56059
            24115:1:57724 <br>
            24115:1:65021 24115:1:134823 24115:1:136907 ]<br>
            Apr 20 10:02:25 cogent-2023 bgpd[43237]:
            bgpd/bgp_lcommunity.c:239: <br>
            set_lcommunity_string(): assertion ((unsigned int)len <
            str_buf_sz) failed<br>
            <br>
            <br>
            <br>
            <br>
            _______________________________________________<br>
            dev mailing list<br>
            <a href="mailto:dev@lists.frrouting.org" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">dev@lists.frrouting.org</a><br>
            <a href="https://lists.frrouting.org/listinfo/dev"
              rel="noreferrer" target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">https://lists.frrouting.org/listinfo/dev</a><br>
          </blockquote>
        </div>
      </blockquote>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dev@lists.frrouting.org">dev@lists.frrouting.org</a>
<a class="moz-txt-link-freetext" href="https://lists.frrouting.org/listinfo/dev">https://lists.frrouting.org/listinfo/dev</a>
</pre>
    </blockquote>
  </body>
</html>