diff options
-rw-r--r-- | sbin/ifconfig/ifconfig.8 | 8 | ||||
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 4 | ||||
-rw-r--r-- | sys/net/if.h | 1 | ||||
-rw-r--r-- | sys/netinet/if_ether.c | 6 |
4 files changed, 16 insertions, 3 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index 5ae3b22..710fbe0 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -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 diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index b174c94..907a5a7 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -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" diff --git a/sys/net/if.h b/sys/net/if.h index 7c6349d..44531d2 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -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 \ diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index a5b89e7..05b47e8 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -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 @@ match: 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 */ |