Re: quagga 1.2.2: tests wanted with mcast-based protos (OSPF/RIP)

2017-11-03 Thread Stuart Henderson
On 2017/10/31 12:01, Stuart Henderson wrote:
> Does anyone have quagga setup with ripd and/or ospfd that's in a
> position to test this update?

I've committed this so it's easier to test. If you're using these and run
into new problems, please let me know.


> Background: OpenBSD multicast code wants the interface IP address passed
> when joining/leaving groups.
> 
> Old quagga code passed this up e.g. from ripd/ospfd but this was changed
> c.2012 and now only uses ifindex-based APIs (either RFC3678 MCAST_JOIN_GROUP
> etc, struct ip_mreqn on some OS, or a hack allowed in some OS of passing
> the ifindex in as the source address).
> 
> The current port version reverts to the old quagga code for this (and
> has done so since 2013 - https://marc.info/?t=13570613121=1=2),
> but it's becoming harder to maintain as upstream diverges (quagga 1.2 is
> a bit different; the frrouter fork is different again).
> 
> So this takes a different and less intrusive approach to handling the
> changes needed - borrowing some code used for SunOS in another function
> in the file, given an ifindex from the calling function, it does a
> lookup for the interface address, and uses that instead. This avoids
> scattering the changes through 4 files, and reduces the main patch
> scope (the current one is guaranteed to conflict when anything is
> changed in the relevant functions upstream).
> 
> Any tests/comments welcome...
> 
> 
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/net/quagga/Makefile,v
> retrieving revision 1.53
> diff -u -p -r1.53 Makefile
> --- Makefile  31 Oct 2017 09:37:18 -  1.53
> +++ Makefile  31 Oct 2017 11:42:44 -
> @@ -2,13 +2,13 @@
>  
>  COMMENT= multi-threaded routing daemon
>  
> -DISTNAME=quagga-1.0.20161017
> +DISTNAME=quagga-1.2.2
>  CATEGORIES=  net
>  MASTER_SITES=http://download.savannah.gnu.org/releases/quagga/
>  
> -SHARED_LIBS= ospf0.1 \
> - ospfapiclient   0.0 \
> - zebra   1.0
> +.for i in ospf ospfapiclient zebra fpm_pb quagga_pb
> +SHARED_LIBS+=$i 1.0
> +.endfor
>  
>  HOMEPAGE=http://www.quagga.net/
>  
> @@ -37,10 +37,10 @@ CONFIGURE_ARGS+= --disable-pie
>  CONFIGURE_ENV=   CPPFLAGS="-I${LOCALBASE}/include" \
>   LDFLAGS="-L${LOCALBASE}/lib" \
>   LIBS=-lcurses
> -
>  MAKE_FLAGS=  MAKEINFO="makeinfo --no-split"
>  FAKE_FLAGS=  exampledir='${PREFIX}/share/examples/quagga' \
>   ${MAKE_FLAGS}
> +LIBTOOL_FLAGS=   --tag=disable-static
>  
>  FLAVORS= snmp
>  FLAVOR?=
> Index: distinfo
> ===
> RCS file: /cvs/ports/net/quagga/distinfo,v
> retrieving revision 1.21
> diff -u -p -r1.21 distinfo
> --- distinfo  31 Oct 2017 09:37:18 -  1.21
> +++ distinfo  31 Oct 2017 11:42:44 -
> @@ -1,2 +1,2 @@
> -SHA256 (quagga-1.0.20161017.tar.gz) = 
> jyZyTdt0GfORL4DOjxNokZAongAizwmSHQpAP9dxSRg=
> -SIZE (quagga-1.0.20161017.tar.gz) = 2758494
> +SHA256 (quagga-1.2.2.tar.gz) = Ui4i8r7uZOPwws3j0BVfO4ED9Pb8ir75LLQLw6TMKTE=
> +SIZE (quagga-1.2.2.tar.gz) = 2986142
> Index: patches/patch-bgpd_bgp_aspath_c
> ===
> RCS file: patches/patch-bgpd_bgp_aspath_c
> diff -N patches/patch-bgpd_bgp_aspath_c
> --- patches/patch-bgpd_bgp_aspath_c   31 Oct 2017 09:37:18 -  1.3
> +++ /dev/null 1 Jan 1970 00:00:00 -
> @@ -1,26 +0,0 @@
> -$OpenBSD: patch-bgpd_bgp_aspath_c,v 1.3 2017/10/31 09:37:18 sthen Exp $
> -
> -From 7a42b78be9a4108d98833069a88e6fddb9285008 Mon Sep 17 00:00:00 2001
> -From: Andreas Jaggi 
> -Date: Mon, 2 Oct 2017 19:38:43 +0530
> -Subject: bgpd: Fix AS_PATH size calculation for long paths
> -
> -If you have an AS_PATH with more entries than
> -what can be written into a single AS_SEGMENT_MAX
> -it needs to be broken up.  The code that noticed
> -that the AS_PATH needs to be broken up was not
> -correctly calculating the size of the resulting
> -message.  This patch addresses this issue.
> -
> -Index: bgpd/bgp_aspath.c
>  bgpd/bgp_aspath.c.orig
> -+++ bgpd/bgp_aspath.c
> -@@ -904,7 +904,7 @@ aspath_put (struct stream *s, struct aspath *as, int u
> -   assegment_header_put (s, seg->type, AS_SEGMENT_MAX);
> -   assegment_data_put (s, seg->as, AS_SEGMENT_MAX, use32bit);
> -   written += AS_SEGMENT_MAX;
> --  bytes += ASSEGMENT_SIZE (written, use32bit);
> -+  bytes += ASSEGMENT_SIZE (AS_SEGMENT_MAX, use32bit);
> - }
> -   
> -   /* write the final segment, probably is also the first */
> Index: patches/patch-configure_ac
> ===
> RCS file: /cvs/ports/net/quagga/patches/patch-configure_ac,v
> retrieving revision 1.5
> diff -u -p -r1.5 patch-configure_ac
> --- patches/patch-configure_ac31 Mar 2016 

quagga 1.2.2: tests wanted with mcast-based protos (OSPF/RIP)

2017-10-31 Thread Stuart Henderson
Does anyone have quagga setup with ripd and/or ospfd that's in a
position to test this update?

Background: OpenBSD multicast code wants the interface IP address passed
when joining/leaving groups.

Old quagga code passed this up e.g. from ripd/ospfd but this was changed
c.2012 and now only uses ifindex-based APIs (either RFC3678 MCAST_JOIN_GROUP
etc, struct ip_mreqn on some OS, or a hack allowed in some OS of passing
the ifindex in as the source address).

The current port version reverts to the old quagga code for this (and
has done so since 2013 - https://marc.info/?t=13570613121=1=2),
but it's becoming harder to maintain as upstream diverges (quagga 1.2 is
a bit different; the frrouter fork is different again).

So this takes a different and less intrusive approach to handling the
changes needed - borrowing some code used for SunOS in another function
in the file, given an ifindex from the calling function, it does a
lookup for the interface address, and uses that instead. This avoids
scattering the changes through 4 files, and reduces the main patch
scope (the current one is guaranteed to conflict when anything is
changed in the relevant functions upstream).

Any tests/comments welcome...



Index: Makefile
===
RCS file: /cvs/ports/net/quagga/Makefile,v
retrieving revision 1.53
diff -u -p -r1.53 Makefile
--- Makefile31 Oct 2017 09:37:18 -  1.53
+++ Makefile31 Oct 2017 11:42:44 -
@@ -2,13 +2,13 @@
 
 COMMENT=   multi-threaded routing daemon
 
-DISTNAME=  quagga-1.0.20161017
+DISTNAME=  quagga-1.2.2
 CATEGORIES=net
 MASTER_SITES=  http://download.savannah.gnu.org/releases/quagga/
 
