Hi, This diff would allow saying 'ifconfig foo -rdomain' instead of 'ifconfig foo rdomain 0'.
OK? Thanks, Ayaka Index: sbin/ifconfig/ifconfig.8 =================================================================== RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v retrieving revision 1.292 diff -u -p -u -p -r1.292 ifconfig.8 --- sbin/ifconfig/ifconfig.8 16 Jan 2018 10:33:55 -0000 1.292 +++ sbin/ifconfig/ifconfig.8 20 Feb 2018 00:02:47 -0000 @@ -439,6 +439,9 @@ domains. If the specified rdomain does not yet exist it will be created, including a routing table with the same id. By default all interfaces belong to routing domain 0. +.It Cm -rdomain +If previously specified, remove the interface from the routing domain. +The interface is returned to routing domain 0. .It Cm rtlabel Ar route-label (inet) Attach Index: sbin/ifconfig/ifconfig.c =================================================================== RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.353 diff -u -p -u -p -r1.353 ifconfig.c --- sbin/ifconfig/ifconfig.c 16 Jan 2018 10:33:55 -0000 1.353 +++ sbin/ifconfig/ifconfig.c 20 Feb 2018 00:02:48 -0000 @@ -220,6 +220,7 @@ void unsetvlandev(const char *, int); void mpe_status(void); void mpw_status(void); void setrdomain(const char *, int); +void unsetrdomain(const char *, int); int prefix(void *val, int); void getifgroups(void); void setifgroup(const char *, int); @@ -397,6 +398,7 @@ const struct cmd { { "rtlabel", NEXTARG, 0, setifrtlabel }, { "-rtlabel", -1, 0, setifrtlabel }, { "rdomain", NEXTARG, 0, setrdomain }, + { "-rdomain", 0, 0, unsetrdomain }, { "staticarp", IFF_STATICARP, 0, setifflags }, { "-staticarp", -IFF_STATICARP, 0, setifflags }, { "mpls", IFXF_MPLS, 0, setifxflags }, @@ -5578,6 +5580,15 @@ setrdomain(const char *id, int param) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_rdomainid = rdomainid; if (ioctl(s, SIOCSIFRDOMAIN, (caddr_t)&ifr) < 0) + warn("SIOCSIFRDOMAIN"); +} + +void +unsetrdomain(const char *ignored, int alsoignored) +{ + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + ifr.ifr_rdomainid = 0; + if (ioctl(s, SIOCSIFRDOMAIN, (caddr_t)&ifr) < 0) warn("SIOCSIFRDOMAIN"); } #endif