summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-01-30 01:09:37 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-01-30 01:09:37 +0000
commite2f84b0a9ace6c0051461915505e45d00d49d6e4 (patch)
tree67b200451a4ff2af3eee51578ad0882921a8b572 /sys
parentfdbcc0c7f2f41ebd47cf4f8ae7224d0ee8141cd5 (diff)
use MPLS_SHIM2LABEL and MPLS_LABEL2SHIM
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_mpe.c8
-rw-r--r--sys/net/if_mpw.c12
2 files changed, 8 insertions, 12 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index f165ba05115..bfdf4df3bb4 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.75 2019/01/30 00:28:26 dlg Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.76 2019/01/30 01:09:36 dlg Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -304,9 +304,7 @@ mpe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCGETLABEL:
ifm = ifp->if_softc;
- shim.shim_label =
- ((ntohl(ifm->sc_smpls.smpls_label & MPLS_LABEL_MASK)) >>
- MPLS_LABEL_OFFSET);
+ shim.shim_label = MPLS_SHIM2LABEL(ifm->sc_smpls.smpls_label);
error = copyout(&shim, ifr->ifr_data, sizeof(shim));
break;
case SIOCSETLABEL:
@@ -318,7 +316,7 @@ mpe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = EINVAL;
break;
}
- shim.shim_label = htonl(shim.shim_label << MPLS_LABEL_OFFSET);
+ shim.shim_label = MPLS_LABEL2SHIM(shim.shim_label);
if (ifm->sc_smpls.smpls_label == shim.shim_label)
break;
LIST_FOREACH(ifm, &mpeif_list, sc_list) {
diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c
index f88e0063578..a3825e7f7f0 100644
--- a/sys/net/if_mpw.c
+++ b/sys/net/if_mpw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpw.c,v 1.30 2019/01/29 03:12:12 dlg Exp $ */
+/* $OpenBSD: if_mpw.c,v 1.31 2019/01/30 01:09:36 dlg Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
@@ -185,9 +185,9 @@ mpw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* Setup labels and create inbound route */
imr.imr_lshim.shim_label =
- htonl(imr.imr_lshim.shim_label << MPLS_LABEL_OFFSET);
+ MPLS_LABEL2SHIM(imr.imr_lshim.shim_label);
imr.imr_rshim.shim_label =
- htonl(imr.imr_rshim.shim_label << MPLS_LABEL_OFFSET);
+ MPLS_LABEL2SHIM(imr.imr_rshim.shim_label);
if (sc->sc_smpls.smpls_label != imr.imr_lshim.shim_label) {
if (sc->sc_smpls.smpls_label)
@@ -220,11 +220,9 @@ mpw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
imr.imr_flags = sc->sc_flags;
imr.imr_type = sc->sc_type;
imr.imr_lshim.shim_label =
- ((ntohl(sc->sc_smpls.smpls_label & MPLS_LABEL_MASK)) >>
- MPLS_LABEL_OFFSET);
+ MPLS_SHIM2LABEL(sc->sc_smpls.smpls_label);
imr.imr_rshim.shim_label =
- ((ntohl(sc->sc_rshim.shim_label & MPLS_LABEL_MASK)) >>
- MPLS_LABEL_OFFSET);
+ MPLS_SHIM2LABEL(sc->sc_rshim.shim_label);
memcpy(&imr.imr_nexthop, &sc->sc_nexthop,
sizeof(imr.imr_nexthop));