From cf4a45e670cff01b3f9c3aee1e8dc5462294108e Mon Sep 17 00:00:00 2001 From: mpi Date: Mon, 29 May 2017 06:44:54 +0000 Subject: [PATCH] Pass SIOCGIFMEDIA to vlan's parent interface. ok krw@, dlg@ --- sys/net/if_vlan.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index d53ee9f89dc..a049a46eeaa 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.171 2017/01/24 10:08:30 krw Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.172 2017/05/29 06:44:54 mpi Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -105,6 +105,8 @@ int vlan_multi_del(struct ifvlan *, struct ifreq *); void vlan_multi_apply(struct ifvlan *, struct ifnet *, u_long); void vlan_multi_free(struct ifvlan *); +int vlan_media_get(struct ifvlan *, struct ifreq *); + int vlan_iff(struct ifvlan *); int vlan_setlladdr(struct ifvlan *, struct ifreq *); @@ -723,10 +725,19 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCADDMULTI: error = vlan_multi_add(ifv, ifr); break; + case SIOCDELMULTI: error = vlan_multi_del(ifv, ifr); break; + case SIOCGIFMEDIA: + error = vlan_media_get(ifv, ifr); + break; + + case SIOCSIFMEDIA: + error = ENOTTY; + break; + case SIOCSIFLLADDR: error = vlan_setlladdr(ifv, ifr); break; @@ -1053,6 +1064,20 @@ forget: return (0); } +int +vlan_media_get(struct ifvlan *ifv, struct ifreq *ifr) +{ + struct ifnet *ifp0; + int error; + + ifp0 = if_get(ifv->ifv_ifp0); + error = (ifp0 == NULL) ? ENOTTY : + (*ifp0->if_ioctl)(ifp0, SIOCGIFMEDIA, (caddr_t)ifr); + if_put(ifp0); + + return (error); +} + void vlan_multi_apply(struct ifvlan *ifv, struct ifnet *ifp0, u_long cmd) { -- 2.20.1