By popular demand, added the "static ARP" per-interface option.

This commit is contained in:
Ruslan Ermilov 2003-10-01 08:32:37 +00:00
parent c727011a76
commit deb62e2887
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120626
4 changed files with 16 additions and 3 deletions

View File

@ -227,6 +227,14 @@ addresses and
.It Fl arp
Disable the use of the Address Resolution Protocol
.Pq Xr arp 4 .
.It Cm staticarp
If the Address Resolution Protocol is enabled,
the host will only reply to requests for its addresses,
and will never send any requests.
.It Fl staticarp
If the Address Resolution Protocol is enabled,
the host will perform normally,
sending out requests and listening for replies.
.It Cm broadcast
(Inet only.)
Specify the address to use to represent broadcasts to the

View File

@ -234,6 +234,8 @@ struct cmd {
{ "-link2", -IFF_LINK2, setifflags },
{ "monitor", IFF_MONITOR, setifflags },
{ "-monitor", -IFF_MONITOR, setifflags },
{ "staticarp", IFF_STATICARP, setifflags },
{ "-staticarp", -IFF_STATICARP, setifflags },
#ifdef USE_IF_MEDIA
{ "media", NEXTARG, setmedia },
{ "mode", NEXTARG, setmediamode },
@ -1037,7 +1039,7 @@ setifmtu(const char *val, int dummy __unused, int s,
#define IFFBITS \
"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \
"\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \
"\20MULTICAST\023MONITOR"
"\20MULTICAST\023MONITOR\024STATICARP"
#define IFCAPBITS \
"\003\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU"

View File

@ -150,6 +150,7 @@ struct if_data {
#define IFF_POLLING 0x10000 /* Interface is in polling mode. */
#define IFF_PPROMISC 0x20000 /* user-requested promisc mode */
#define IFF_MONITOR 0x40000 /* user-requested monitor mode */
#define IFF_STATICARP 0x80000 /* static ARP */
/* flags set internally only: */
#define IFF_CANTCHANGE \

View File

@ -454,12 +454,12 @@ arpresolve(ifp, rt, m, dst, desten, rt0)
return 1;
}
/*
* If ARP is disabled on this interface, stop.
* If ARP is disabled or static on this interface, stop.
* XXX
* Probably should not allocate empty llinfo struct if we are
* not going to be sending out an arp request.
*/
if (ifp->if_flags & IFF_NOARP) {
if (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) {
m_freem(m);
return (0);
}
@ -650,6 +650,8 @@ in_arpinput(m)
itaddr = myaddr;
goto reply;
}
if (ifp->if_flags & IFF_STATICARP)
goto reply;
la = arplookup(isaddr.s_addr, itaddr.s_addr == myaddr.s_addr, 0);
if (la && (rt = la->la_rt) && (sdl = SDL(rt->rt_gateway))) {
/* the following is not an error when doing bridging */