branch Attitude Adjustment packages
[12.09/packages.git] / net / veth / patches / 200-drop-multicast.patch
1 diff -pNur veth-1.0/veth/vethd.c veth-1.0/veth/vethd.c
2 --- veth-1.0/veth/vethd.c       2008-11-14 10:59:50.000000000 +0100
3 +++ veth-1.0/veth/vethd.c       2008-11-24 11:24:45.000000000 +0100
4 @@ -29,6 +29,7 @@
5  #include <linux/if_ether.h>
6  #include <linux/if_packet.h>
7  #include <linux/if_tun.h>
8 +#include <net/ethernet.h>
9  
10  #define max(a,b) ((a)>(b) ? (a):(b))
11  
12 @@ -223,6 +224,7 @@ int main(int argc, char **argv)
13  
14         int vfd, nfd, leidos, opc, foreground = 0;
15         fd_set fds;
16 +       struct ether_header const* const ether_hdr = (struct ether_header const *)buffer;
17  
18         set_locale();
19         show_copyright();
20 @@ -356,7 +358,11 @@ int main(int argc, char **argv)
21                                 perror("Error reading from ethernet interface");
22                                 return 2;
23                         }
24 -                       write(vfd, buffer, leidos);
25 +                       /* drop multicast and ppp session */
26 +                       if (!(ether_hdr->ether_dhost[0] == 0x01)
27 +                          && (ether_hdr->ether_type != htons(ETH_P_PPP_SES))) {
28 +                               write(vfd, buffer, leidos);
29 +                       }
30                 }
31                 FD_ZERO(&fds);
32                 FD_SET(nfd, &fds);