summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_mpe.c18
-rw-r--r--sys/netmpls/mpls.h3
2 files changed, 14 insertions, 7 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index 8443ec427ab..aee5e894bbb 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -64,12 +64,12 @@ mpe_clone_create(struct if_clone *ifc, int unit)
M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
return (ENOMEM);
- mpeif->sc_shim.shim_label = 0;
+ mpeif->sc_shim.shim_label = MPLS_BOS_MASK | htonl(mpls_defttl);
mpeif->sc_unit = unit;
ifp = &mpeif->sc_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "mpe%d", unit);
ifp->if_softc = mpeif;
- ifp->if_mtu = 0;
+ ifp->if_mtu = 1500;
ifp->if_ioctl = mpeioctl;
ifp->if_output = mpeoutput;
ifp->if_start = mpestart;
@@ -137,6 +137,7 @@ mpestart(struct ifnet *ifp)
ifp->if_ierrors++;
continue;
}
+ m->m_pkthdr.rcvif = ifp;
mpls_input(m);
}
}
@@ -169,6 +170,7 @@ mpeioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct mpe_softc *ifm;
struct ifreq *ifr;
struct shim_hdr shim;
+ u_int32_t ttl = htonl(mpls_defttl);
ifr = (struct ifreq *)data;
error = 0;
@@ -183,19 +185,23 @@ mpeioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCGETLABEL:
ifm = ifp->if_softc;
- error = copyout(&ifm->sc_shim, ifr->ifr_data,
- sizeof(ifm->sc_shim));
+ shim.shim_label =
+ ((ntohl(ifm->sc_shim.shim_label & MPLS_LABEL_MASK)) >>
+ MPLS_LABEL_OFFSET);
+ error = copyout(&shim, ifr->ifr_data, sizeof(shim));
break;
case SIOCSETLABEL:
ifm = ifp->if_softc;
if ((error = copyin(ifr->ifr_data, &shim, sizeof(shim))))
break;
- if (ifm->sc_shim.shim_label == shim.shim_label)
- break;
if (shim.shim_label > MPLS_LABEL_MAX) {
error = EINVAL;
break;
}
+ shim.shim_label = (htonl(shim.shim_label << MPLS_LABEL_OFFSET))
+ | MPLS_BOS_MASK | ttl;
+ if (ifm->sc_shim.shim_label == shim.shim_label)
+ break;
LIST_FOREACH(ifm, &mpeif_list, sc_list) {
if (ifm != ifp->if_softc &&
ifm->sc_shim.shim_label == shim.shim_label) {
diff --git a/sys/netmpls/mpls.h b/sys/netmpls/mpls.h
index 98a52763021..0025cd6d462 100644
--- a/sys/netmpls/mpls.h
+++ b/sys/netmpls/mpls.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls.h,v 1.5 2008/05/06 13:33:50 pyr Exp $ */
+/* $OpenBSD: mpls.h,v 1.6 2008/05/07 06:53:42 pyr Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
@@ -155,6 +155,7 @@ extern int mpls_raw_usrreq(struct socket *, int, struct mbuf *,
extern struct ifqueue mplsintrq; /* MPLS input queue */
extern int mplsqmaxlen; /* MPLS input queue length */
extern int mpls_enable;
+extern int mpls_defttl;
void mpls_init(void);
void mplsintr(void);