-SHARED_LIBS=   ospf0.1 \
-   ospfapiclient   0.0 \
-   zebra   1.0
+.for i in ospf ospfapiclient zebra fpm_pb quagga_pb
+SHARED_LIBS+=  $i 1.0
+.endfor
 
 HOMEPAGE=  http://www.quagga.net/
 
@@ -37,10 +37,10 @@ CONFIGURE_ARGS+= --disable-pie
 CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib" \
LIBS=-lcurses
-
 MAKE_FLAGS=MAKEINFO="makeinfo --no-split"
 FAKE_FLAGS=exampledir='${PREFIX}/share/examples/quagga' \
${MAKE_FLAGS}
+LIBTOOL_FLAGS= --tag=disable-static
 
 FLAVORS=   snmp
 FLAVOR?=
Index: distinfo
===
RCS file: /cvs/ports/net/quagga/distinfo,v
retrieving revision 1.21
diff -u -p -r1.21 distinfo
--- distinfo31 Oct 2017 09:37:18 -  1.21
+++ distinfo31 Oct 2017 11:42:44 -
@@ -1,2 +1,2 @@
-SHA256 (quagga-1.0.20161017.tar.gz) = 
jyZyTdt0GfORL4DOjxNokZAongAizwmSHQpAP9dxSRg=
-SIZE (quagga-1.0.20161017.tar.gz) = 2758494
+SHA256 (quagga-1.2.2.tar.gz) = Ui4i8r7uZOPwws3j0BVfO4ED9Pb8ir75LLQLw6TMKTE=
+SIZE (quagga-1.2.2.tar.gz) = 2986142
Index: patches/patch-bgpd_bgp_aspath_c
===
RCS file: patches/patch-bgpd_bgp_aspath_c
diff -N patches/patch-bgpd_bgp_aspath_c
--- patches/patch-bgpd_bgp_aspath_c 31 Oct 2017 09:37:18 -  1.3
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,26 +0,0 @@
-$OpenBSD: patch-bgpd_bgp_aspath_c,v 1.3 2017/10/31 09:37:18 sthen Exp $
-
-From 7a42b78be9a4108d98833069a88e6fddb9285008 Mon Sep 17 00:00:00 2001
-From: Andreas Jaggi 
-Date: Mon, 2 Oct 2017 19:38:43 +0530
-Subject: bgpd: Fix AS_PATH size calculation for long paths
-
-If you have an AS_PATH with more entries than
-what can be written into a single AS_SEGMENT_MAX
-it needs to be broken up.  The code that noticed
-that the AS_PATH needs to be broken up was not
-correctly calculating the size of the resulting
-message.  This patch addresses this issue.
-
-Index: bgpd/bgp_aspath.c
 bgpd/bgp_aspath.c.orig
-+++ bgpd/bgp_aspath.c
-@@ -904,7 +904,7 @@ aspath_put (struct stream *s, struct aspath *as, int u
-   assegment_header_put (s, seg->type, AS_SEGMENT_MAX);
-   assegment_data_put (s, seg->as, AS_SEGMENT_MAX, use32bit);
-   written += AS_SEGMENT_MAX;
--  bytes += ASSEGMENT_SIZE (written, use32bit);
-+  bytes += ASSEGMENT_SIZE (AS_SEGMENT_MAX, use32bit);
- }
-   
-   /* write the final segment, probably is also the first */
Index: patches/patch-configure_ac
===
RCS file: /cvs/ports/net/quagga/patches/patch-configure_ac,v
retrieving revision 1.5
diff -u -p -r1.5 patch-configure_ac
--- patches/patch-configure_ac  31 Mar 2016 22:42:00 -  1.5
+++ patches/patch-configure_ac  31 Oct 2017 11:42:44 -
@@ -3,9 +3,10 @@ $OpenBSD: patch-configure_ac,v 1.5 2016/
 We have never supported passing an ifindex in struct
 ip_mreq.imr_interface.
 
 configure.ac.orig  Thu Mar 31 23:33:14 2016
-+++ configure.ac   Thu Mar 31 23:33:45 2016
-@@ -951,7 +951,7 @@ AC_CHECK_HEADERS([linux/mroute.h], [], [],