pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/net/wide-dhcpv6



Module Name:    pkgsrc
Committed By:   roy
Date:           Thu Feb  6 22:39:38 UTC 2020

Modified Files:
        pkgsrc/net/wide-dhcpv6: Makefile distinfo
Added Files:
        pkgsrc/net/wide-dhcpv6/patches: patch-config.h patch-dhcp6s.c
            patch-if.c

Log Message:
Allow dhcp6s to work on an interface with more than one linklocal address.

This is important for allowing CONFIRM messages to work with the on-link
check.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 pkgsrc/net/wide-dhcpv6/Makefile
cvs rdiff -u -r1.4 -r1.5 pkgsrc/net/wide-dhcpv6/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/net/wide-dhcpv6/patches/patch-config.h \
    pkgsrc/net/wide-dhcpv6/patches/patch-dhcp6s.c \
    pkgsrc/net/wide-dhcpv6/patches/patch-if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/net/wide-dhcpv6/Makefile
diff -u pkgsrc/net/wide-dhcpv6/Makefile:1.9 pkgsrc/net/wide-dhcpv6/Makefile:1.10
--- pkgsrc/net/wide-dhcpv6/Makefile:1.9 Sat Jan 18 23:33:23 2020
+++ pkgsrc/net/wide-dhcpv6/Makefile     Thu Feb  6 22:39:38 2020
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.9 2020/01/18 23:33:23 rillig Exp $
+# $NetBSD: Makefile,v 1.10 2020/02/06 22:39:38 roy Exp $
 
 DISTNAME=      wide-dhcpv6-20080615
+PKGREVISION=   1
 CATEGORIES=    net
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=wide-dhcpv6/}
 

Index: pkgsrc/net/wide-dhcpv6/distinfo
diff -u pkgsrc/net/wide-dhcpv6/distinfo:1.4 pkgsrc/net/wide-dhcpv6/distinfo:1.5
--- pkgsrc/net/wide-dhcpv6/distinfo:1.4 Wed Nov  4 00:35:44 2015
+++ pkgsrc/net/wide-dhcpv6/distinfo     Thu Feb  6 22:39:38 2020
@@ -1,6 +1,9 @@
-$NetBSD: distinfo,v 1.4 2015/11/04 00:35:44 agc Exp $
+$NetBSD: distinfo,v 1.5 2020/02/06 22:39:38 roy Exp $
 
 SHA1 (wide-dhcpv6-20080615.tar.gz) = 8829c4c871a74dccc0335839ff0a4e763b6b4f24
 RMD160 (wide-dhcpv6-20080615.tar.gz) = 4b7d8115de6c90b8f4878a2bf25a5fd6aceea13a
 SHA512 (wide-dhcpv6-20080615.tar.gz) = 2c6d5ca523dbf07fae0e65af86ed24f6582bf5230df394da385e26ff818594fd15d909851723c582792b4649a89d7f2a99999c5d3aac1ea22229348b8afc2d8b
 Size (wide-dhcpv6-20080615.tar.gz) = 215354 bytes
+SHA1 (patch-config.h) = 89e97d912a07e9732df071fc4e12694593b9db87
+SHA1 (patch-dhcp6s.c) = 33ac74669efa29ab1e59f979930d75060c393d36
+SHA1 (patch-if.c) = a7e0866d3cb82df21e7d04fb835971fd7b7ef229

Added files:

