Repository : ssh://git@open-mesh.org/doc
On branches: backup-redmine/2017-07-13,master
>---------------------------------------------------------------
commit 323869ab3d0dbcd5fc4216cce0b48beae5cb4c21
Author: Antonio Quartulli <a(a)unstable.cc>
Date: Mon Oct 24 20:10:47 2011 +0000
doc: attachments/vde2-2.3.1-wirefilter-ethertype.patch
>---------------------------------------------------------------
323869ab3d0dbcd5fc4216cce0b48beae5cb4c21
attachments/vde2-2.3.1-wirefilter-ethertype.patch | 111 ++++++++++++++++++++++
1 file changed, 111 insertions(+)
diff --git a/attachments/vde2-2.3.1-wirefilter-ethertype.patch b/attachments/vde2-2.3.1-wirefilter-ethertype.patch
new file mode 100644
index 00000000..9874ea2e
--- /dev/null
+++ b/attachments/vde2-2.3.1-wirefilter-ethertype.patch
@@ -0,0 +1,111 @@
+--- src/wirefilter.c.orig 2010-07-25 19:48:02.000000000 +0200
++++ src/wirefilter.c 2011-10-24 18:21:01.122126068 +0200
+@@ -59,6 +59,9 @@
+ char debuglevel[NPFD];
+ char *progname;
+ char *mgmt;
++char ether_type[2];
++unsigned char ether_num_bytes;
++char ether_bytes[10];
+ int mgmtmode=0700;
+ #define LR 0
+ #define RL 1
+@@ -524,13 +527,39 @@
+
+ void handle_packet(int dir,const unsigned char *buf,int size)
+ {
++ int i;
++
+ /* MTU */
+ /* if the packet is incosistent with the MTU of the line just drop it */
+ if (min_wirevalue(markov_current,MTU,dir) > 0 && size > min_wirevalue(markov_current,MTU,dir))
+ return;
+
++ /* if the packet has the whitelisted ethertype or etherbytes just send it */
++ if ((ether_type[0] == 0 && ether_type[1] == 0) || (size < 16))
++ goto wire_check;
++
++ if ((ether_type[0] != buf[14]) || (ether_type[1] != buf[15]))
++ goto wire_check;
++
++ if (ether_num_bytes == 0) {
++ writepacket(dir,buf,size);
++ return;
++ } else {
++ if (size < 17)
++ goto wire_check;
++
++ for (i = 0; i < ether_num_bytes; i++) {
++ if (ether_bytes[i] != buf[16])
++ continue;
++
++ writepacket(dir,buf,size);
++ return;
++ }
++ }
++
+ /* LOSS */
+ /* Total packet loss */
++wire_check:
+ if (min_wirevalue(markov_current,LOSS,dir) >= 100.0)
+ return;
+ /* probabilistic loss */
+@@ -1391,6 +1420,7 @@
+ "\t--pidfile pidfile\n"
+ "\t--blink blinksocket\n"
+ "\t--blinkid blink_id_string\n"
++ "\t--ether ether_type<:byte><:byte>\n"
+ ,progname);
+ exit (1);
+ }
+@@ -1402,6 +1432,7 @@
+ int option_index;
+ int mgmtindex=-1;
+ int consoleindex=-1;
++ char *ptr;
+ static struct option long_options[] = {
+ {"help",0 , 0, 'h'},
+ {"rcfile", 1, 0, 'f'},
+@@ -1421,17 +1452,20 @@
+ {"daemon",0 , 0, DAEMONIZEARG},
+ {"pidfile", 1, 0, PIDFILEARG},
+ {"blink",1,0,LOGSOCKETARG},
+- {"blinkid",1,0,LOGIDARG}
++ {"blinkid",1,0,LOGIDARG},
++ {"ether", 1, 0, 'e'},
+ };
+ progname=basename(argv[0]);
+ markov_resize(1);
+
+ setsighandlers();
+ atexit(cleanup);
++ ether_num_bytes = 0;
++ memset(ether_bytes, 0, sizeof(ether_bytes));
+
+ while(1) {
+ int c;
+- c = GETOPT_LONG (argc, argv, "hnl:d:M:D:m:b:s:c:v:L:f:",
++ c = GETOPT_LONG (argc, argv, "hnl:d:M:D:m:b:s:c:v:L:f:e:",
+ long_options, &option_index);
+ if (c<0)
+ break;
+@@ -1475,6 +1509,19 @@
+ case 'N':
+ nofifo=1;
+ break;
++ case 'e':
++ sscanf(optarg,"%2hhx%2hhx", ðer_type[0], ðer_type[1]);
++ ptr = optarg;
++ for (n = 0; n < sizeof(ether_bytes); n++) {
++ ptr = strchr(ptr, ':');
++ if (!ptr)
++ break;
++
++ ptr++;
++ sscanf(ptr, "%hhx", ðer_bytes[n]);
++ ether_num_bytes++;
++ }
++ break;
+ case 'v':
+ {
+ char *colon;