|
|
ru.unix.bsd- RU.UNIX.BSD ------------------------------------------------------------------ From : Eugene Grosbein 2:5006/1 27 Nov 2003 15:10:29 To : All Subject : IFF_STATICARP --------------------------------------------------------------------------------
Тем, кто использует статические таблицы ARP в работе и знает,
почему IFF_NOARP (ifconfig -arp) не хватает и зачем нужен
патч для net.link.ether.inet.strict_noarp=1.
В CURRENT уже пару месяцев есть IFF_STATICARP, которые реализует
то же самое, но более гибко, позволяя сказать ifconfig staticarp
вместо ifconfig -arp. Сейчас готовится MFC для 4.9. Просьба потестировать
этот патч, оно будет в 4-STABLE. Если строчки завернутся, плиз разверните
сами.
Index: src/sbin/ifconfig/ifconfig.8
===================================================================
RCS file: /home/ncvs/src/sbin/ifconfig/ifconfig.8,v
retrieving revision 1.27.2.22
diff -u -r1.27.2.22 ifconfig.8
- --- src/sbin/ifconfig/ifconfig.8 26 Jan 2003 03:33:56 -0000 1.27.2.22
+++ src/sbin/ifconfig/ifconfig.8 26 Nov 2003 22:23:42 -0000
@@ -227,6 +227,14 @@
.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
Index: src/sbin/ifconfig/ifconfig.c
===================================================================
RCS file: /home/ncvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.51.2.19
diff -u -r1.51.2.19 ifconfig.c
- --- src/sbin/ifconfig/ifconfig.c 28 Jan 2003 11:02:56 -0000 1.51.2.19
+++ src/sbin/ifconfig/ifconfig.c 26 Nov 2003 22:23:42 -0000
@@ -241,6 +241,8 @@
{ "-link1", -IFF_LINK1, setifflags },
{ "link2", IFF_LINK2, setifflags },
{ "-link2", -IFF_LINK2, setifflags },
+ { "staticarp", IFF_STATICARP, setifflags },
+ { "-staticarp", -IFF_STATICARP, setifflags },
#ifdef USE_IF_MEDIA
{ "media", NEXTARG, setmedia },
{ "mediaopt", NEXTARG, setmediaopt },
@@ -1135,7 +1137,7 @@
#define IFFBITS \
"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \
"\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \
-"\20MULTICAST"
+"\20MULTICAST\024STATICARP"
#define IFCAPBITS \
"\003\1rxcsum\2txcsum\3netcons"
Index: src/sys/net/if.h
===================================================================
RCS file: /home/ncvs/src/sys/net/if.h,v
retrieving revision 1.58.2.9
diff -u -r1.58.2.9 if.h
- --- src/sys/net/if.h 30 Aug 2002 14:23:38 -0000 1.58.2.9
+++ src/sys/net/if.h 26 Nov 2003 22:23:42 -0000
@@ -134,6 +134,7 @@
#define IFF_LINK2 0x4000 /* per link layer defined bit */
#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */
#define IFF_MULTICAST 0x8000 /* supports multicast */
+#define IFF_STATICARP 0x80000 /* static ARP */
/*
* The following flag(s) ought to go in if_flags, but we cannot change
Index: src/sys/netinet/if_ether.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.64.2.26
diff -u -r1.64.2.26 if_ether.c
- --- src/sys/netinet/if_ether.c 24 Sep 2003 21:48:00 -0000 1.64.2.26
+++ src/sys/netinet/if_ether.c 26 Nov 2003 22:23:42 -0000
@@ -450,12 +450,12 @@
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);
}
@@ -655,6 +655,8 @@
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 */
Eugene
--
"Люди забыли эту истину," - сказал Лис, - "но ты не забывай"
--- slrn/0.9.7.4 (FreeBSD)
* Origin: Svyaz Service JSC (2:5006/1@fidonet)
Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.unix.bsd/26093a6667558.html, оценка из 5, голосов 10
|