Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Mar 2017 06:46:32 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r436565 - in head/net-mgmt/net-snmp: . files
Message-ID:  <201703210646.v2L6kW3k059522@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius (src committer)
Date: Tue Mar 21 06:46:32 2017
New Revision: 436565
URL: https://svnweb.freebsd.org/changeset/ports/436565

Log:
  Make it compilable on FreeBSD 12 after struct inpcb and struct tcpcb were
  stopped being exported.

Added:
  head/net-mgmt/net-snmp/files/patch-udpTable.c   (contents, props changed)
Modified:
  head/net-mgmt/net-snmp/Makefile
  head/net-mgmt/net-snmp/files/patch-agent_mibgroup_tcp-mib_data__access_tcpConn__freebsd4.c
  head/net-mgmt/net-snmp/files/patch-agent_mibgroup_udp-mib_data__access_udp__endpoint__freebsd4.c
  head/net-mgmt/net-snmp/files/patch-tcpTable.c

Modified: head/net-mgmt/net-snmp/Makefile
==============================================================================
--- head/net-mgmt/net-snmp/Makefile	Tue Mar 21 03:41:35 2017	(r436564)
+++ head/net-mgmt/net-snmp/Makefile	Tue Mar 21 06:46:32 2017	(r436565)
@@ -3,7 +3,7 @@
 
 PORTNAME=	snmp
 PORTVERSION=	5.7.3
-PORTREVISION=	12
+PORTREVISION=	13
 CATEGORIES=	net-mgmt ipv6
 MASTER_SITES=	SF/net-${PORTNAME}/net-${PORTNAME}/${PORTVERSION}
 PKGNAMEPREFIX=	net-

