summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-02-19 00:23:58 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-02-19 00:23:58 +0000
commitcb85717eb553f6f741f467fb3782b14270b3dacb (patch)
treeb76481a0ff8e36d554c129d97df8e5fc11629417 /sbin
parent05161875498a1c4ff6f39ce8746e9d6f4e711fde (diff)
add support for setting and displaying whether a tunnel allows fragmentation
ifconfig will output "nodf" or "df" on tunnel interfaces that support the ioctl., and accepts "tunneldf" and "-tunneldf" as options to try and configure it.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifconfig.89
-rw-r--r--sbin/ifconfig/ifconfig.c28
2 files changed, 34 insertions, 3 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 68f24911b85..42990ad0dd9 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.299 2018/02/15 04:21:46 dlg Exp $
+.\" $OpenBSD: ifconfig.8,v 1.300 2018/02/19 00:23:57 dlg 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: February 15 2018 $
+.Dd $Mdocdate: February 19 2018 $
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -1603,6 +1603,7 @@ for a complete list of the available protocols.
.Op Oo Fl Oc Ns Cm keepalive Ar period count
.Op Oo Fl Oc Ns Cm tunnel Ar src_address dest_address
.Op Cm tunneldomain Ar tableid
+.Op Oo Fl Oc Ns Cm tunneldf
.Op Cm tunnelttl Ar ttl
.Op Oo Fl Oc Ns Cm vnetid Ar network-id
.Ek
@@ -1654,6 +1655,10 @@ interface itself.
.Ar tableid
can be set to any valid routing table ID;
the corresponding routing domain is derived from this table.
+.It Cm tunneldf
+Do not allow fragmentation of encapsulated packets.
+.It Cm -tunneldf
+Allow fragmentation of the encapsulated packets.
.It Cm tunnelttl Ar ttl
Set the IP or multicast TTL of the tunnel packets.
If supported by the tunnel protocol,
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index ac5705b2651..88956f0d7ff 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.357 2018/02/10 05:55:26 florian Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.358 2018/02/19 00:23:57 dlg Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -252,6 +252,8 @@ void setpfsync_syncpeer(const char *, int);
void unsetpfsync_syncpeer(const char *, int);
void setpfsync_defer(const char *, int);
void pfsync_status(void);
+void settunneldf(const char *, int);
+void settunnelnodf(const char *, int);
void setpppoe_dev(const char *,int);
void setpppoe_svc(const char *,int);
void setpppoe_ac(const char *,int);
@@ -434,6 +436,8 @@ const struct cmd {
{ "deletetunnel", 0, 0, deletetunnel },
{ "tunneldomain", NEXTARG, 0, settunnelinst },
{ "tunnelttl", NEXTARG, 0, settunnelttl },
+ { "tunneldf", 0, 0, settunneldf },
+ { "-tunneldf", 0, 0, settunnelnodf },
{ "pppoedev", NEXTARG, 0, setpppoe_dev },
{ "pppoesvc", NEXTARG, 0, setpppoe_svc },
{ "-pppoesvc", 1, 0, setpppoe_svc },
@@ -2750,6 +2754,10 @@ phys_status(int force)
else if (ifr.ifr_ttl > 0)
printf(" ttl %d", ifr.ifr_ttl);
}
+
+ if (ioctl(s, SIOCGLIFPHYDF, (caddr_t)&ifr) == 0)
+ printf(" %s", ifr.ifr_df ? "df" : "nodf");
+
#ifndef SMALL
if (ioctl(s, SIOCGLIFPHYRTABLE, (caddr_t)&ifr) == 0 &&
(rdomainid != 0 || ifr.ifr_rdomainid != 0))
@@ -3286,6 +3294,24 @@ settunnelttl(const char *id, int param)
}
void
+settunneldf(const char *ignored, int alsoignored)
+{
+ strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+ ifr.ifr_df = 1;
+ if (ioctl(s, SIOCSLIFPHYDF, (caddr_t)&ifr) < 0)
+ warn("SIOCSLIFPHYDF");
+}
+
+void
+settunnelnodf(const char *ignored, int alsoignored)
+{
+ strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+ ifr.ifr_df = 0;
+ if (ioctl(s, SIOCSLIFPHYDF, (caddr_t)&ifr) < 0)
+ warn("SIOCSLIFPHYDF");
+}
+
+void
mpe_status(void)
{
struct shim_hdr shim;