summaryrefslogtreecommitdiffstats
path: root/sys/net/if_vxlan.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2016-08-07 13:49:12 +0000
committerreyk <reyk@openbsd.org>2016-08-07 13:49:12 +0000
commit63521d86e68ee8e4015215f868c6762ee594af1c (patch)
tree91c3014c75d74ab1f8b5b8a648b0f5861af4160a /sys/net/if_vxlan.c
parentUpdate online manual path to man.openbsd.org. (diff)
downloadwireguard-openbsd-63521d86e68ee8e4015215f868c6762ee594af1c.tar.xz
wireguard-openbsd-63521d86e68ee8e4015215f868c6762ee594af1c.zip
Define VXLAN_VNI_UNSET and VXLAN_VNI_MAX instead of using magic numbers.
No functional change.
Diffstat (limited to 'sys/net/if_vxlan.c')
-rw-r--r--sys/net/if_vxlan.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 01338297790..247473776ae 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vxlan.c,v 1.40 2016/08/06 14:33:33 reyk Exp $ */
+/* $OpenBSD: if_vxlan.c,v 1.41 2016/08/07 13:49:12 reyk Exp $ */
/*
* Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org>
@@ -130,7 +130,7 @@ vxlan_clone_create(struct if_clone *ifc, int unit)
M_WAITOK|M_ZERO);
sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS;
sc->sc_dstport = htons(VXLAN_PORT);
- sc->sc_vnetid = -1;
+ sc->sc_vnetid = VXLAN_VNI_UNSET;
ifp = &sc->sc_ac.ac_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "vxlan%d", unit);
@@ -454,7 +454,7 @@ vxlanioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCSVNETID:
- if (ifr->ifr_vnetid > 0x00ffffff) {
+ if (ifr->ifr_vnetid > VXLAN_VNI_MAX) {
error = EINVAL;
break;
}
@@ -465,7 +465,7 @@ vxlanioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCGVNETID:
- if (sc->sc_vnetid == -1) {
+ if (sc->sc_vnetid == VXLAN_VNI_UNSET) {
error = EADDRNOTAVAIL;
break;
}
@@ -474,7 +474,7 @@ vxlanioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCDVNETID:
s = splnet();
- sc->sc_vnetid = -1;
+ sc->sc_vnetid = VXLAN_VNI_UNSET;
(void)vxlan_config(ifp, NULL, NULL);
splx(s);
break;
@@ -576,7 +576,7 @@ vxlan_lookup(struct mbuf *m, struct udphdr *uh, int iphlen,
if (vni != 0)
return (0);
- vni = -1;
+ vni = VXLAN_VNI_UNSET;
}
LIST_FOREACH(sc, &vxlan_tagh[VXLAN_TAGHASH(vni)], sc_entry) {
@@ -753,7 +753,7 @@ vxlan_output(struct ifnet *ifp, struct mbuf *m)
}
#endif
- if (sc->sc_vnetid != -1) {
+ if (sc->sc_vnetid != VXLAN_VNI_UNSET) {
vu->vu_v.vxlan_flags = htonl(VXLAN_FLAGS_VNI);
vu->vu_v.vxlan_id = htonl(sc->sc_vnetid << VXLAN_VNI_S);
} else {