summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2018-01-16 10:33:55 +0000
committermpi <mpi@openbsd.org>2018-01-16 10:33:55 +0000
commitbeb8b0dd5985e55a615b52e593da6e75bab33f3f (patch)
treeeeeee63a8af8d8a4770fa2a18f040b32252906aa
parentAdd -I to pipe-pane to connect pane stdin as well as stdout, suggested (diff)
downloadwireguard-openbsd-beb8b0dd5985e55a615b52e593da6e75bab33f3f.tar.xz
wireguard-openbsd-beb8b0dd5985e55a615b52e593da6e75bab33f3f.zip
Recycle IFF_NOTRAILERS into IFF_STATICARP and document ownerhsip
of IFF* flags. inputs from jmc@, ok bluhm@, visa@
-rw-r--r--sbin/ifconfig/brconfig.h4
-rw-r--r--sbin/ifconfig/ifconfig.812
-rw-r--r--sbin/ifconfig/ifconfig.c4
-rw-r--r--sbin/route/route.c4
-rw-r--r--sys/net/if.h55
-rw-r--r--sys/netinet/if_ether.c4
-rw-r--r--usr.sbin/route6d/route6d.c9
7 files changed, 51 insertions, 41 deletions
diff --git a/sbin/ifconfig/brconfig.h b/sbin/ifconfig/brconfig.h
index ee68feb411b..9efee215192 100644
--- a/sbin/ifconfig/brconfig.h
+++ b/sbin/ifconfig/brconfig.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: brconfig.h,v 1.11 2016/09/02 10:01:36 goda Exp $ */
+/* $OpenBSD: brconfig.h,v 1.12 2018/01/16 10:33:55 mpi Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -70,7 +70,7 @@ void switch_datapathid(const char *, int);
void switch_portno(const char *, const char *);
#define IFFBITS \
- "\024\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6NOTRAILERS" \
+ "\024\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6STATICARP" \
"\7RUNNING\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX" \
"\15LINK0\16LINK1\17LINK2\20MULTICAST" \
"\23INET6_NOPRIVACY\24MPLS\25WOL\26AUTOCONF6"
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 431dca65bfd..ef9592cf3e3 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.291 2017/11/30 07:41:01 jmc Exp $
+.\" $OpenBSD: ifconfig.8,v 1.292 2018/01/16 10:33:55 mpi Exp $
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\"
@@ -31,7 +31,7 @@
.\"
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd $Mdocdate: November 30 2017 $
+.Dd $Mdocdate: January 16 2018 $
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -147,8 +147,6 @@ Use of this option is discouraged in favour of
Enable the use of the Address Resolution Protocol (ARP)
in mapping
between network level addresses and link level addresses (default).
-This is currently implemented for mapping between
-DARPA Internet addresses and Ethernet addresses.
.It Cm -arp
Disable the use of ARP.
.It Cm broadcast Ar addr
@@ -454,6 +452,12 @@ and
.Xr pf.conf 5 .
.It Cm -rtlabel
Clear the route label.
+.It Cm staticarp
+If ARP is enabled, the host will only reply to requests for its addresses,
+and will never send any requests.
+.It Cm -staticarp
+If ARP is enabled, the host will perform normally,
+sending out requests and listening for replies.
.It Cm up
Mark an interface
.Dq up .
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 29dc5bb25f6..4a0f4d632d2 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.352 2018/01/09 10:02:02 mpi Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.353 2018/01/16 10:33:55 mpi Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -397,6 +397,8 @@ const struct cmd {
{ "rtlabel", NEXTARG, 0, setifrtlabel },
{ "-rtlabel", -1, 0, setifrtlabel },
{ "rdomain", NEXTARG, 0, setrdomain },
+ { "staticarp", IFF_STATICARP, 0, setifflags },
+ { "-staticarp", -IFF_STATICARP, 0, setifflags },
{ "mpls", IFXF_MPLS, 0, setifxflags },
{ "-mpls", -IFXF_MPLS, 0, setifxflags },
{ "mplslabel", NEXTARG, 0, setmpelabel },
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 05ffba43cab..9c85f70de78 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.206 2017/10/18 07:31:31 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.207 2018/01/16 10:33:55 mpi Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -1268,7 +1268,7 @@ char routeflags[] =
"\020PROTO1\021CLONED\022CACHED\023MPATH\025MPLS\026LOCAL\027BROADCAST"
"\030CONNECTED\031BFD";
char ifnetflags[] =
-"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6NOTRAILERS\7RUNNING\010NOARP\011PPROMISC"
+"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6STATICARP\7RUNNING\010NOARP\011PPROMISC"
"\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1\017LINK2\020MULTICAST";
char addrnames[] =
"\1DST\2GATEWAY\3NETMASK\4GENMASK\5IFP\6IFA\7AUTHOR\010BRD\011SRC\012SRCMASK\013LABEL\014BFD\015DNS\016STATIC\017SEARCH";
diff --git a/sys/net/if.h b/sys/net/if.h
index 4d7dec37fad..fbee692ba32 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.189 2017/12/21 01:11:47 dlg Exp $ */
+/* $OpenBSD: if.h,v 1.190 2018/01/16 10:33:55 mpi Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -184,34 +184,43 @@ struct if_status_description {
*/
#define IFDESCRSIZE 64
-#define IFF_UP 0x1 /* interface is up */
-#define IFF_BROADCAST 0x2 /* broadcast address valid */
-#define IFF_DEBUG 0x4 /* turn on debugging */
-#define IFF_LOOPBACK 0x8 /* is a loopback net */
-#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
-#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
-#define IFF_RUNNING 0x40 /* resources allocated */
-#define IFF_NOARP 0x80 /* no address resolution protocol */
-#define IFF_PROMISC 0x100 /* receive all packets */
-#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
-#define IFF_OACTIVE 0x400 /* transmission in progress */
-#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
-#define IFF_LINK0 0x1000 /* per link layer defined bit */
-#define IFF_LINK1 0x2000 /* per link layer defined bit */
-#define IFF_LINK2 0x4000 /* per link layer defined bit */
-#define IFF_MULTICAST 0x8000 /* supports multicast */
+/*
+ * Interface flags can be either owned by the stack or the driver. The
+ * symbols below document who is toggling which flag.
+ *
+ * I immutable after creation
+ * N written by the stack (upon user request)
+ * d written by the driver
+ * c for userland compatibility only
+ */
+#define IFF_UP 0x1 /* [N] interface is up */
+#define IFF_BROADCAST 0x2 /* [I] broadcast address valid */
+#define IFF_DEBUG 0x4 /* [N] turn on debugging */
+#define IFF_LOOPBACK 0x8 /* [I] is a loopback net */
+#define IFF_POINTOPOINT 0x10 /* [I] is point-to-point link */
+#define IFF_STATICARP 0x20 /* [N] only static ARP */
+#define IFF_RUNNING 0x40 /* [d] resources allocated */
+#define IFF_NOARP 0x80 /* [N] no address resolution protocol */
+#define IFF_PROMISC 0x100 /* [N] receive all packets */
+#define IFF_ALLMULTI 0x200 /* [d] receive all multicast packets */
+#define IFF_OACTIVE 0x400 /* [c] transmission in progress */
+#define IFF_SIMPLEX 0x800 /* [I] can't hear own transmissions */
+#define IFF_LINK0 0x1000 /* [N] per link layer defined bit */
+#define IFF_LINK1 0x2000 /* [N] per link layer defined bit */
+#define IFF_LINK2 0x4000 /* [N] per link layer defined bit */
+#define IFF_MULTICAST 0x8000 /* [I] supports multicast */
/* flags set internally only: */
#define IFF_CANTCHANGE \
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
-#define IFXF_MPSAFE 0x1 /* if_start is mpsafe */
-#define IFXF_CLONED 0x2 /* pseudo interface */
-#define IFXF_INET6_NOPRIVACY 0x4 /* don't autoconf privacy */
-#define IFXF_MPLS 0x8 /* supports MPLS */
-#define IFXF_WOL 0x10 /* wake on lan enabled */
-#define IFXF_AUTOCONF6 0x20 /* v6 autoconf enabled */
+#define IFXF_MPSAFE 0x1 /* [I] if_start is mpsafe */
+#define IFXF_CLONED 0x2 /* [I] pseudo interface */
+#define IFXF_INET6_NOPRIVACY 0x4 /* [N] don't autoconf privacy */
+#define IFXF_MPLS 0x8 /* [N] supports MPLS */
+#define IFXF_WOL 0x10 /* [N] wake on lan enabled */
+#define IFXF_AUTOCONF6 0x20 /* [N] v6 autoconf enabled */
#define IFXF_CANTCHANGE \
(IFXF_MPSAFE|IFXF_CLONED)
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index ef28b67808e..d4c733daeef 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.232 2018/01/15 13:48:31 bluhm Exp $ */
+/* $OpenBSD: if_ether.c,v 1.233 2018/01/16 10:33:55 mpi Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -356,7 +356,7 @@ arpresolve(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m,
return (0);
}
- if (ifp->if_flags & IFF_NOARP)
+ if (ifp->if_flags & (IFF_NOARP|IFF_STATICARP))
goto bad;
/*
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index aa0fb0cf85b..ac7addd9721 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route6d.c,v 1.92 2017/08/23 11:25:07 jca Exp $ */
+/* $OpenBSD: route6d.c,v 1.93 2018/01/16 10:33:55 mpi Exp $ */
/* $KAME: route6d.c,v 1.111 2006/10/25 06:38:13 jinmei Exp $ */
/*
@@ -2334,12 +2334,7 @@ do { \
IFFLAG("DEBUG", IFF_DEBUG);
IFFLAG("LOOPBACK", IFF_LOOPBACK);
IFFLAG("POINTOPOINT", IFF_POINTOPOINT);
-#ifdef IFF_NOTRAILERS
- IFFLAG("NOTRAILERS", IFF_NOTRAILERS);
-#endif
-#ifdef IFF_SMART
- IFFLAG("SMART", IFF_SMART);
-#endif
+ IFFLAG("STATICARP", IFF_STATICARP);
IFFLAG("RUNNING", IFF_RUNNING);
IFFLAG("NOARP", IFF_NOARP);
IFFLAG("PROMISC", IFF_PROMISC);