diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2019-03-18 03:21:21 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2019-03-18 03:21:21 +0000 |
commit | 097b20e75378f8c3d6ec2c4880cc01a55ad32e63 (patch) | |
tree | 890e126d4237c836b552220344a6885e447bf6c8 | |
parent | dba4896fdb047153cb3c2a7ffc97e4408838a78d (diff) |
tweak SIOCGETLABEL and add SIOCDELLABEL
makes mpe consistent with mpw and mpip
-rw-r--r-- | sys/net/if_mpe.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index b980ba44e71..e50d5a45930 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpe.c,v 1.86 2019/02/26 03:23:04 dlg Exp $ */ +/* $OpenBSD: if_mpe.c,v 1.87 2019/03/18 03:21:20 dlg Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -341,6 +341,10 @@ mpe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCGETLABEL: shim.shim_label = MPLS_SHIM2LABEL(sc->sc_smpls.smpls_label); + if (shim.shim_label == 0) { + error = EADDRNOTAVAIL; + break; + } error = copyout(&shim, ifr->ifr_data, sizeof(shim)); break; case SIOCSETLABEL: @@ -358,6 +362,15 @@ mpe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) sc->sc_rdomain); } break; + case SIOCDELLABEL: + if (sc->sc_smpls.smpls_label != MPLS_LABEL2SHIM(0)) { + rt_ifa_del(&sc->sc_ifa, RTF_MPLS|RTF_LOCAL, + smplstosa(&sc->sc_smpls), sc->sc_rdomain); + + } + shim.shim_label = MPLS_LABEL2SHIM(0); + break; + case SIOCSLIFPHYRTABLE: if (ifr->ifr_rdomainid < 0 || ifr->ifr_rdomainid > RT_TABLEID_MAX || |