Print a warning when blackhole and reject are used together.

Update arp.8 manual page syntax.

PR:		125896
Submitted by:	Marc Olzheim <marcolz@stack.nl>
Approved by:	sam
This commit is contained in:
Tom Rhodes 2008-12-25 06:44:19 +00:00
parent 46e6dd8ffb
commit 2293dac2ac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186485
2 changed files with 13 additions and 8 deletions

View File

@ -28,7 +28,7 @@
.\" @(#)arp.8 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
.Dd March 18, 2008
.Dd December 25, 2008
.Dt ARP 8
.Os
.Sh NAME
@ -53,14 +53,12 @@
.Nm
.Fl s Ar hostname ether_addr
.Op Cm temp
.Op Cm reject
.Op Cm blackhole
.Op Cm blackhole No \&| Cm reject
.Op Cm pub Op Cm only
.Nm
.Fl S Ar hostname ether_addr
.Op Cm temp
.Op Cm reject
.Op Cm blackhole
.Op Cm blackhole No \&| Cm reject
.Op Cm pub Op Cm only
.Nm
.Fl f Ar filename
@ -182,7 +180,8 @@ in the file should be of the form
.Bd -ragged -offset indent -compact
.Ar hostname ether_addr
.Op Cm temp
.Op Cm pub
.Op Cm blackhole No \&| Cm reject
.Op Cm pub Op Cm only
.Ed
.Pp
with argument meanings as given above.

View File

@ -330,8 +330,14 @@ set(int argc, char **argv)
argc--; argv++;
}
} else if (strncmp(argv[0], "blackhole", 9) == 0) {
if (flags & RTF_REJECT) {
printf("Choose one of blackhole or reject, not both.\n");
}
flags |= RTF_BLACKHOLE;
} else if (strncmp(argv[0], "reject", 6) == 0) {
if (flags & RTF_BLACKHOLE) {
printf("Choose one of blackhole or reject, not both.\n");
}
flags |= RTF_REJECT;
} else if (strncmp(argv[0], "trail", 5) == 0) {
/* XXX deprecated and undocumented feature */
@ -648,8 +654,8 @@ usage(void)
" arp [-n] [-i interface] -a",
" arp -d hostname [pub]",
" arp -d [-i interface] -a",
" arp -s hostname ether_addr [temp] [reject] [blackhole] [pub [only]]",
" arp -S hostname ether_addr [temp] [reject] [blackhole] [pub [only]]",
" arp -s hostname ether_addr [temp] [reject | blackhole] [pub [only]]",
" arp -S hostname ether_addr [temp] [reject | blackhole] [pub [only]]",
" arp -f filename");
exit(1);
}