summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2001-05-02 06:44:23 +0000
committeritojun <itojun@openbsd.org>2001-05-02 06:44:23 +0000
commitc6960dafa25feefa504a5e1bcf67350664acdf36 (patch)
tree7a1be59b2a76009ad07260ff682887b9dfcfe7e5
parentMove powerpc interrupt enablement into the interrupt controller, not after (diff)
downloadwireguard-openbsd-c6960dafa25feefa504a5e1bcf67350664acdf36.tar.xz
wireguard-openbsd-c6960dafa25feefa504a5e1bcf67350664acdf36.zip
implement "deletetunnel" (removes tunnel outer IP address pair)
rename "giftunnel" intto "tunnel", to reduce diffs with netbsd. (giftunnel is still usable for backward compat) markus and niels ok'ed.
-rw-r--r--sbin/ifconfig/ifconfig.820
-rw-r--r--sbin/ifconfig/ifconfig.c25
2 files changed, 32 insertions, 13 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 5606ff75240..7c447080295 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.50 2001/01/18 04:46:03 itojun Exp $
+.\" $OpenBSD: ifconfig.8,v 1.51 2001/05/02 06:44:23 itojun 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 $
.\"
@@ -50,10 +50,13 @@
.Oc
.Op Ar parameters
.Nm ifconfig
-.Ar gif-interface
-.Cm giftunnel
+.Ar tunnel-interface
+.Cm tunnel
.Ar src_address dest_address
.Nm ifconfig
+.Ar tunnel-interface
+.Cm deletetunnel
+.Nm ifconfig
.Ar vlan-interface
.Cm vlan
.Ar vlan-tag
@@ -206,13 +209,16 @@ the system will not attempt to
transmit messages through that interface.
If possible, the interface will be reset to disable reception as well.
This action automatically disables routes using the interface.
-.It Cm giftunnel
-Set the source and destination tunnel addresses on a
-.Xr gif 4
-interface.
+.It Cm tunnel Ar src_address dest_address
+Set the source and destination tunnel addresses on a tunnel interface,
+including
+.Xr gif 4 .
Packets routed to this interface will be encapsulated in
IPv4 or IPv6, depending on the source and destination address families.
Both addresses must be of the same family.
+.It Cm deletetunnel
+Removes the source and dsetination tunnel addresses,
+configured onto a tunnel interface.
.It Cm ipdst
This is used to specify an Internet host who is willing to receive
ip packets encapsulating NS packets bound for a remote network.
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 873870bb8be..192a209ad74 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.46 2001/03/01 08:34:37 itojun Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.47 2001/05/02 06:44:23 itojun Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -81,7 +81,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#else
-static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.46 2001/03/01 08:34:37 itojun Exp $";
+static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.47 2001/05/02 06:44:23 itojun Exp $";
#endif
#endif /* not lint */
@@ -176,7 +176,8 @@ void setsnpaoffset __P((char *));
void setipxframetype __P((char *, int));
void setatrange __P((char *, int));
void setatphase __P((char *, int));
-void gifsettunnel __P((char *, char *));
+void settunnel __P((char *, char *));
+void deletetunnel __P((void));
#ifdef INET6
void setia6flags __P((char *, int));
void setia6pltime __P((char *, int));
@@ -268,7 +269,10 @@ const struct cmd {
{ "vlandev", NEXTARG, 0, setvlandev },
{ "-vlandev", 1, 0, unsetvlandev },
#endif /* INET_ONLY */
- { "giftunnel", NEXTARG2, 0, gifsettunnel } ,
+ /* giftunnel is for backward compat */
+ { "giftunnel", NEXTARG2, 0, settunnel } ,
+ { "tunnel", NEXTARG2, 0, settunnel } ,
+ { "tunneldelete", 0, 0, deletetunnel } ,
{ "link0", IFF_LINK0, 0, setifflags } ,
{ "-link0", -IFF_LINK0, 0, setifflags } ,
{ "link1", IFF_LINK1, 0, setifflags } ,
@@ -757,7 +761,7 @@ setifaddr(addr, param)
}
void
-gifsettunnel(src, dst)
+settunnel(src, dst)
char *src;
char *dst;
{
@@ -797,6 +801,14 @@ gifsettunnel(src, dst)
}
void
+deletetunnel()
+{
+ if (ioctl(s, SIOCDIFPHYADDR, &ifr) < 0)
+ warn("SIOCDIFPHYADDR");
+}
+
+
+void
setifnetmask(addr)
char *addr;
{
@@ -2242,7 +2254,8 @@ usage()
"\t[ metric n ]\n"
"\t[ mtu n ]\n"
"\t[ nwid netword_id ]\n"
- "\t[ giftunnel srcaddress dstaddress ]\n"
+ "\t[ tunnel srcaddress dstaddress ]\n"
+ "\t[ deletetunnel ]\n"
"\t[ vlan n vlandev interface ]\n"
"\t[ arp | -arp ]\n"
"\t[ -802.2 | -802.3 | -802.2tr | -snap | -EtherII ]\n"