packages/net/veth/patches/200-drop-multicast.patch
florian d01b379857 Add veth (#4312), thanks Raphael
git-svn-id: svn://svn.openwrt.org/openwrt/packages@13576 3c298f89-4303-0410-b956-a3cf2f4a3e73
2008-12-10 01:20:55 +00:00

33 lines
978 B
Diff

diff -pNur veth-1.0/veth/vethd.c veth-1.0/veth/vethd.c
--- veth-1.0/veth/vethd.c 2008-11-14 10:59:50.000000000 +0100
+++ veth-1.0/veth/vethd.c 2008-11-24 11:24:45.000000000 +0100
@@ -29,6 +29,7 @@
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/if_tun.h>
+#include <net/ethernet.h>
#define max(a,b) ((a)>(b) ? (a):(b))
@@ -223,6 +224,7 @@ int main(int argc, char **argv)
int vfd, nfd, leidos, opc, foreground = 0;
fd_set fds;
+ struct ether_header const* const ether_hdr = (struct ether_header const *)buffer;
set_locale();
show_copyright();
@@ -356,7 +358,11 @@ int main(int argc, char **argv)
perror("Error reading from ethernet interface");
return 2;
}
- write(vfd, buffer, leidos);
+ /* drop multicast and ppp session */
+ if (!(ether_hdr->ether_dhost[0] == 0x01)
+ && (ether_hdr->ether_type != htons(ETH_P_PPP_SES))) {
+ write(vfd, buffer, leidos);
+ }
}
FD_ZERO(&fds);
FD_SET(nfd, &fds);