pkgsrc-Changes archive

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

CVS commit: pkgsrc/net/net-snmp



Module Name:    pkgsrc
Committed By:   gutteridge
Date:           Fri Jan 13 23:14:32 UTC 2023

Modified Files:
        pkgsrc/net/net-snmp: distinfo
Added Files:
        pkgsrc/net/net-snmp/patches: patch-agent_mibgroup_mibII_ipv6.c

Log Message:
net-snmp: NetBSD >= 9.99.104 build fixes (part one)

Address fallout from struct inpcb changes in NetBSD 9.99.104, as
impacts ipv6.c, specifically. Note this is compile-tested only (on
9.99.108 and 9.3_STABLE), I don't use this package (nor any of its
dependants) and haven't tested the functionality.

(At least tcpTable.c and udpTable.c also need adjustments. I don't have
the time or patience to deal with them at the moment, I'm so checking
in what I've adjusted so far.)

(The upstream code in ipv6.c uses two inconsistent approaches to handle
differences in NetBSD versions. I opted for the more explicit code
blocks everywhere, to avoid confusion. I didn't bother using the new
macros added in 9.99.104 to fetch specific struct members, as they
don't cover much of what's needed here anyway, and would arguably just
make things look even more ugly.)


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 pkgsrc/net/net-snmp/distinfo
cvs rdiff -u -r0 -r1.3 \
    pkgsrc/net/net-snmp/patches/patch-agent_mibgroup_mibII_ipv6.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/net-snmp/distinfo
diff -u pkgsrc/net/net-snmp/distinfo:1.100 pkgsrc/net/net-snmp/distinfo:1.101
--- pkgsrc/net/net-snmp/distinfo:1.100  Tue Oct 18 12:01:52 2022
+++ pkgsrc/net/net-snmp/distinfo        Fri Jan 13 23:14:31 2023
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.100 2022/10/18 12:01:52 adam Exp $
+$NetBSD: distinfo,v 1.101 2023/01/13 23:14:31 gutteridge Exp $
 
 BLAKE2s (net-snmp-5.9.3.tar.gz) = c5f3e30c73294c0f8b7db2a776a0a28e6f63ed1d55f32acb4328fbbb277cbe4a
 SHA512 (net-snmp-5.9.3.tar.gz) = a476df4967029a2eb03d27b0e250170785d0a8c143d49b900ee958c3cbdfaccd415b70af40f6fbed9cb8819d522c35a6073a431091d908ccc7c018fa0aaa2abc
@@ -17,6 +17,7 @@ SHA1 (patch-agent_mibgroup_mibII_icmp.c)
 SHA1 (patch-agent_mibgroup_mibII_interfaces.c) = 44a4ce6302457094ba2b200e4c47ff6c2a425746
 SHA1 (patch-agent_mibgroup_mibII_ip.c) = 04c2a487bad8705c9725ef4a62016051d3898970
 SHA1 (patch-agent_mibgroup_mibII_ipAddr.c) = cd3345a4b30fe2280d0555ee38feb5f957a55b1e
+SHA1 (patch-agent_mibgroup_mibII_ipv6.c) = f1e99ab8b5d5f31660112b85d863cc9ff90e0fdb
 SHA1 (patch-agent_mibgroup_mibII_tcp.c) = 92563fd6be6f27be5b348cdc8bc02061374026b0
 SHA1 (patch-agent_mibgroup_mibII_tcpTable.c) = acea4fdb55622df9ed0a45051412de278695c9da
 SHA1 (patch-agent_mibgroup_mibII_udp.c) = d110e996d0538d17251d39a5eed46df6944ba0fa

Added files:

Index: pkgsrc/net/net-snmp/patches/patch-agent_mibgroup_mibII_ipv6.c
diff -u /dev/null pkgsrc/net/net-snmp/patches/patch-agent_mibgroup_mibII_ipv6.c:1.3
--- /dev/null   Fri Jan 13 23:14:32 2023
+++ pkgsrc/net/net-snmp/patches/patch-agent_mibgroup_mibII_ipv6.c       Fri Jan 13 23:14:31 2023
@@ -0,0 +1,145 @@
+$NetBSD: patch-agent_mibgroup_mibII_ipv6.c,v 1.3 2023/01/13 23:14:31 gutteridge Exp $
+
+Account for pcb struct changes as of NetBSD 9.99.104.
+
+--- agent/mibgroup/mibII/ipv6.c.orig   2022-07-13 21:14:14.000000000 +0000
++++ agent/mibgroup/mibII/ipv6.c
+@@ -176,7 +176,7 @@
+ 
+ netsnmp_feature_require(linux_read_ip6_stat);
+ 
+-#if defined(netbsd1) && !defined(openbsd4)
++#if defined(netbsd1) && !defined(openbsd4) && __NetBSD_Version__ < 999010400
+ #define inp_lport in6p_lport
+ #define inp_fport in6p_fport
+ #define inp_ppcb in6p_ppcb
+@@ -1627,8 +1627,13 @@ var_udp6(register struct variable * vp,
+         }
+ #endif
+ #if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000    /*1.6Y*/
++# if __NetBSD_Version__ < 999010400
+         if (in6pcb.in6p_af != AF_INET6)
+             goto skip;
++# else
++        if (in6pcb.in6p_pcb.inp_af != AF_INET6)
++            goto skip;
++# endif
+ #elif defined(INP_ISIPV6)
+       if (!INP_ISIPV6(&in6pcb))
+           goto skip;
+@@ -1650,6 +1655,15 @@ var_udp6(register struct variable * vp,
+                 ntohs(*(uint16_t *) &in6pcb.inp_laddr6.s6_addr[2]);
+         else
+             newname[j++] = 0;
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400
++        for (i = 0; i < sizeof(struct in6_addr); i++)
++            newname[j++] = in6pcb.in6p_ip6.ip6_src.s6_addr[i];
++        newname[j++] = ntohs(in6pcb.in6p_pcb.inp_lport);
++        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_ip6.ip6_src))
++            newname[j++] =
++                ntohs(*(uint16_t *) &in6pcb.in6p_ip6.ip6_src.s6_addr[2]);
++        else
++            newname[j++] = 0;
+ #else
+         for (i = 0; i < sizeof(struct in6_addr); i++)
+             newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+@@ -1693,6 +1707,9 @@ var_udp6(register struct variable * vp,
+ #elif defined(openbsd4)
+         p = (caddr_t)in6pcb.inp_queue.cqe_next;
+       if (p == first) break;
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400
++        p = (caddr_t)in6pcb.in6p_pcb.inp_queue.tqe_next;
++        if (p == first) break;
+ #elif defined(__NetBSD__) && __NetBSD_Version__ >= 700000001
+         p = (caddr_t)in6pcb.in6p_queue.tqe_next;
+       if (p == first) break;
+@@ -1733,6 +1750,12 @@ var_udp6(register struct variable * vp,
+                 ntohs(*(uint16_t *) & in6pcb.inp_laddr6.s6_addr[2]);
+         else
+             long_return = 0;
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400
++        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_ip6.ip6_src))
++            long_return =
++                ntohs(*(uint16_t *) & in6pcb.in6p_ip6.ip6_src.s6_addr[2]);
++        else
++            long_return = 0;
+ #else
+         if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+             long_return =
+@@ -2204,8 +2227,13 @@ var_tcp6(register struct variable * vp,
+         }
+ #endif
+ #if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000    /*1.6Y*/
++# if __NetBSD_Version__ < 999010400
+         if (in6pcb.in6p_af != AF_INET6)
++             goto skip;
++# else
++        if (in6pcb.in6p_pcb.inp_af != AF_INET6)
+             goto skip;
++# endif
+ #elif defined(INP_ISIPV6)
+       if (!INP_ISIPV6(&in6pcb))
+           goto skip;
+@@ -2229,6 +2257,18 @@ var_tcp6(register struct variable * vp,
+                 ntohs(*(uint16_t *) &in6pcb.inp_laddr6.s6_addr[2]);
+         else
+             newname[j++] = 0;
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400
++        for (i = 0; i < sizeof(struct in6_addr); i++)
++            newname[j++] = in6pcb.in6p_ip6.ip6_src.s6_addr[i];
++        newname[j++] = ntohs(in6pcb.in6p_pcb.inp_lport);
++        for (i = 0; i < sizeof(struct in6_addr); i++)
++            newname[j++] = in6pcb.in6p_ip6.ip6_dst.s6_addr[i];
++        newname[j++] = ntohs(in6pcb.in6p_pcb.inp_fport);
++        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_ip6.ip6_src))
++            newname[j++] =
++                ntohs(*(uint16_t *) &in6pcb.in6p_ip6.ip6_src.s6_addr[2]);
++        else
++            newname[j++] = 0;
+ #else
+         for (i = 0; i < sizeof(struct in6_addr); i++)
+             newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+@@ -2249,7 +2289,11 @@ var_tcp6(register struct variable * vp,
+         DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+ 
+ #if 1                           /* this is very odd but sometimes happen, and cause infinite loop */
++ #if defined(__NetBSD__) && __NetBSD_Version__ >= 999010400
++        if (ntohs(in6pcb.in6p_pcb.inp_lport) == 0)
++ #else
+         if (ntohs(in6pcb.inp_lport) == 0)
++ #endif
+             goto skip;
+ #endif
+         result = snmp_oid_compare(name, *length, newname, j);
+@@ -2279,6 +2323,9 @@ var_tcp6(register struct variable * vp,
+ #elif defined(openbsd4)
+         p = (caddr_t)in6pcb.inp_queue.cqe_next;
+       if (p == first) break;
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400
++        p = (caddr_t)in6pcb.in6p_pcb.inp_queue.tqe_next;
++        if (p == first) break;
+ #elif defined(__NetBSD__) && __NetBSD_Version__ >= 700000001
+         p = (caddr_t)in6pcb.in6p_queue.tqe_next;
+       if (p == first) break;
+@@ -2302,11 +2349,17 @@ var_tcp6(register struct variable * vp,
+     *length = savnameLen;
+     memcpy((char *) name, (char *) savname, *length * sizeof(oid));
+     memcpy(&in6pcb, &savpcb, sizeof(savpcb));
++#if defined(__NetBSD__) && __NetBSD_Version__ >= 999010400
++    if (!NETSNMP_KLOOKUP(in6pcb.in6p_pcb.inp_ppcb, (char *) &tcpcb, sizeof(tcpcb))) {
++        DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6.tcpcb at %p\n",
++                    in6pcb.in6p_pcb.inp_ppcb));
++#else
+     if (!NETSNMP_KLOOKUP(in6pcb.inp_ppcb, (char *) &tcpcb, sizeof(tcpcb))) {
+-      DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6.tcpcb at %p\n",
+-                  in6pcb.inp_ppcb));
+-      found = 0;
+-      return NULL;
++        DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6.tcpcb at %p\n",
++                    in6pcb.inp_ppcb));
++#endif
++        found = 0;
++        return NULL;
+     }
+     *write_method = 0;
+     *var_len = sizeof(long);    /* default to 'long' results */



Home | Main Index | Thread Index | Old Index