Skip to content

Instantly share code, notes, and snippets.

@nonakap
Created November 22, 2022 14:37
Show Gist options
  • Save nonakap/2e5fa6f7b838109047df489a08090165 to your computer and use it in GitHub Desktop.
Save nonakap/2e5fa6f7b838109047df489a08090165 to your computer and use it in GitHub Desktop.
pkgsrc/net/net-snmp: Fix build failure for NetBSD 9.99.104 inpcb changes.
diff --git a/net/net-snmp/Makefile.common b/net/net-snmp/Makefile.common
index ca1a67010ce..13f95142631 100644
--- a/net/net-snmp/Makefile.common
+++ b/net/net-snmp/Makefile.common
@@ -3,6 +3,7 @@
# used by net/py-netsnmp/Makefile
DISTNAME= net-snmp-5.9.3
+PKGREVISION= 1
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=net-snmp/}
HOMEPAGE= http://www.net-snmp.org/
diff --git a/net/net-snmp/distinfo b/net/net-snmp/distinfo
index e998b3fc07b..4089ea2f914 100644
--- a/net/net-snmp/distinfo
+++ b/net/net-snmp/distinfo
@@ -17,10 +17,11 @@ SHA1 (patch-agent_mibgroup_mibII_icmp.c) = 50ac67db8a9ffc16d983b4192e74db25ef439
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) = 5635552d2fd4ec03d135720b81098aca4fc10937
SHA1 (patch-agent_mibgroup_mibII_tcp.c) = 92563fd6be6f27be5b348cdc8bc02061374026b0
-SHA1 (patch-agent_mibgroup_mibII_tcpTable.c) = acea4fdb55622df9ed0a45051412de278695c9da
+SHA1 (patch-agent_mibgroup_mibII_tcpTable.c) = 962d14b4438b75c3dfca26a88e46f5aa79e3b5c1
SHA1 (patch-agent_mibgroup_mibII_udp.c) = d110e996d0538d17251d39a5eed46df6944ba0fa
-SHA1 (patch-agent_mibgroup_mibII_udpTable.c) = 7672f7df9c8f6540987895e784b85de1e7cebf5e
+SHA1 (patch-agent_mibgroup_mibII_udpTable.c) = f07945c3c1368f68f54f1fa5b300543c5eed0bf7
SHA1 (patch-agent_mibgroup_mibII_var__route.c) = 919348e62849367793e4abf7d608d9824eb8ff2d
SHA1 (patch-agent_mibgroup_ucd-snmp_memory__netbsd1.c) = 7336d905bac315f344f93664e4118332f88fb6ee
SHA1 (patch-agent_snmp__perl.c) = 893cf46624d4f26941b3911a64c752c110ba6ef8
diff --git a/net/net-snmp/patches/patch-agent_mibgroup_mibII_tcpTable.c b/net/net-snmp/patches/patch-agent_mibgroup_mibII_tcpTable.c
index 618cae150c3..971b310c18c 100644
--- a/net/net-snmp/patches/patch-agent_mibgroup_mibII_tcpTable.c
+++ b/net/net-snmp/patches/patch-agent_mibgroup_mibII_tcpTable.c
@@ -1,9 +1,62 @@
$NetBSD: patch-agent_mibgroup_mibII_tcpTable.c,v 1.2 2020/06/12 02:22:08 sevan Exp $
---- agent/mibgroup/mibII/tcpTable.c.orig 2020-06-12 02:28:28.274144065 +0100
-+++ agent/mibgroup/mibII/tcpTable.c 2020-06-12 02:30:19.848438704 +0100
-@@ -1043,7 +1043,11 @@
+--- agent/mibgroup/mibII/tcpTable.c.orig 2022-07-13 21:14:14.000000000 +0000
++++ agent/mibgroup/mibII/tcpTable.c 2022-11-22 13:25:32.012297433 +0000
+@@ -122,6 +122,12 @@ typedef struct netsnmp_inpcb_s netsnmp_i
+ struct netsnmp_inpcb_s {
+ #if __FreeBSD_version >= 1200026
+ struct xinpcb pcb;
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400 /*9.99.104*/
++ union {
++ struct inpcb pcb;
++ struct in4pcb pcb4;
++ struct in6pcb pcb6;
++ };
+ #else
+ struct inpcb pcb;
+ #endif
+@@ -278,6 +284,10 @@ tcpTable_handler(netsnmp_mib_handler
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char*)IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr),
+ sizeof(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr)));
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400 /*9.99.104*/
++ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
++ (u_char*)&in4p_laddr(&entry->pcb).s_addr,
++ sizeof(in4p_laddr(&entry->pcb).s_addr));
+ #else
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char *)&entry->TCPTABLE_LOCALADDRESS,
+@@ -294,6 +304,10 @@ tcpTable_handler(netsnmp_mib_handler
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char*)IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr),
+ sizeof(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr)));
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400 /*9.99.104*/
++ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
++ (u_char*)&in4p_faddr(&entry->pcb).s_addr,
++ sizeof(in4p_faddr(&entry->pcb).s_addr));
+ #else
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char *)&entry->TCPTABLE_REMOTEADDRESS,
+@@ -489,6 +503,8 @@ tcpTable_next_entry( void **loop_context
+ idx = index;
+ #if defined(osf5) && defined(IN6_EXTRACT_V4ADDR)
+ addr = ntohl(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr));
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400 /*9.99.104*/
++ addr = ntohl(in4p_laddr(&entry->pcb).s_addr);
+ #else
+ addr = ntohl(entry->TCPTABLE_LOCALADDRESS);
+ #endif
+@@ -501,6 +517,8 @@ tcpTable_next_entry( void **loop_context
+ idx = idx->next_variable;
+ #if defined(osf5) && defined(IN6_EXTRACT_V4ADDR)
+ addr = ntohl(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_faddr));
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400 /*9.99.104*/
++ addr = ntohl(in4p_faddr(&entry->pcb).s_addr);
+ #else
+ addr = ntohl(entry->TCPTABLE_REMOTEADDRESS);
+ #endif
+@@ -1057,7 +1075,11 @@ tcpTable_load(netsnmp_cache *cache, void
/*
* Set up a linked list
*/
@@ -15,7 +68,7 @@ $NetBSD: patch-agent_mibgroup_mibII_tcpTable.c,v 1.2 2020/06/12 02:22:08 sevan E
while (entry) {
nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
-@@ -1067,8 +1071,13 @@
+@@ -1081,8 +1103,13 @@ tcpTable_load(netsnmp_cache *cache, void
nnew->inp_next = tcp_head;
tcp_head = nnew;
diff --git a/net/net-snmp/patches/patch-agent_mibgroup_mibII_udpTable.c b/net/net-snmp/patches/patch-agent_mibgroup_mibII_udpTable.c
index 39bdec623d9..7818edfd5c2 100644
--- a/net/net-snmp/patches/patch-agent_mibgroup_mibII_udpTable.c
+++ b/net/net-snmp/patches/patch-agent_mibgroup_mibII_udpTable.c
@@ -1,8 +1,31 @@
$NetBSD: patch-agent_mibgroup_mibII_udpTable.c,v 1.3 2022/10/18 12:01:52 adam Exp $
---- agent/mibgroup/mibII/udpTable.c.orig 2020-06-12 01:53:58.092446674 +0100
-+++ agent/mibgroup/mibII/udpTable.c 2020-06-12 02:01:40.556941658 +0100
-@@ -426,7 +426,11 @@
+--- agent/mibgroup/mibII/udpTable.c.orig 2022-07-13 21:14:14.000000000 +0000
++++ agent/mibgroup/mibII/udpTable.c 2022-11-22 13:38:46.322084213 +0000
+@@ -249,6 +249,11 @@ udpTable_handler(netsnmp_mib_handler
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char*)&addr,
+ sizeof(uint32_t));
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400 /*9.99.104*/
++ addr = UDP_ADDRESS_TO_HOST_ORDER(in4p_laddr(entry).s_addr);
++ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
++ (u_char*)&addr,
++ sizeof(uint32_t));
+ #else
+ addr = UDP_ADDRESS_TO_HOST_ORDER(entry->UDPTABLE_LOCALADDRESS);
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+@@ -416,6 +421,10 @@ udpTable_next_entry( void **loop_context
+ snmp_set_var_value(index,
+ (u_char*)&IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr),
+ sizeof(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr)));
++#elif defined(__NetBSD__) && __NetBSD_Version__ >= 999010400 /*9.99.104*/
++ addr = UDP_ADDRESS_TO_NETWORK_ORDER((in_addr_t)(in4p_laddr(entry).s_addr));
++ snmp_set_var_value(index, (u_char *)&addr,
++ sizeof(addr));
+ #else
+ addr = UDP_ADDRESS_TO_NETWORK_ORDER((in_addr_t)entry->UDPTABLE_LOCALADDRESS);
+ snmp_set_var_value(index, (u_char *)&addr,
+@@ -430,7 +439,11 @@ udpTable_next_entry( void **loop_context
* and update the loop context ready for the next one.
*/
*data_context = (void*)entry;
@@ -14,7 +37,7 @@ $NetBSD: patch-agent_mibgroup_mibII_udpTable.c,v 1.3 2022/10/18 12:01:52 adam Ex
return index;
}
-@@ -436,7 +440,11 @@
+@@ -440,7 +453,11 @@ udpTable_free(netsnmp_cache *cache, void
UDPTABLE_ENTRY_TYPE *p;
while (udp_head) {
p = udp_head;
@@ -26,7 +49,7 @@ $NetBSD: patch-agent_mibgroup_mibII_udpTable.c,v 1.3 2022/10/18 12:01:52 adam Ex
free(p);
}
-@@ -744,7 +752,11 @@
+@@ -752,7 +769,11 @@ udpTable_load(netsnmp_cache *cache, void
/*
* Set up a linked list
*/
@@ -38,7 +61,7 @@ $NetBSD: patch-agent_mibgroup_mibII_udpTable.c,v 1.3 2022/10/18 12:01:52 adam Ex
while (entry) {
nnew = SNMP_MALLOC_TYPEDEF(struct inpcb);
-@@ -801,12 +813,22 @@
+@@ -809,12 +830,22 @@ udpTable_load(netsnmp_cache *cache, void
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment