Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2007 22:15:57 GMT
From:      Matus Harvan <mharvan@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 122248 for review
Message-ID:  <200706242215.l5OMFvcJ003428@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=122248

Change 122248 by mharvan@mharvan_home on 2007/06/24 22:15:37

	bugfix for the server - correctly update current_pl
	s/AF_UNSPEC/AF_INET/g

Affected files ...

.. //depot/projects/soc2007/mharvan-mtund/mtund.src/Makefile#3 edit
.. //depot/projects/soc2007/mharvan-mtund/mtund.src/plugin_tcp.c#3 edit
.. //depot/projects/soc2007/mharvan-mtund/mtund.src/plugin_udp.c#3 edit
.. //depot/projects/soc2007/mharvan-mtund/mtund.src/tunneld.c#3 edit

Differences ...

==== //depot/projects/soc2007/mharvan-mtund/mtund.src/Makefile#3 (text+ko) ====

@@ -19,7 +19,7 @@
 	gcc $(CFLAGS) -shared  -o plugin_udp.so plugin_udp.c
 
 clean:
-	rm -f tunneld plugin_tcp.so plugin_udp.so
+	rm -f tunneld plugin_tcp.so plugin_udp.so *.core
 
 backup:
 	rsync -a `pwd` meat:backup/

==== //depot/projects/soc2007/mharvan-mtund/mtund.src/plugin_tcp.c#3 (text+ko) ====

@@ -44,7 +44,8 @@
     
     memset(&hints, 0, sizeof(hints));
     hints.ai_flags = AI_PASSIVE;
-    hints.ai_family = AF_UNSPEC;
+    //hints.ai_family = AF_UNSPEC;
+    hints.ai_family = AF_INET;
     hints.ai_socktype = SOCK_STREAM;
 
     n = getaddrinfo(NULL, port, &hints, &ai_list);
@@ -131,7 +132,8 @@
     struct timeval tv;
     
     memset(&hints, 0, sizeof(hints));
-    hints.ai_family = AF_UNSPEC;
+    //hints.ai_family = AF_UNSPEC;
+    hints.ai_family = AF_INET;
     hints.ai_socktype = SOCK_STREAM;
 
     n = getaddrinfo(host, port, &hints, &ai_list);

==== //depot/projects/soc2007/mharvan-mtund/mtund.src/plugin_udp.c#3 (text+ko) ====

@@ -35,7 +35,8 @@
     int n, fd = 0;
 
     memset(&hints, 0, sizeof(hints));
-    hints.ai_family = AF_UNSPEC;
+    //hints.ai_family = AF_UNSPEC;
+    hints.ai_family = AF_INET;
     hints.ai_socktype = SOCK_DGRAM;
 
     n = getaddrinfo(host, port, &hints, &ai_list);
@@ -82,7 +83,8 @@
 
     memset(&hints, 0, sizeof(hints));
     hints.ai_flags = AI_PASSIVE;
-    hints.ai_family = AF_UNSPEC;
+    //hints.ai_family = AF_UNSPEC;
+    hints.ai_family = AF_INET;
     hints.ai_socktype = SOCK_DGRAM;
 
     n = getaddrinfo(NULL, port, &hints, &ai_list);

==== //depot/projects/soc2007/mharvan-mtund/mtund.src/tunneld.c#3 (text+ko) ====

@@ -192,6 +192,9 @@
  */
 void process_data_from_plugin(plugint *pl, char *data, int len)
 {
+    if (len > 0) {
+	current_pl = pl;
+    }
     tun_send(data, len);
 }
 
@@ -205,13 +208,13 @@
     if (current_pl == NULL) {
 	fprintf(stderr, "no plugin connected yet, discarding tun data\n");
 	report_plugin_error(NULL, PLUGIN_ERROR_BOOTSTRAP);
-    }
+    } else {
+	n = current_pl->send(current_pl, data, len);
 
-    n = current_pl->send(current_pl, data, len);
-
-    if (n < len) {
-	fprintf(stderr, "process_data_from_tun: plugind sent less "
-		"bytes (%d) than requested (%d)\n", n, len);
+	if (n < len) {
+	    fprintf(stderr, "process_data_from_tun: plugind sent less "
+		    "bytes (%d) than requested (%d)\n", n, len);
+	}
     }
 }
 



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