Hi,

A while back I got a suggestion to add a '-tunneldomain' option as shorthand
for 'tunneldomain 0' to be consistent with '-rdomain'.

OK?

Thanks,
Ayaka

Index: ifconfig.8
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v
retrieving revision 1.304
diff -u -p -u -r1.304 ifconfig.8
--- ifconfig.8  23 Feb 2018 05:17:39 -0000      1.304
+++ ifconfig.8  25 Apr 2018 06:52:41 -0000
@@ -1606,7 +1606,7 @@ for a complete list of the available pro
 .Ar tunnel-interface
 .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 tunneldomain Ar tableid
 .Op Oo Fl Oc Ns Cm tunneldf
 .Op Cm tunnelttl Ar ttl
 .Op Oo Fl Oc Ns Cm vnetflowid
@@ -1660,6 +1660,8 @@ interface itself.
 .Ar tableid
 can be set to any valid routing table ID;
 the corresponding routing domain is derived from this table.
+.It Cm -tunneldomain
+Use the default routing table and routing domain 0.
 .It Cm tunneldf
 Do not allow fragmentation of encapsulated packets.
 .It Cm -tunneldf
Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.361
diff -u -p -u -r1.361 ifconfig.c
--- ifconfig.c  23 Feb 2018 05:17:39 -0000      1.361
+++ ifconfig.c  25 Apr 2018 06:52:42 -0000
@@ -202,6 +202,7 @@ void        setifprefixlen(const char *, int);
 void   settunnel(const char *, const char *);
 void   deletetunnel(const char *, int);
 void   settunnelinst(const char *, int);
+void   unsettunnelinst(const char *, int);
 void   settunnelttl(const char *, int);
 void   setvnetid(const char *, int);
 void   delvnetid(const char *, int);
@@ -457,6 +458,7 @@ const struct        cmd {
        /* deletetunnel is for backward compat, remove during 6.4-current */
        { "deletetunnel",  0,           0,              deletetunnel },
        { "tunneldomain", NEXTARG,      0,              settunnelinst },
+       { "-tunneldomain", 0,           0,              unsettunnelinst },
        { "tunnelttl",  NEXTARG,        0,              settunnelttl },
        { "tunneldf",   0,              0,              settunneldf },
        { "-tunneldf",  0,              0,              settunnelnodf },
@@ -3293,6 +3295,15 @@ settunnelinst(const char *id, int param)
 
        strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
        ifr.ifr_rdomainid = rdomainid;
+       if (ioctl(s, SIOCSLIFPHYRTABLE, (caddr_t)&ifr) < 0)
+               warn("SIOCSLIFPHYRTABLE");
+}
+
+void
+unsettunnelinst(const char *ignored, int alsoignored)
+{
+       strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+       ifr.ifr_rdomainid = 0;
        if (ioctl(s, SIOCSLIFPHYRTABLE, (caddr_t)&ifr) < 0)
                warn("SIOCSLIFPHYRTABLE");
 }

Reply via email to