On Wed, Feb 21, 2018 at 11:00:22PM -0800, Ayaka Koshibe wrote:
> Ah, right. I hope I can just update the man page to explicitly mention
> this. I've also made it a bit more concise as jmc had suggested.

Looks good and works as advertised in a quick test. ok stsp@

> Index: sbin/ifconfig/ifconfig.8
> ===================================================================
> RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v
> retrieving revision 1.303
> diff -u -p -u -p -r1.303 ifconfig.8
> --- sbin/ifconfig/ifconfig.8  20 Feb 2018 07:34:28 -0000      1.303
> +++ sbin/ifconfig/ifconfig.8  22 Feb 2018 06:06:00 -0000
> @@ -439,6 +439,10 @@ 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
> +Remove the interface from the routing domain and return it to routing
> +domain 0.
> +Any inet and inet6 addresses on the interface will also be removed.
>  .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.360
> diff -u -p -u -p -r1.360 ifconfig.c
> --- sbin/ifconfig/ifconfig.c  20 Feb 2018 15:33:16 -0000      1.360
> +++ sbin/ifconfig/ifconfig.c  22 Feb 2018 06:06:01 -0000
> @@ -237,6 +237,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);
> @@ -421,6 +422,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 },
> @@ -5665,6 +5667,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
> 

Reply via email to