On Thu, Jun 17, 2021 at 01:40:01PM +0000, Job Snijders wrote:
> On Thu, Jun 17, 2021 at 03:29:38PM +0200, Claudio Jeker wrote:
> > On Thu, Jun 17, 2021 at 01:25:07PM +0000, Job Snijders wrote:
> > > On Thu, Jun 17, 2021 at 12:24:16PM +0200, Claudio Jeker wrote:
> > > > On Mon, Jun 14, 2021 at 05:10:07PM +0200, Claudio Jeker wrote:
> > > > > On Thu, May 27, 2021 at 06:24:06PM +0200, Claudio Jeker wrote:
> > > > > > Implement RFC 7313 enhanced route refresh.
> > > > > > 
> > > > > > While there also change when graceful restart EoR markers are sent.
> > > > > > In short the graceful restart marker should only be sent initally. 
> > > > > > After
> > > > > > that the End of Route Refresh message should be sent instead.
> > > > > > Because of this track if an EoR marker was received or should be 
> > > > > > sent in
> > > > > > the peer config.
> > > > > > 
> > > > > > For now this setting is off by default but that may be changed at a 
> > > > > > later
> > > > > > state.
> > > > > > 
> > > > > > Please try this out and tell me if it works for you. The message and
> > > > > > prefix/rrefresh counters in bgpctl show nei output help a lot to 
> > > > > > see what
> > > > > > is going on.
> > > > 
> > > > Minor cleanup, instead of this comment use CTASSERT to make sure that 
> > > > the
> > > > recv_eor and send_eor fields are large enough to work as a bitfield for
> > > > AID_MAX
> > > > 
> > > > > -#define      AID_MAX         5
> > > > > +#define      AID_MAX         5       /* check rde_peer.recv_eor when 
> > > > > max reaches 7 */
> > > > 
> > > > Enhanced route refresh is currently off by default. So unless somebody
> > > > is against this I will commit this soon. At least then it gets tested :)
> > > 
> > > Under what circumstances will bgpd(8) send an enhanced route refresh?
> > 
> > The enhanced route refresh messages BoRR and EoRR are sent from the system
> > that got the normal route refresh request. So you need to issue a refresh
> > from the peer to see the new messages.
> 
> Ah... there we go:
> 
> 13:39:14.349247 10.0.0.12.28035 > 10.0.0.1.bgp: P 19:42(23) ack 1 win 256 
> <nop,nop,timestamp 3687309040 2202372172>: BGP (ROUTE-REFRESH Request (IPv4 
> Unicast)) (DF) [tos 0xc0]
> 13:39:14.351043 10.0.0.1.bgp > 10.0.0.12.28035: P 1:24(23) ack 42 win 267 
> <nop,nop,timestamp 2202372173 3687309040>: BGP (ROUTE-REFRESH BoRR (IPv4 
> Unicast)) [tos 0xc0]
> 13:39:14.548996 10.0.0.12.28035 > 10.0.0.1.bgp: . ack 24 win 256 
> <nop,nop,timestamp 3687309040 2202372173> (DF) [tos 0xc0]
> 13:39:18.855601 10.0.0.1.bgp > 10.0.0.12.28035: P 24:47(23) ack 42 win 267 
> <nop,nop,timestamp 2202372182 3687309040>: BGP (ROUTE-REFRESH EoRR (IPv4 
> Unicast)) [tos 0xc0]
> 13:39:19.049045 10.0.0.12.28035 > 10.0.0.1.bgp: . ack 47 win 256 
> <nop,nop,timestamp 3687309049 2202372182> (DF) [tos 0xc0]
> 
> Index: print-bgp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-bgp.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 print-bgp.c
> --- print-bgp.c       3 Jul 2019 03:24:03 -0000       1.29
> +++ print-bgp.c       17 Jun 2021 13:39:37 -0000
> @@ -97,7 +97,7 @@ struct bgp_route_refresh {
>       u_int16_t len;
>       u_int8_t type;
>       u_int8_t afi[2]; /* unaligned; should be u_int16_t */
> -     u_int8_t res;
> +     u_int8_t subtype;
>       u_int8_t safi;
>  };
>  #define BGP_ROUTE_REFRESH_SIZE          23
> @@ -189,6 +189,7 @@ static const char *bgp_capcode[] = {
>       /* 67: [Chen] */ "DYNAMIC_CAPABILITY",
>       /* 68: [Appanna] */ "MULTISESSION",
>       /* 69: [draft-ietf-idr-add-paths] */ "ADD-PATH",
> +     /* 70: RFC7313 */ "ENHANCED_ROUTE_REFRESH"
>  };
>  
>  #define bgp_capcode(x) \
> @@ -199,7 +200,7 @@ static const char *bgpnotify_major[] = {
>       NULL, "Message Header Error",
>       "OPEN Message Error", "UPDATE Message Error",
>       "Hold Timer Expired", "Finite State Machine Error",
> -     "Cease", "Capability Message Error",
> +     "Cease", "ROUTE_REFRESH Message Error",
>  };
>  #define bgp_notify_major(x) \
>       num_or_str(bgpnotify_major, \
> @@ -323,6 +324,11 @@ static const char *afnumber[] = AFNUM_NA
>               num_or_str(afnumber, \
>                       sizeof(afnumber)/sizeof(afnumber[0]), (x)))
>  
> +static const char *refreshtype[] = {
> +     "Request", "BoRR", "EoRR"
> +};
> +#define refresh_subtype(x) \
> +     num_or_str(refreshtype, sizeof(refreshtype)/sizeof(refreshtype[0]), (x))
>  
>  static const char *
>  num_or_str(const char **table, size_t siz, int value)
> @@ -1069,7 +1075,8 @@ bgp_route_refresh_print(const u_char *da
>  
>       bgp_route_refresh_header = (const struct bgp_route_refresh *)dat;
>  
> -     printf(" (%s %s)",
> +     printf(" %s (%s %s)",
> +         refresh_subtype(bgp_route_refresh_header->subtype),
>           af_name(EXTRACT_16BITS(&bgp_route_refresh_header->afi)),
>           bgp_attr_nlri_safi(bgp_route_refresh_header->safi));
>  
> 

Not a tcpdump expert but this diff looks OK.

-- 
:wq Claudio

Reply via email to