Lines 99-104
Link Here
|
99 |
static int valid_type(int type); |
99 |
static int valid_type(int type); |
100 |
|
100 |
|
101 |
static int nflag; /* no reverse dns lookups */ |
101 |
static int nflag; /* no reverse dns lookups */ |
|
|
102 |
static int pflag = 0; /* hide permanemt entries */ |
102 |
static char *rifname; |
103 |
static char *rifname; |
103 |
|
104 |
|
104 |
static int expire_time, flags, doing_proxy, proxy_only; |
105 |
static int expire_time, flags, doing_proxy, proxy_only; |
Lines 119-125
Link Here
|
119 |
int rtn = 0; |
120 |
int rtn = 0; |
120 |
int aflag = 0; /* do it for all entries */ |
121 |
int aflag = 0; /* do it for all entries */ |
121 |
|
122 |
|
122 |
while ((ch = getopt(argc, argv, "andfsSi:")) != -1) |
123 |
while ((ch = getopt(argc, argv, "andfpsSi:")) != -1) |
123 |
switch(ch) { |
124 |
switch(ch) { |
124 |
case 'a': |
125 |
case 'a': |
125 |
aflag = 1; |
126 |
aflag = 1; |
Lines 130-135
Link Here
|
130 |
case 'n': |
131 |
case 'n': |
131 |
nflag = 1; |
132 |
nflag = 1; |
132 |
break; |
133 |
break; |
|
|
134 |
case 'p': |
135 |
pflag = 1; |
136 |
break; |
133 |
case 'S': |
137 |
case 'S': |
134 |
SETFUNC(F_REPLACE); |
138 |
SETFUNC(F_REPLACE); |
135 |
break; |
139 |
break; |
Lines 161-166
Link Here
|
161 |
err(1, "if_nametoindex(%s)", rifname); |
165 |
err(1, "if_nametoindex(%s)", rifname); |
162 |
} |
166 |
} |
163 |
} |
167 |
} |
|
|
168 |
if (pflag) { |
169 |
if (func != F_GET && !(func == F_DELETE && aflag)) |
170 |
errx(1, "-p not applicable to this operation"); |
171 |
} |
164 |
switch (func) { |
172 |
switch (func) { |
165 |
case F_GET: |
173 |
case F_GET: |
166 |
if (aflag) { |
174 |
if (aflag) { |
Lines 540-545
Link Here
|
540 |
if (rifname && if_indextoname(sdl->sdl_index, ifname) && |
548 |
if (rifname && if_indextoname(sdl->sdl_index, ifname) && |
541 |
strcmp(ifname, rifname)) |
549 |
strcmp(ifname, rifname)) |
542 |
continue; |
550 |
continue; |
|
|
551 |
if (pflag) { |
552 |
if (rtm->rtm_rmx.rmx_expire == 0) |
553 |
continue; |
554 |
} |
543 |
if (addr) { |
555 |
if (addr) { |
544 |
if (addr != sin2->sin_addr.s_addr) |
556 |
if (addr != sin2->sin_addr.s_addr) |
545 |
continue; |
557 |
continue; |
Lines 653-662
Link Here
|
653 |
usage(void) |
665 |
usage(void) |
654 |
{ |
666 |
{ |
655 |
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n", |
667 |
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n", |
656 |
"usage: arp [-n] [-i interface] hostname", |
668 |
"usage: arp [-np] [-i interface] hostname", |
657 |
" arp [-n] [-i interface] -a", |
669 |
" arp [-np] [-i interface] -a", |
658 |
" arp -d hostname [pub]", |
670 |
" arp -d hostname [pub]", |
659 |
" arp -d [-i interface] -a", |
671 |
" arp -d [-p] [-i interface] -a", |
660 |
" arp -s hostname ether_addr [temp] [reject | blackhole] [pub [only]]", |
672 |
" arp -s hostname ether_addr [temp] [reject | blackhole] [pub [only]]", |
661 |
" arp -S hostname ether_addr [temp] [reject | blackhole] [pub [only]]", |
673 |
" arp -S hostname ether_addr [temp] [reject | blackhole] [pub [only]]", |
662 |
" arp -f filename"); |
674 |
" arp -f filename"); |