Skip to content

Commit beb8b0d

Browse files
committed
Recycle IFF_NOTRAILERS into IFF_STATICARP and document ownerhsip
of IFF* flags. inputs from jmc@, ok bluhm@, visa@
1 parent c10e397 commit beb8b0d

File tree

7 files changed

+51
-41
lines changed

7 files changed

+51
-41
lines changed

sbin/ifconfig/brconfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: brconfig.h,v 1.11 2016/09/02 10:01:36 goda Exp $ */
1+
/* $OpenBSD: brconfig.h,v 1.12 2018/01/16 10:33:55 mpi Exp $ */
22

33
/*
44
* Copyright (c) 2009 Claudio Jeker <[email protected]>
@@ -70,7 +70,7 @@ void switch_datapathid(const char *, int);
7070
void switch_portno(const char *, const char *);
7171

7272
#define IFFBITS \
73-
"\024\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS" \
73+
"\024\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6STATICARP" \
7474
"\7RUNNING\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX" \
7575
"\15LINK0\16LINK1\17LINK2\20MULTICAST" \
7676
"\23INET6_NOPRIVACY\24MPLS\25WOL\26AUTOCONF6"

sbin/ifconfig/ifconfig.8

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $OpenBSD: ifconfig.8,v 1.291 2017/11/30 07:41:01 jmc Exp $
1+
.\" $OpenBSD: ifconfig.8,v 1.292 2018/01/16 10:33:55 mpi Exp $
22
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
33
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
44
.\"
@@ -31,7 +31,7 @@
3131
.\"
3232
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
3333
.\"
34-
.Dd $Mdocdate: November 30 2017 $
34+
.Dd $Mdocdate: January 16 2018 $
3535
.Dt IFCONFIG 8
3636
.Os
3737
.Sh NAME
@@ -147,8 +147,6 @@ Use of this option is discouraged in favour of
147147
Enable the use of the Address Resolution Protocol (ARP)
148148
in mapping
149149
between network level addresses and link level addresses (default).
150-
This is currently implemented for mapping between
151-
DARPA Internet addresses and Ethernet addresses.
152150
.It Cm -arp
153151
Disable the use of ARP.
154152
.It Cm broadcast Ar addr
@@ -454,6 +452,12 @@ and
454452
.Xr pf.conf 5 .
455453
.It Cm -rtlabel
456454
Clear the route label.
455+
.It Cm staticarp
456+
If ARP is enabled, the host will only reply to requests for its addresses,
457+
and will never send any requests.
458+
.It Cm -staticarp
459+
If ARP is enabled, the host will perform normally,
460+
sending out requests and listening for replies.
457461
.It Cm up
458462
Mark an interface
459463
.Dq up .

sbin/ifconfig/ifconfig.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ifconfig.c,v 1.352 2018/01/09 10:02:02 mpi Exp $ */
1+
/* $OpenBSD: ifconfig.c,v 1.353 2018/01/16 10:33:55 mpi Exp $ */
22
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
33

44
/*
@@ -397,6 +397,8 @@ const struct cmd {
397397
{ "rtlabel", NEXTARG, 0, setifrtlabel },
398398
{ "-rtlabel", -1, 0, setifrtlabel },
399399
{ "rdomain", NEXTARG, 0, setrdomain },
400+
{ "staticarp", IFF_STATICARP, 0, setifflags },
401+
{ "-staticarp", -IFF_STATICARP, 0, setifflags },
400402
{ "mpls", IFXF_MPLS, 0, setifxflags },
401403
{ "-mpls", -IFXF_MPLS, 0, setifxflags },
402404
{ "mplslabel", NEXTARG, 0, setmpelabel },

sbin/route/route.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: route.c,v 1.206 2017/10/18 07:31:31 mpi Exp $ */
1+
/* $OpenBSD: route.c,v 1.207 2018/01/16 10:33:55 mpi Exp $ */
22
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
33

44
/*
@@ -1268,7 +1268,7 @@ char routeflags[] =
12681268
"\020PROTO1\021CLONED\022CACHED\023MPATH\025MPLS\026LOCAL\027BROADCAST"
12691269
"\030CONNECTED\031BFD";
12701270
char ifnetflags[] =
1271-
"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6NOTRAILERS\7RUNNING\010NOARP\011PPROMISC"
1271+
"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6STATICARP\7RUNNING\010NOARP\011PPROMISC"
12721272
"\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1\017LINK2\020MULTICAST";
12731273
char addrnames[] =
12741274
"\1DST\2GATEWAY\3NETMASK\4GENMASK\5IFP\6IFA\7AUTHOR\010BRD\011SRC\012SRCMASK\013LABEL\014BFD\015DNS\016STATIC\017SEARCH";

sys/net/if.h

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: if.h,v 1.189 2017/12/21 01:11:47 dlg Exp $ */
1+
/* $OpenBSD: if.h,v 1.190 2018/01/16 10:33:55 mpi Exp $ */
22
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
33

44
/*
@@ -184,34 +184,43 @@ struct if_status_description {
184184
*/
185185
#define IFDESCRSIZE 64
186186