Modified: head/net-mgmt/net-snmp/files/patch-agent_mibgroup_tcp-mib_data__access_tcpConn__freebsd4.c
==============================================================================
--- head/net-mgmt/net-snmp/files/patch-agent_mibgroup_tcp-mib_data__access_tcpConn__freebsd4.c	Tue Mar 21 03:41:35 2017	(r436564)
+++ head/net-mgmt/net-snmp/files/patch-agent_mibgroup_tcp-mib_data__access_tcpConn__freebsd4.c	Tue Mar 21 06:46:32 2017	(r436565)
@@ -1,11 +1,23 @@
---- agent/mibgroup/tcp-mib/data_access/tcpConn_freebsd4.c.orig	2015-10-13 12:04:38 UTC
-+++ agent/mibgroup/tcp-mib/data_access/tcpConn_freebsd4.c
-@@ -216,6 +216,8 @@ _load(netsnmp_container *container, u_in
+--- agent/mibgroup/tcp-mib/data_access/tcpConn_freebsd4.c.orig	2017-03-15 18:15:07.000000000 +0000
++++ agent/mibgroup/tcp-mib/data_access/tcpConn_freebsd4.c	2017-03-15 18:15:07.000000000 +0000
+@@ -163,7 +163,11 @@
+ #else
+ 	xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+ #endif
++#if __FreeBSD_version >= 1200026
++	state = StateMap[pcb.t_state];
++#else
+ 	state = StateMap[pcb.xt_tp.t_state];
++#endif
+ 
+ 	if (load_flags) {
+ 	    if (state == TCPCONNECTIONSTATE_LISTEN) {
+@@ -215,6 +219,8 @@
+         entry->arbitrary_index = CONTAINER_SIZE(container) + 1;
          CONTAINER_INSERT(container, entry);
      }
- 
-+    free(tcpcb_buf);
 +
++    free(tcpcb_buf);
+ 
      if(rc<0)
          return rc;
- 

Modified: head/net-mgmt/net-snmp/files/patch-agent_mibgroup_udp-mib_data__access_udp__endpoint__freebsd4.c
==============================================================================
--- head/net-mgmt/net-snmp/files/patch-agent_mibgroup_udp-mib_data__access_udp__endpoint__freebsd4.c	Tue Mar 21 03:41:35 2017	(r436564)
+++ head/net-mgmt/net-snmp/files/patch-agent_mibgroup_udp-mib_data__access_udp__endpoint__freebsd4.c	Tue Mar 21 06:46:32 2017	(r436565)
@@ -1,11 +1,46 @@
---- agent/mibgroup/udp-mib/data_access/udp_endpoint_freebsd4.c.orig	2015-10-13 12:04:44 UTC
-+++ agent/mibgroup/udp-mib/data_access/udp_endpoint_freebsd4.c
-@@ -187,6 +187,8 @@ _load(netsnmp_container *container, u_in
+--- agent/mibgroup/udp-mib/data_access/udp_endpoint_freebsd4.c.orig	2017-03-15 18:18:33.000000000 +0000
++++ agent/mibgroup/udp-mib/data_access/udp_endpoint_freebsd4.c	2017-03-15 18:18:33.000000000 +0000
+@@ -164,9 +164,24 @@
+         }
+ 
+         /** oddly enough, these appear to already be in network order */
++#if __FreeBSD_version >= 1200026
++        entry->loc_port = htons(pcb.inp_lport);
++        entry->rmt_port = htons(pcb.inp_fport);
++        
++        /** the addr string may need work */
++	if (pcb.inp_vflag & INP_IPV6) {
++	    entry->loc_addr_len = entry->rmt_addr_len = 16;
++	    memcpy(entry->loc_addr, &pcb.in6p_laddr, 16);
++	    memcpy(entry->rmt_addr, &pcb.in6p_faddr, 16);
++	}
++	else {
++	    entry->loc_addr_len = entry->rmt_addr_len = 4;
++	    memcpy(entry->loc_addr, &pcb.inp_laddr, 4);
++	    memcpy(entry->rmt_addr, &pcb.inp_faddr, 4);
++	}
++#else
+         entry->loc_port = htons(pcb.xi_inp.inp_lport);
+         entry->rmt_port = htons(pcb.xi_inp.inp_fport);
+-        entry->pid = 0;
+         
+         /** the addr string may need work */
+ 	if (pcb.xi_inp.inp_vflag & INP_IPV6) {
+@@ -179,6 +194,8 @@
+ 	    memcpy(entry->loc_addr, &pcb.xi_inp.inp_laddr, 4);
+ 	    memcpy(entry->rmt_addr, &pcb.xi_inp.inp_faddr, 4);
+ 	}
++#endif
++        entry->pid = 0;
+ 
+         /*
+          * add entry to container
+@@ -186,6 +203,8 @@
+ 	entry->index = CONTAINER_SIZE(container) + 1;
          CONTAINER_INSERT(container, entry);
      }
- 
-+    free(udpcb_buf);
 +
++    free(udpcb_buf);
+ 
      if(rc<0)
          return rc;
- 

Modified: head/net-mgmt/net-snmp/files/patch-tcpTable.c
==============================================================================
--- head/net-mgmt/net-snmp/files/patch-tcpTable.c	Tue Mar 21 03:41:35 2017	(r436564)
+++ head/net-mgmt/net-snmp/files/patch-tcpTable.c	Tue Mar 21 06:46:32 2017	(r436565)
@@ -1,6 +1,18 @@
---- agent/mibgroup/mibII/tcpTable.c.orig	2011-07-01 19:35:46.000000000 -0300
-+++ agent/mibgroup/mibII/tcpTable.c	2011-07-27 10:00:57.000000000 -0300
-@@ -298,8 +298,10 @@
+--- agent/mibgroup/mibII/tcpTable.c.orig	2017-03-15 17:46:37.000000000 +0000
++++ agent/mibgroup/mibII/tcpTable.c	2017-03-15 17:46:37.000000000 +0000
+@@ -96,7 +96,11 @@
+ 
+ typedef struct netsnmp_inpcb_s netsnmp_inpcb;
+ struct netsnmp_inpcb_s {
++#if __FreeBSD_version >= 1200026
++    struct xinpcb   pcb;
++#else
+     struct inpcb    pcb;
++#endif
+     int             state;
+     netsnmp_inpcb  *inp_next;
+ };
+@@ -301,8 +305,10 @@
  #ifndef NETSNMP_FEATURE_REMOVE_TCP_COUNT_CONNECTIONS
  int
  TCP_Count_Connections( void ) {
@@ -11,3 +23,24 @@
  }
  #endif /* NETSNMP_FEATURE_REMOVE_TCP_COUNT_CONNECTIONS */
  
+@@ -923,12 +929,20 @@
+         nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
+         if (!nnew)
+             break;
++#if __FreeBSD_version >= 1200026
++        nnew->state = StateMap[((NS_ELEM *) xig)->t_state];
++#else
+         nnew->state = StateMap[((NS_ELEM *) xig)->xt_tp.t_state];
++#endif
+         if (nnew->state == 5 /* established */ ||
+             nnew->state == 8 /*  closeWait  */ )
+             tcp_estab++;
+         memcpy(&(nnew->pcb), &(((NS_ELEM *) xig)->xt_inp),
++#if __FreeBSD_version >= 1200026
++                           sizeof(struct xinpcb));
++#else
+                            sizeof(struct inpcb));
++#endif
+ 
+ 	if (nnew->pcb.inp_vflag & INP_IPV6)
+ 	    free(nnew);

Added: head/net-mgmt/net-snmp/files/patch-udpTable.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/net-snmp/files/patch-udpTable.c	Tue Mar 21 06:46:32 2017	(r436565)
@@ -0,0 +1,26 @@
+--- agent/mibgroup/mibII/udpTable.c.orig	2017-03-15 18:08:43.000000000 +0000
++++ agent/mibgroup/mibII/udpTable.c	2017-03-15 18:08:43.000000000 +0000
+@@ -71,7 +71,11 @@
+ #if defined(freebsd4) || defined(darwin) || defined(osf5)
+ typedef struct netsnmp_inpcb_s netsnmp_inpcb;
+ struct netsnmp_inpcb_s {
++#if __FreeBSD_version >= 1200026
++    struct xinpcb   pcb;
++#else
+     struct inpcb    pcb;
++#endif
+     int             state;
+     netsnmp_inpcb  *inp_next;
+ };
+@@ -670,7 +674,11 @@
+         nnew = SNMP_MALLOC_TYPEDEF(UDPTABLE_ENTRY_TYPE);
+         if (!nnew)
+             break;
++#if __FreeBSD_version >= 1200026
++        memcpy(&nnew->pcb, xig, sizeof(struct xinpcb));
++#else
+         memcpy(&nnew->pcb, &((struct xinpcb *) xig)->xi_inp, sizeof(struct inpcb));
++#endif
+ 	nnew->inp_next = udp_head;
+ 	udp_head   = nnew;
+ #if defined(dragonfly)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703210646.v2L6kW3k059522>