Re: bgpd draft-ietf-idr-large-community

2016-10-14 Thread Sebastian Benoit

forgot to look at bgpctl in my first reply, sry

Peter Hessler(phess...@openbsd.org) on 2016.10.13 17:34:28 +0200:
> On 2016 Oct 11 (Tue) at 00:00:53 +0200 (+0200), Peter Hessler wrote:
> :Here is an initial implementation of draft-ietf-idr-large-community for
> :OpenBGPD.  I can connect and exchange routes with these attributes
> :against exabgp.
> :
> :Normal communities are two 16bit numbers.  With the addition of
> :32bit ASNs, those will not work if you wish to control one of
> :them.
> :
> :Large Communities are 32bit:32bit:32bit.  It seems the convention will be
> :::, with  and  being locally
> :defined.
> :
> :RFC status: currently accepted by the IDR-WG, is at version -02, the
> :wire format is set, the attribute codepoint is assigned by IANA, and it
> :seems that only trivial details need to be addressed.  Very likely to be
> :accepted.
> :
> :This was based on a partial implementation from Job Snijders, many
> :thanks!
> :
> :Comments?  OK?
> :
> 
> Updated diff:
>  - assert copyright for the non-trivial changes
>  - since the magic ASN matching canaries use valid bits, seperate the
> filter storage and a wire storage
>  - clean up warnings
>  - fix a few printing issues
> 
> OK?
> 
> 
> Index: usr.sbin/bgpctl/bgpctl.8
> ===
> RCS file: /cvs/openbsd/src/usr.sbin/bgpctl/bgpctl.8,v
> retrieving revision 1.69
> diff -u -p -u -p -r1.69 bgpctl.8
> --- usr.sbin/bgpctl/bgpctl.8  25 May 2016 14:15:59 -  1.69
> +++ usr.sbin/bgpctl/bgpctl.8  5 Sep 2016 13:41:29 -
> @@ -300,6 +300,9 @@ anywhere in the AS path.
>  .It Cm community Ar community
>  Show all entries with community
>  .Ar community .
> +.It Cm large-community Ar large-community
> +Show all entries with large-community
> +.Ar large-community .
>  .It Cm empty-as
>  Show all entries that are internal routes with no AS's in the AS path.
>  .It Cm memory
> Index: usr.sbin/bgpctl/bgpctl.c
> ===
> RCS file: /cvs/openbsd/src/usr.sbin/bgpctl/bgpctl.c,v
> retrieving revision 1.188
> diff -u -p -u -p -r1.188 bgpctl.c
> --- usr.sbin/bgpctl/bgpctl.c  3 Jun 2016 17:36:37 -   1.188
> +++ usr.sbin/bgpctl/bgpctl.c  13 Oct 2016 15:32:30 -
> @@ -2,6 +2,8 @@
>  
>  /*
>   * Copyright (c) 2003 Henning Brauer 
> + * Copyright (c) 2016 Job Snijders 
> + * Copyright (c) 2016 Peter Hessler 
>   *
>   * Permission to use, copy, modify, and distribute this software for any
>   * purpose with or without fee is hereby granted, provided that the above
> @@ -82,6 +84,7 @@ void show_rib_brief(struct ctl_show_ri
>  void  show_rib_detail(struct ctl_show_rib *, u_char *, int);
>  void  show_attr(void *, u_int16_t);
>  void  show_community(u_char *, u_int16_t);
> +void  show_large_community(u_char *, u_int16_t);
>  void  show_ext_community(u_char *, u_int16_t);
>  char *fmt_mem(int64_t);
>  int   show_rib_memory_msg(struct imsg *);
> @@ -254,6 +257,13 @@ main(int argc, char *argv[])
>   sizeof(res->community));
>   type = IMSG_CTL_SHOW_RIB_COMMUNITY;
>   }
> + if (res->large_community.as != COMMUNITY_UNSET &&
> + res->large_community.ld1 != COMMUNITY_UNSET &&
> + res->large_community.ld2 != COMMUNITY_UNSET) {
> + memcpy(_community, >large_community,
> + sizeof(res->large_community));
> + type = IMSG_CTL_SHOW_RIB_LARGECOMMUNITY;
> + }
>   memcpy(, , sizeof(ribreq.neighbor));
>   strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib));
>   ribreq.aid = res->aid;
> @@ -275,6 +285,11 @@ main(int argc, char *argv[])
>   res->community.type != COMMUNITY_UNSET)
>   memcpy(, >community,
>   sizeof(res->community));
> + if (res->large_community.as != COMMUNITY_UNSET &&
> + res->large_community.ld1 != COMMUNITY_UNSET &&
> + res->large_community.ld2 != COMMUNITY_UNSET)
> + memcpy(_community, >large_community,
> + sizeof(res->large_community));
>   memcpy(, , sizeof(ribreq.neighbor));
>   ribreq.aid = res->aid;
>   ribreq.flags = res->flags;
> @@ -377,6 +392,11 @@ main(int argc, char *argv[])
>   res->community.type != COMMUNITY_UNSET)
>   memcpy(, >community,
>   sizeof(res->community));
> + if (res->large_community.as != COMMUNITY_UNSET &&
> + res->large_community.ld1 != COMMUNITY_UNSET &&
> + res->large_community.ld2 != COMMUNITY_UNSET)
> + memcpy(_community, >large_community,
> +

Re: bgpd draft-ietf-idr-large-community

2016-10-14 Thread Sebastian Benoit
Peter Hessler(phess...@openbsd.org) on 2016.10.13 17:34:28 +0200:
> On 2016 Oct 11 (Tue) at 00:00:53 +0200 (+0200), Peter Hessler wrote:
> :Here is an initial implementation of draft-ietf-idr-large-community for
> :OpenBGPD.  I can connect and exchange routes with these attributes
> :against exabgp.
> :
> :Normal communities are two 16bit numbers.  With the addition of
> :32bit ASNs, those will not work if you wish to control one of
> :them.
> :
> :Large Communities are 32bit:32bit:32bit.  It seems the convention will be
> :::, with  and  being locally
> :defined.
> :
> :RFC status: currently accepted by the IDR-WG, is at version -02, the
> :wire format is set, the attribute codepoint is assigned by IANA, and it
> :seems that only trivial details need to be addressed.  Very likely to be
> :accepted.
> :
> :This was based on a partial implementation from Job Snijders, many
> :thanks!
> :
> :Comments?  OK?
> :
> 
> Updated diff:
>  - assert copyright for the non-trivial changes
>  - since the magic ASN matching canaries use valid bits, seperate the
> filter storage and a wire storage
>  - clean up warnings
>  - fix a few printing issues
> 
> OK?

nice, just a few questions below 

> Index: usr.sbin/bgpctl/bgpctl.8
> ===
> RCS file: /cvs/openbsd/src/usr.sbin/bgpctl/bgpctl.8,v
> retrieving revision 1.69
> diff -u -p -u -p -r1.69 bgpctl.8
> --- usr.sbin/bgpctl/bgpctl.8  25 May 2016 14:15:59 -  1.69
> +++ usr.sbin/bgpctl/bgpctl.8  5 Sep 2016 13:41:29 -
> @@ -300,6 +300,9 @@ anywhere in the AS path.
>  .It Cm community Ar community
>  Show all entries with community
>  .Ar community .
> +.It Cm large-community Ar large-community
> +Show all entries with large-community
> +.Ar large-community .
>  .It Cm empty-as
>  Show all entries that are internal routes with no AS's in the AS path.
>  .It Cm memory
> Index: usr.sbin/bgpctl/bgpctl.c
> ===
> RCS file: /cvs/openbsd/src/usr.sbin/bgpctl/bgpctl.c,v
> retrieving revision 1.188
> diff -u -p -u -p -r1.188 bgpctl.c
> --- usr.sbin/bgpctl/bgpctl.c  3 Jun 2016 17:36:37 -   1.188
> +++ usr.sbin/bgpctl/bgpctl.c  13 Oct 2016 15:32:30 -
> @@ -2,6 +2,8 @@
>  
>  /*
>   * Copyright (c) 2003 Henning Brauer 
> + * Copyright (c) 2016 Job Snijders 
> + * Copyright (c) 2016 Peter Hessler 
>   *
>   * Permission to use, copy, modify, and distribute this software for any
>   * purpose with or without fee is hereby granted, provided that the above
> @@ -82,6 +84,7 @@ void show_rib_brief(struct ctl_show_ri
>  void  show_rib_detail(struct ctl_show_rib *, u_char *, int);
>  void  show_attr(void *, u_int16_t);
>  void  show_community(u_char *, u_int16_t);
> +void  show_large_community(u_char *, u_int16_t);
>  void  show_ext_community(u_char *, u_int16_t);
>  char *fmt_mem(int64_t);
>  int   show_rib_memory_msg(struct imsg *);
> @@ -254,6 +257,13 @@ main(int argc, char *argv[])
>   sizeof(res->community));
>   type = IMSG_CTL_SHOW_RIB_COMMUNITY;
>   }
> + if (res->large_community.as != COMMUNITY_UNSET &&
> + res->large_community.ld1 != COMMUNITY_UNSET &&
> + res->large_community.ld2 != COMMUNITY_UNSET) {
> + memcpy(_community, >large_community,
> + sizeof(res->large_community));
> + type = IMSG_CTL_SHOW_RIB_LARGECOMMUNITY;
> + }
>   memcpy(, , sizeof(ribreq.neighbor));
>   strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib));
>   ribreq.aid = res->aid;
> @@ -275,6 +285,11 @@ main(int argc, char *argv[])
>   res->community.type != COMMUNITY_UNSET)
>   memcpy(, >community,
>   sizeof(res->community));
> + if (res->large_community.as != COMMUNITY_UNSET &&
> + res->large_community.ld1 != COMMUNITY_UNSET &&
> + res->large_community.ld2 != COMMUNITY_UNSET)
> + memcpy(_community, >large_community,
> + sizeof(res->large_community));
>   memcpy(, , sizeof(ribreq.neighbor));
>   ribreq.aid = res->aid;
>   ribreq.flags = res->flags;
> @@ -377,6 +392,11 @@ main(int argc, char *argv[])
>   res->community.type != COMMUNITY_UNSET)
>   memcpy(, >community,
>   sizeof(res->community));
> + if (res->large_community.as != COMMUNITY_UNSET &&
> + res->large_community.ld1 != COMMUNITY_UNSET &&
> + res->large_community.ld2 != COMMUNITY_UNSET)
> + memcpy(_community, >large_community,
> + 

Re: bgpd draft-ietf-idr-large-community

2016-10-13 Thread Peter Hessler
On 2016 Oct 11 (Tue) at 00:00:53 +0200 (+0200), Peter Hessler wrote:
:Here is an initial implementation of draft-ietf-idr-large-community for
:OpenBGPD.  I can connect and exchange routes with these attributes
:against exabgp.
:
:Normal communities are two 16bit numbers.  With the addition of
:32bit ASNs, those will not work if you wish to control one of
:them.
:
:Large Communities are 32bit:32bit:32bit.  It seems the convention will be
:::, with  and  being locally
:defined.
:
:RFC status: currently accepted by the IDR-WG, is at version -02, the
:wire format is set, the attribute codepoint is assigned by IANA, and it
:seems that only trivial details need to be addressed.  Very likely to be
:accepted.
:
:This was based on a partial implementation from Job Snijders, many
:thanks!
:
:Comments?  OK?
:

Updated diff:
 - assert copyright for the non-trivial changes
 - since the magic ASN matching canaries use valid bits, seperate the
filter storage and a wire storage
 - clean up warnings
 - fix a few printing issues

OK?


Index: usr.sbin/bgpctl/bgpctl.8
===
RCS file: /cvs/openbsd/src/usr.sbin/bgpctl/bgpctl.8,v
retrieving revision 1.69
diff -u -p -u -p -r1.69 bgpctl.8
--- usr.sbin/bgpctl/bgpctl.825 May 2016 14:15:59 -  1.69
+++ usr.sbin/bgpctl/bgpctl.85 Sep 2016 13:41:29 -
@@ -300,6 +300,9 @@ anywhere in the AS path.
 .It Cm community Ar community
 Show all entries with community
 .Ar community .
+.It Cm large-community Ar large-community
+Show all entries with large-community
+.Ar large-community .
 .It Cm empty-as
 Show all entries that are internal routes with no AS's in the AS path.
 .It Cm memory
Index: usr.sbin/bgpctl/bgpctl.c
===
RCS file: /cvs/openbsd/src/usr.sbin/bgpctl/bgpctl.c,v
retrieving revision 1.188
diff -u -p -u -p -r1.188 bgpctl.c
--- usr.sbin/bgpctl/bgpctl.c3 Jun 2016 17:36:37 -   1.188
+++ usr.sbin/bgpctl/bgpctl.c13 Oct 2016 15:32:30 -
@@ -2,6 +2,8 @@
 
 /*
  * Copyright (c) 2003 Henning Brauer 
+ * Copyright (c) 2016 Job Snijders 
+ * Copyright (c) 2016 Peter Hessler 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -82,6 +84,7 @@ void   show_rib_brief(struct ctl_show_ri
 voidshow_rib_detail(struct ctl_show_rib *, u_char *, int);
 voidshow_attr(void *, u_int16_t);
 voidshow_community(u_char *, u_int16_t);
+voidshow_large_community(u_char *, u_int16_t);
 voidshow_ext_community(u_char *, u_int16_t);
 char   *fmt_mem(int64_t);
 int show_rib_memory_msg(struct imsg *);
@@ -254,6 +257,13 @@ main(int argc, char *argv[])
sizeof(res->community));
type = IMSG_CTL_SHOW_RIB_COMMUNITY;
}
+   if (res->large_community.as != COMMUNITY_UNSET &&
+   res->large_community.ld1 != COMMUNITY_UNSET &&
+   res->large_community.ld2 != COMMUNITY_UNSET) {
+   memcpy(_community, >large_community,
+   sizeof(res->large_community));
+   type = IMSG_CTL_SHOW_RIB_LARGECOMMUNITY;
+   }
memcpy(, , sizeof(ribreq.neighbor));
strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib));
ribreq.aid = res->aid;
@@ -275,6 +285,11 @@ main(int argc, char *argv[])
res->community.type != COMMUNITY_UNSET)
memcpy(, >community,
sizeof(res->community));
+   if (res->large_community.as != COMMUNITY_UNSET &&
+   res->large_community.ld1 != COMMUNITY_UNSET &&
+   res->large_community.ld2 != COMMUNITY_UNSET)
+   memcpy(_community, >large_community,
+   sizeof(res->large_community));
memcpy(, , sizeof(ribreq.neighbor));
ribreq.aid = res->aid;
ribreq.flags = res->flags;
@@ -377,6 +392,11 @@ main(int argc, char *argv[])
res->community.type != COMMUNITY_UNSET)
memcpy(, >community,
sizeof(res->community));
+   if (res->large_community.as != COMMUNITY_UNSET &&
+   res->large_community.ld1 != COMMUNITY_UNSET &&
+   res->large_community.ld2 != COMMUNITY_UNSET)
+   memcpy(_community, >large_community,
+   sizeof(res->large_community));
memcpy(, , sizeof(ribreq.neighbor));
ribreq.aid = res->aid;
ribreq.flags = res->flags;
@@ -1424,6 +1444,11 @@ show_attr(void *b, u_int16_t len)