diff options
author | nork <nork@FreeBSD.org> | 2006-04-20 23:01:18 +0800 |
---|---|---|
committer | nork <nork@FreeBSD.org> | 2006-04-20 23:01:18 +0800 |
commit | 47947688ca0ca2648583670c82d65b2640617ecd (patch) | |
tree | ad8ca469b49bc7dc16f8a4e412ce67b2adf39abd /net-mgmt/choparp/files | |
parent | 7edba94c353560ebecdcb841b79feffa330b2719 (diff) | |
download | freebsd-ports-graphics-47947688ca0ca2648583670c82d65b2640617ecd.tar.gz freebsd-ports-graphics-47947688ca0ca2648583670c82d65b2640617ecd.tar.zst freebsd-ports-graphics-47947688ca0ca2648583670c82d65b2640617ecd.zip |
Don't send arp reply to sender if the arp request queries
the MAC address for the itself.
Submitted by: Vlad V Cheryomushkin <vladd@rekom.ru>
Diffstat (limited to 'net-mgmt/choparp/files')
-rw-r--r-- | net-mgmt/choparp/files/patch-choparp.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/net-mgmt/choparp/files/patch-choparp.c b/net-mgmt/choparp/files/patch-choparp.c index 76c197045fb..eb0351cdbc7 100644 --- a/net-mgmt/choparp/files/patch-choparp.c +++ b/net-mgmt/choparp/files/patch-choparp.c @@ -1,5 +1,5 @@ --- choparp.c.orig Fri Nov 8 07:36:03 2002 -+++ choparp.c Sat Apr 8 14:37:41 2006 ++++ choparp.c Thu Apr 20 23:56:38 2006 @@ -42,6 +42,7 @@ #include <string.h> #include <sys/types.h> @@ -8,7 +8,18 @@ #include <sys/time.h> #include <sys/ioctl.h> #include <net/bpf.h> -@@ -280,13 +281,22 @@ +@@ -239,6 +240,10 @@ + fprintf(stderr,"checkarp: WARNING: received unknown type ARP request.\n"); + return(0); + } ++ if (ntohl(*(u_int32_t *)(arp->arp_tpa)) == ntohl(*(u_int32_t *)(arp->arp_spa))) { ++ fprintf(stderr,"checkarp: WARNING: sender equal dest.\n"); ++ return(0); ++ } + target_ip = ntohl(*(u_int32_t *)(arp->arp_tpa)); + return match(target_ip, targets) && !match(target_ip, excludes); + } +@@ -280,13 +285,22 @@ char *rframe; char *sframe; size_t frame_len; @@ -35,7 +46,7 @@ if (r < 0) { if (errno == EINTR) -@@ -295,7 +305,7 @@ +@@ -295,7 +309,7 @@ return; } @@ -44,7 +55,7 @@ if (rlen < 0) { if (errno == EINTR) continue; -@@ -307,7 +317,7 @@ +@@ -307,7 +321,7 @@ while((rframe = getarp(p, rlen, &nextp, &nextlen)) != NULL){ if (checkarp(rframe)){ sframe = gen_arpreply(rframe, &frame_len); @@ -53,7 +64,7 @@ } p = nextp; rlen = nextlen; -@@ -437,6 +447,9 @@ +@@ -437,6 +451,9 @@ #endif if ((fd = openbpf(ifname, &buf, &buflen)) < 0) return(-1); |