From 6863931862625459ea6e1b97753cf81dc3f3da9f Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Wed, 2 Mar 2016 00:00:17 +0000 Subject: provide generic ioctls for managing an interfaces parent in the future this will subsume the individual vlandev, carpdev, pppoedev, foodev options for things like vlan, carp, pppoe, etc. inspired by vnetid ok mpi@ jmatthew@ --- sys/net/if.c | 5 ++++- sys/net/if.h | 8 +++++++- sys/sys/sockio.h | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/net/if.c b/sys/net/if.c index 5c9d1773d4a..0823badc37f 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.426 2016/02/28 15:46:19 naddy Exp $ */ +/* $OpenBSD: if.c,v 1.427 2016/03/02 00:00:16 dlg Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1754,6 +1754,8 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) case SIOCSIFMEDIA: case SIOCSVNETID: case SIOCSIFPAIR: + case SIOCSIFPARENT: + case SIOCDIFPARENT: if ((error = suser(p, 0)) != 0) return (error); /* FALLTHROUGH */ @@ -1765,6 +1767,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) case SIOCGIFMEDIA: case SIOCGVNETID: case SIOCGIFPAIR: + case SIOCGIFPARENT: if (ifp->if_ioctl == 0) return (EOPNOTSUPP); error = (*ifp->if_ioctl)(ifp, cmd, data); diff --git a/sys/net/if.h b/sys/net/if.h index 8d7e3906e69..3d3569d960e 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.175 2015/12/05 19:04:37 deraadt Exp $ */ +/* $OpenBSD: if.h,v 1.176 2016/03/02 00:00:16 dlg Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -444,6 +444,12 @@ struct if_afreq { sa_family_t ifar_af; }; +/* SIOC[SG]IFPARENT */ +struct if_parent { + char ifp_name[IFNAMSIZ]; + char ifp_parent[IFNAMSIZ]; +}; + #include #ifdef _KERNEL diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index 1e9739c9418..cd7f83ad491 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sockio.h,v 1.62 2015/10/24 10:52:05 reyk Exp $ */ +/* $OpenBSD: sockio.h,v 1.63 2016/03/02 00:00:16 dlg Exp $ */ /* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */ /*- @@ -199,6 +199,10 @@ #define SIOCSIFPAIR _IOW('i', 176, struct ifreq) /* set paired if */ #define SIOCGIFPAIR _IOWR('i', 177, struct ifreq) /* get paired if */ +#define SIOCSIFPARENT _IOW('i', 178, struct if_parent) /* set parent if */ +#define SIOCGIFPARENT _IOWR('i', 179, struct if_parent) /* get parent if */ +#define SIOCDIFPARENT _IOW('i', 180, struct ifreq) /* del parent if */ + #define SIOCSVH _IOWR('i', 245, struct ifreq) /* set carp param */ #define SIOCGVH _IOWR('i', 246, struct ifreq) /* get carp param */ -- cgit v1.2.3