Index: pkgsrc/net/wide-dhcpv6/patches/patch-config.h
diff -u /dev/null pkgsrc/net/wide-dhcpv6/patches/patch-config.h:1.1
--- /dev/null   Thu Feb  6 22:39:38 2020
+++ pkgsrc/net/wide-dhcpv6/patches/patch-config.h       Thu Feb  6 22:39:38 2020
@@ -0,0 +1,29 @@
+$NetBSD: patch-config.h,v 1.1 2020/02/06 22:39:38 roy Exp $
+
+Allow CONFIRM to check all addresses on the link.
+
+--- config.h.orig      2008-06-15 07:48:41.000000000 +0000
++++ config.h
+@@ -33,6 +33,12 @@
+ TAILQ_HEAD(ia_conflist, ia_conf);
+ TAILQ_HEAD(pifc_list, prefix_ifconf);
+ 
++struct if_addr {
++      TAILQ_ENTRY(if_addr) link;
++      struct in6_addr addr;
++};
++TAILQ_HEAD(if_addr_list, if_addr);
++
+ struct dhcp6_poolspec {
+       char* name;
+       u_int32_t pltime;
+@@ -67,8 +73,7 @@ struct dhcp6_if {
+       char *ifname;
+       unsigned int ifid;
+       u_int32_t linkid;       /* to send link-local packets */
+-      /* multiple global address configuration is not supported now */
+-      struct in6_addr addr;   /* global address */
++      struct if_addr_list addr_list;
+ 
+       /* configuration parameters */
+       u_long send_flags;
Index: pkgsrc/net/wide-dhcpv6/patches/patch-dhcp6s.c
diff -u /dev/null pkgsrc/net/wide-dhcpv6/patches/patch-dhcp6s.c:1.1
--- /dev/null   Thu Feb  6 22:39:38 2020
+++ pkgsrc/net/wide-dhcpv6/patches/patch-dhcp6s.c       Thu Feb  6 22:39:38 2020
@@ -0,0 +1,58 @@
+$NetBSD: patch-dhcp6s.c,v 1.1 2020/02/06 22:39:38 roy Exp $
+
+Allow CONFIRM to check all addresses on the link.
+
+--- dhcp6s.c.orig      2008-06-15 07:51:57.000000000 +0000
++++ dhcp6s.c
+@@ -2237,10 +2237,20 @@ react_confirm(ifp, pi, dh6, len, optinfo
+                   iaaddr = TAILQ_NEXT(iaaddr, link)) {
+               
+                       struct in6_addr *confaddr = &iaaddr->val_statefuladdr6.addr;
+-                      struct in6_addr *linkaddr;
++                      struct in6_addr *linkaddr = NULL;
+                       struct sockaddr_in6 *src = (struct sockaddr_in6 *)from;
++                      struct if_addr *ia;
+ 
+-                      if (!IN6_IS_ADDR_LINKLOCAL(&src->sin6_addr)) {
++                      /* CONFIRM should match an interface address */
++                      TAILQ_FOREACH(ia, &ifp->addr_list, link) {
++                              if (memcmp(&ia->addr, confaddr, 8) == 0) {
++                                      linkaddr = &ia->addr;
++                                      break;
++                              }
++                      }
++
++                      if (linkaddr == NULL &&
++                          !IN6_IS_ADDR_LINKLOCAL(&src->sin6_addr)) {
+                               /* CONFIRM is relayed via a DHCP-relay */
+                               struct relayinfo *relayinfo;
+ 
+@@ -2249,20 +2259,19 @@ react_confirm(ifp, pi, dh6, len, optinfo
+                                           "no link-addr found");
+                                       goto fail;
+                               }
+-                              relayinfo = TAILQ_LAST(relayinfohead, relayinfolist);
++                              relayinfo = TAILQ_LAST(relayinfohead,
++                                  relayinfolist);
+ 
+-                              /* XXX: link-addr is supposed to be a global address */
+-                              linkaddr = &relayinfo->linkaddr;
+-                      } else {
+-                              /* CONFIRM is directly arrived */
+-                              linkaddr = &ifp->addr;
++                              /* XXX: link-addr is supposed to be a
++                               * global address */
++                              if (!memcmp(&relayinfo->linkaddr, confaddr, 8))
++                                      linkaddr = &relayinfo->linkaddr;
+                       }
+ 
+-                      if (memcmp(linkaddr, confaddr, 8) != 0) {
++                      if (linkaddr == NULL) {
+                               dprintf(LOG_INFO, FNAME,
+                                   "%s does not seem to belong to %s's link",
+-                                  in6addr2str(confaddr, 0),
+-                                  in6addr2str(linkaddr, 0));
++                                  in6addr2str(confaddr, 0), ifp->ifname);
+                               stcode = DH6OPT_STCODE_NOTONLINK;
+                               goto send_reply;
+                       }
Index: pkgsrc/net/wide-dhcpv6/patches/patch-if.c
diff -u /dev/null pkgsrc/net/wide-dhcpv6/patches/patch-if.c:1.1
--- /dev/null   Thu Feb  6 22:39:38 2020
+++ pkgsrc/net/wide-dhcpv6/patches/patch-if.c   Thu Feb  6 22:39:38 2020
@@ -0,0 +1,55 @@
+$NetBSD: patch-if.c,v 1.1 2020/02/06 22:39:38 roy Exp $
+
+Allow CONFIRM to check all addresses on the link.
+
+--- if.c.orig  2008-06-15 07:48:43.000000000 +0000
++++ if.c
+@@ -58,6 +58,7 @@ ifinit(ifname)
+       char *ifname;
+ {
+       struct dhcp6_if *ifp;
++      struct if_addr *ia;
+ 
+       if ((ifp = find_ifconfbyname(ifname)) != NULL) {
+               dprintf(LOG_NOTICE, FNAME, "duplicated interface: %s", ifname);
+@@ -66,11 +67,12 @@ ifinit(ifname)
+ 
+       if ((ifp = malloc(sizeof(*ifp))) == NULL) {
+               dprintf(LOG_ERR, FNAME, "malloc failed");
+-              goto fail;
++              return (NULL);
+       }
+       memset(ifp, 0, sizeof(*ifp));
+ 
+       TAILQ_INIT(&ifp->event_list);
++      TAILQ_INIT(&ifp->addr_list);
+ 
+       if ((ifp->ifname = strdup(ifname)) == NULL) {
+               dprintf(LOG_ERR, FNAME, "failed to copy ifname");
+@@ -109,7 +111,14 @@ ifinit(ifname)
+                       if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
+                               continue;
+ 
+-                      ifp->addr = sin6->sin6_addr;
++                      ia = malloc(sizeof(*ia));
++                      if (ia == NULL) {
++                              dprintf(LOG_ERR, FNAME, "malloc failed: %s",
++                                  strerror(errno));
++                              goto fail;
++                      }
++                      ia->addr = sin6->sin6_addr;
++                      TAILQ_INSERT_TAIL(&ifp->addr_list, ia, link);
+               }
+ 
+               freeifaddrs(ifap);
+@@ -122,6 +131,10 @@ ifinit(ifname)
+   fail:
+       if (ifp->ifname != NULL)
+               free(ifp->ifname);
++      while ((ia = TAILQ_FIRST(&ifp->addr_list)) != NULL) {
++              TAILQ_REMOVE(&ifp->addr_list, ia, link);
++              free(ia);
++      }
+       free(ifp);
+       return (NULL);
+ }



Home | Main Index | Thread Index | Old Index