FreeBSD Bugzilla – Attachment 104928 Details for
Bug 145198
[patch] add verbose option to net-mgmt/choparp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.19 KB, created by
Gleb Kurtsou
on 2010-03-30 10:40:08 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Gleb Kurtsou
Created:
2010-03-30 10:40:08 UTC
Size:
2.19 KB
patch
obsolete
>--- choparp.c.orig 2010-03-17 21:22:44.000000000 +0200 >+++ choparp.c 2010-03-17 21:20:52.421965709 +0200 >@@ -76,6 +76,7 @@ > > struct cidr *targets = NULL, *excludes = NULL; > u_char target_mac[ETHER_ADDR_LEN]; /* target MAC address */ >+int verbose = 0; > > /* > ARP filter program >@@ -241,7 +242,13 @@ > 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"); >+ if (verbose != 0) >+ fprintf(stderr,"checkarp: WARNING: sender equal dest.\n"); >+ return(0); >+ } >+ if (0 == ntohl(*(u_int32_t *)(arp->arp_spa))) { >+ if (verbose != 0) >+ fprintf(stderr,"checkarp: WARNING: zero sender address.\n"); > return(0); > } > target_ip = ntohl(*(u_int32_t *)(arp->arp_tpa)); >@@ -376,13 +383,13 @@ > > void > usage(void){ >- fprintf(stderr,"usage: choparp if_name mac_addr [-]addr/mask...\n"); >+ fprintf(stderr,"usage: choparp [-v] if_name mac_addr [-]addr/mask...\n"); > exit(-1); > } > > int > main(int argc, char **argv){ >- int fd; >+ int ch, fd; > char *buf, *ifname; > struct cidr **targets_tail = &targets, **excludes_tail = &excludes; > #define APPEND(LIST,ADDR,MASK) \ >@@ -395,13 +402,24 @@ > } while (0) > size_t buflen; > >- if (argc < 4) >+ while ((ch = getopt(argc, argv, "v")) != -1) >+ switch (ch) { >+ case 'v': >+ verbose++; >+ break; >+ default: >+ usage(); >+ } >+ argc -= optind; >+ argv += optind; >+ >+ if (argc < 3) > usage(); > >- ifname = argv[1]; >- if (setmac(argv[2], ifname)) >+ ifname = argv[0]; >+ if (setmac(argv[1], ifname)) > usage(); >- argv += 3; argc -= 3; >+ argv += 2; argc -= 2; > > while (argc > 0) { > u_int32_t addr, mask = ~0; >--- choparp.8.orig 2010-03-17 21:22:44.000000000 +0200 >+++ choparp.8 2010-03-17 21:20:05.461772794 +0200 >@@ -35,6 +35,7 @@ > .Nd cheap and omitted proxy ARP > .Sh SYNOPSIS > .Nm choparp >+.Op Fl v > .Ar if_name mac_addr > .Oo Fl Oc Ns Ar net_addr Ns > .Op / Ns Ar net_mask >@@ -90,6 +91,9 @@ > by preceding them with > .Fl > .Pp >+.Fl v >+option enables verbose mode, showing warning for invalid ARP packets. >+.Pp > .Nm choparp > uses the Berkeley Packet Filter > .Nm bpf(4)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 145198
: 104928