187-
#define IFF_UP 0x1 /* interface is up */
188-
#define IFF_BROADCAST 0x2 /* broadcast address valid */
189-
#define IFF_DEBUG 0x4 /* turn on debugging */
190-
#define IFF_LOOPBACK 0x8 /* is a loopback net */
191-
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
192-
#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
193-
#define IFF_RUNNING 0x40 /* resources allocated */
194-
#define IFF_NOARP 0x80 /* no address resolution protocol */
195-
#define IFF_PROMISC 0x100 /* receive all packets */
196-
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
197-
#define IFF_OACTIVE 0x400 /* transmission in progress */
198-
#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
199-
#define IFF_LINK0 0x1000 /* per link layer defined bit */
200-
#define IFF_LINK1 0x2000 /* per link layer defined bit */
201-
#define IFF_LINK2 0x4000 /* per link layer defined bit */
202-
#define IFF_MULTICAST 0x8000 /* supports multicast */
187+
/*
188+
* Interface flags can be either owned by the stack or the driver. The
189+
* symbols below document who is toggling which flag.
190+
*
191+
* I immutable after creation
192+
* N written by the stack (upon user request)
193+
* d written by the driver
194+
* c for userland compatibility only
195+
*/
196+
#define IFF_UP 0x1 /* [N] interface is up */
197+
#define IFF_BROADCAST 0x2 /* [I] broadcast address valid */
198+
#define IFF_DEBUG 0x4 /* [N] turn on debugging */
199+
#define IFF_LOOPBACK 0x8 /* [I] is a loopback net */
200+
#define IFF_POINTOPOINT 0x10 /* [I] is point-to-point link */
201+
#define IFF_STATICARP 0x20 /* [N] only static ARP */
202+
#define IFF_RUNNING 0x40 /* [d] resources allocated */
203+
#define IFF_NOARP 0x80 /* [N] no address resolution protocol */
204+
#define IFF_PROMISC 0x100 /* [N] receive all packets */
205+
#define IFF_ALLMULTI 0x200 /* [d] receive all multicast packets */
206+
#define IFF_OACTIVE 0x400 /* [c] transmission in progress */
207+
#define IFF_SIMPLEX 0x800 /* [I] can't hear own transmissions */
208+
#define IFF_LINK0 0x1000 /* [N] per link layer defined bit */
209+
#define IFF_LINK1 0x2000 /* [N] per link layer defined bit */
210+
#define IFF_LINK2 0x4000 /* [N] per link layer defined bit */
211+
#define IFF_MULTICAST 0x8000 /* [I] supports multicast */
203212

204213
/* flags set internally only: */
205214
#define IFF_CANTCHANGE \
206215
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
207216
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
208217

209-
#define IFXF_MPSAFE 0x1 /* if_start is mpsafe */
210-
#define IFXF_CLONED 0x2 /* pseudo interface */
211-
#define IFXF_INET6_NOPRIVACY 0x4 /* don't autoconf privacy */
212-
#define IFXF_MPLS 0x8 /* supports MPLS */
213-
#define IFXF_WOL 0x10 /* wake on lan enabled */
214-
#define IFXF_AUTOCONF6 0x20 /* v6 autoconf enabled */
218+
#define IFXF_MPSAFE 0x1 /* [I] if_start is mpsafe */
219+
#define IFXF_CLONED 0x2 /* [I] pseudo interface */
220+
#define IFXF_INET6_NOPRIVACY 0x4 /* [N] don't autoconf privacy */
221+
#define IFXF_MPLS 0x8 /* [N] supports MPLS */
222+
#define IFXF_WOL 0x10 /* [N] wake on lan enabled */
223+
#define IFXF_AUTOCONF6 0x20 /* [N] v6 autoconf enabled */
215224

216225
#define IFXF_CANTCHANGE \
217226
(IFXF_MPSAFE|IFXF_CLONED)

sys/netinet/if_ether.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: if_ether.c,v 1.232 2018/01/15 13:48:31 bluhm Exp $ */
1+
/* $OpenBSD: if_ether.c,v 1.233 2018/01/16 10:33:55 mpi Exp $ */
22
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
33

44
/*
@@ -356,7 +356,7 @@ arpresolve(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m,
356356
return (0);
357357
}
358358

359-
if (ifp->if_flags & IFF_NOARP)
359+
if (ifp->if_flags & (IFF_NOARP|IFF_STATICARP))
360360
goto bad;
361361

362362
/*

usr.sbin/route6d/route6d.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: route6d.c,v 1.92 2017/08/23 11:25:07 jca Exp $ */
1+
/* $OpenBSD: route6d.c,v 1.93 2018/01/16 10:33:55 mpi Exp $ */
22
/* $KAME: route6d.c,v 1.111 2006/10/25 06:38:13 jinmei Exp $ */
33

44
/*
@@ -2334,12 +2334,7 @@ do { \
23342334
IFFLAG("DEBUG", IFF_DEBUG);
23352335
IFFLAG("LOOPBACK", IFF_LOOPBACK);
23362336
IFFLAG("POINTOPOINT", IFF_POINTOPOINT);
2337-
#ifdef IFF_NOTRAILERS
2338-
IFFLAG("NOTRAILERS", IFF_NOTRAILERS);
2339-
#endif
2340-
#ifdef IFF_SMART
2341-
IFFLAG("SMART", IFF_SMART);
2342-
#endif
2337+
IFFLAG("STATICARP", IFF_STATICARP);
23432338
IFFLAG("RUNNING", IFF_RUNNING);
23442339
IFFLAG("NOARP", IFF_NOARP);
23452340
IFFLAG("PROMISC", IFF_PROMISC);

0 commit comments

Comments
 (0)