amd64/141356: net-mgmt/netams-3.4.3 does not build on FreeBSD 8.0 amd64

Sergey Popov faijeya at gmail.com
Thu Dec 10 22:00:15 UTC 2009


>Number:         141356
>Category:       amd64
>Synopsis:       net-mgmt/netams-3.4.3 does not build on FreeBSD 8.0 amd64
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-amd64
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 10 22:00:14 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Sergey Popov
>Release:        8.0 amd64
>Organization:
>Environment:
FreeBSD mailserver 8.0-RELEASE FreeBSD 8.0-RELEASE #0 Sat Nov 21 15:02:08 UTC 2009 root at mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
Traffic accountment software "netams" does not build on FreeBSD 8.0 as on version 3.4.3 (latest at the moment).

It is already locked in ports with reason "does not compile", so I think, it's not 8.0-only.
>How-To-Repeat:
Download http://www.netams.com/files/netams-3.4.3.tar.gz , unpack it, run ./configure.sh and then run make.
>Fix:
I have a (pretty crude) fix which I used to make netams actually compile.

I commented out some strange debug call in one file and replaced a goto (yes, wtf) construction in another by if-else.

I've attached diffs (sorry, I'm not so keen in submitting patches) of files I changed against latest netams 3.4.3 version.

Patch attached with submission follows:

diff -urN netams-3.4.3/src/ds_ipfw.c netams-3.4.3-fxd/src/ds_ipfw.c
--- netams-3.4.3/src/ds_ipfw.c	2008-02-23 10:35:02.000000000 +0200
+++ netams-3.4.3-fxd/src/ds_ipfw.c	2009-12-11 05:51:55.000000000 +0200
@@ -32,55 +32,47 @@
 
         if ((socketid = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT)) < 0) {
 		aLog(D_ERR, "divert socket\n");
-		goto END;
 	}
-        if (bind(socketid, (struct sockaddr *)&(sin), sizeof(sin))) {
+	else
+	{
+    	    if (bind(socketid, (struct sockaddr *)&(sin), sizeof(sin))) 
+	    {
 		aLog(D_ERR, "bind divert socket: %u\n", socketid);
-		goto END;
-	}
-	SET_POLL(socketid);
-
-	pthread_cleanup_push(ds_ipfw_cancel, (void*) &socketid);
-	pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
-
-	aLog(D_INFO,"IPFW packet processing for data-source:%u initialized\n",ds->instance);
-	
-	int			status;
-	int			process_result;
-	struct ipv4_key		key;
-	bzero(&key, sizeof(struct ipv4_key));
-	entry                   *flow_entry;
-
-	while(1) {
-		CHECK_POLL(ds,status);
-		
-                netams_gettimeofday(&start, NULL);
-		FE->Expiresearch(&start);  
-		if(!status) continue;
-		
-		len=recvfrom(socketid, packet, MAX_PKT_SIZE, 0, (struct sockaddr *)&sin, &size_ds);
-		IPv4GetKey((struct ip*) packet, &key);
-		
-		process_result = FE->Process((u_char *)&key, 1, ntohs(((struct ip*) packet)->ip_len), &flow_entry);
-		if(process_result == -1) {
+	    }
+	    else
+	    {
+		SET_POLL(socketid);
+		pthread_cleanup_push(ds_ipfw_cancel, (void*) &socketid);
+		pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
+		aLog(D_INFO,"IPFW packet processing for data-source:%u initialized\n",ds->instance);
+	        int			status;
+	        int			process_result;
+		struct ipv4_key		key;
+		bzero(&key, sizeof(struct ipv4_key));
+		entry                   *flow_entry;
+
+		while(1) 
+		{
+		    CHECK_POLL(ds,status);
+		    netams_gettimeofday(&start, NULL);
+		    FE->Expiresearch(&start);  
+		    if(!status) continue;
+		    len=recvfrom(socketid, packet, MAX_PKT_SIZE, 0, (struct sockaddr *)&sin, &size_ds);
+		    IPv4GetKey((struct ip*) packet, &key);
+		    process_result = FE->Process((u_char *)&key, 1, ntohs(((struct ip*) packet)->ip_len), &flow_entry);
+		    if(process_result == -1) 
+		    {
 			IPv4FillFlow(&key, flow_entry);
-
-#ifdef LAYER7_FILTER
 			if (ds->layer7_detect!=LAYER7_DETECT_NONE) layer7_addinfo(key.tcp_info.dst_port, flow_entry); 
-#endif
-
 			if(ds->ds_flags==DS_DIVERT) process_result = FE->FW(flow_entry);
+		    }
+		    if (process_result && (ds->ds_flags==DS_DIVERT)) 
+		    	    sendto(socketid, packet, len, 0, (struct sockaddr *)&sin, size_ds);
+		    if (ds->layer7_detect!=LAYER7_DETECT_NONE) layer7_checkinfo(key.tcp_info.dst_port, flow_entry, (struct ip*) packet);
+		    ds->Measure(&start, len);
 		}
-		
-		if (process_result && (ds->ds_flags==DS_DIVERT)) 
-			sendto(socketid, packet, len, 0, (struct sockaddr *)&sin, size_ds);
-		
-#ifdef LAYER7_FILTER
-		if (ds->layer7_detect!=LAYER7_DETECT_NONE) layer7_checkinfo(key.tcp_info.dst_port, flow_entry, (struct ip*) packet); 
-#endif
-		ds->Measure(&start, len);
+	    }
 	}
-END:
 	pthread_cleanup_pop(1);
 }
 /////////////////////////////////////////////////////////////////////////////////////
diff -urN netams-3.4.3/src/ipfw2netflow.c netams-3.4.3-fxd/src/ipfw2netflow.c
--- netams-3.4.3/src/ipfw2netflow.c	2008-02-23 10:35:02.000000000 +0200
+++ netams-3.4.3-fxd/src/ipfw2netflow.c	2009-12-11 05:52:05.000000000 +0200
@@ -69,7 +69,7 @@
 
 void do_hup()
 {
-    Debug("SIGHUP\n");
+//    Debug("SIGHUP\n");
     hupset = 1;
     signal(SIGHUP, (sig_t)do_hup);
 }


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-amd64 mailing list