Fix dhcpcd(8) breakage

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fix dhcpcd(8) breakage

Martin Pieuchot
Conditionally issues ioctl(2)s the kernel no longer supports.  There's
no need to work around the kernel expiring prefixes and routers anymore
on OpenBSD.

This fix a breakage introduced by my recent removal of such ioctl(2),
reported by aja@.

ok?

Index: patches/patch-if-bsd_c
===================================================================
RCS file: /cvs/ports/net/dhcpcd/patches/patch-if-bsd_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-if-bsd_c
--- patches/patch-if-bsd_c 10 Aug 2017 06:58:39 -0000 1.2
+++ patches/patch-if-bsd_c 27 Oct 2017 08:56:30 -0000
@@ -5,6 +5,10 @@ Fixed with netinet6/in6.c r1.202.
 
 netinet6/nd6.h r1.72 removed ND6_IFF_PERFORMNUD
 
+Also conditionnaly flush prefix and router lists, OpenBSD no longer
+keep track of them in kernel.  So there's no risk for dhcpcd(8) to
+have its advertised routers and prefixes expired.
+
 Index: if-bsd.c
 --- if-bsd.c.orig
 +++ if-bsd.c
@@ -33,3 +37,20 @@ Index: if-bsd.c
 
  static int
  if_raflush(int s)
+@@ -1720,9 +1722,14 @@ if_raflush(int s)
+ char dummy[IFNAMSIZ + 8];
+
+ strlcpy(dummy, "lo0", sizeof(dummy));
+- if (ioctl(s, SIOCSRTRFLUSH_IN6, (void *)&dummy) == -1 ||
+-    ioctl(s, SIOCSPFXFLUSH_IN6, (void *)&dummy) == -1)
++#ifdef SIOCSRTRFLUSH_IN6
++ if (ioctl(s, SIOCSRTRFLUSH_IN6, (void *)&dummy) == -1)
+ return -1;
++#endif
++#ifdef SIOCSPFXFLUSH_IN6
++ if (ioctl(s, SIOCSPFXFLUSH_IN6, (void *)&dummy) == -1)
++ return -1;
++#endif
+ return 0;
+ }
+