svn commit: r268013 - in projects/vxlan: sbin/ifconfig sys/net
Bryan Venteicher
bryanv at FreeBSD.org
Sun Jun 29 01:21:36 UTC 2014
Author: bryanv
Date: Sun Jun 29 01:21:35 2014
New Revision: 268013
URL: http://svnweb.freebsd.org/changeset/base/268013
Log:
More misc vxlan changes:
- Rename some multicast related macros to be more consistent
- Fix compile without INET6
- Always queue the decapsulated frame to the netisr. The locks
we hold at this point from udp_input() makes it too dangerous
to process the frame in the same context.
Modified:
projects/vxlan/sbin/ifconfig/ifvxlan.c
projects/vxlan/sys/net/if_vxlan.c
projects/vxlan/sys/net/if_vxlan.h
Modified: projects/vxlan/sbin/ifconfig/ifvxlan.c
==============================================================================
--- projects/vxlan/sbin/ifconfig/ifvxlan.c Sun Jun 29 01:04:11 2014 (r268012)
+++ projects/vxlan/sbin/ifconfig/ifvxlan.c Sun Jun 29 01:21:35 2014 (r268013)
@@ -504,7 +504,7 @@ DECL_CMD_FUNC(setvxlan_dev, arg, d)
struct ifvxlancmd cmd;
if (!vxlan_exists(s)) {
- params.vxlp_with |= VXLAN_PARAM_WITH_MC_INTERFACE;
+ params.vxlp_with |= VXLAN_PARAM_WITH_MULTICAST_IF;
strlcpy(params.vxlp_mc_ifname, arg,
sizeof(params.vxlp_mc_ifname));
return;
@@ -513,8 +513,8 @@ DECL_CMD_FUNC(setvxlan_dev, arg, d)
bzero(&cmd, sizeof(cmd));
strlcpy(cmd.vxlcmd_ifname, arg, sizeof(cmd.vxlcmd_ifname));
- if (do_cmd(s, VXLAN_CMD_SET_MC_INTERFACE, &cmd, sizeof(cmd), 1) < 0)
- err(1, "VXLAN_CMD_SET_MC_INTERFACE");
+ if (do_cmd(s, VXLAN_CMD_SET_MULTICAST_IF, &cmd, sizeof(cmd), 1) < 0)
+ err(1, "VXLAN_CMD_SET_MULTICAST_IF");
}
static
Modified: projects/vxlan/sys/net/if_vxlan.c
==============================================================================
--- projects/vxlan/sys/net/if_vxlan.c Sun Jun 29 01:04:11 2014 (r268012)
+++ projects/vxlan/sys/net/if_vxlan.c Sun Jun 29 01:21:35 2014 (r268013)
@@ -299,7 +299,7 @@ static int vxlan_ctrl_set_remote_port(st
static int vxlan_ctrl_set_port_range(struct vxlan_softc *, void *);
static int vxlan_ctrl_set_ftable_timeout(struct vxlan_softc *, void *);
static int vxlan_ctrl_set_ftable_max(struct vxlan_softc *, void *);
-static int vxlan_ctrl_set_mc_interface(struct vxlan_softc * , void *);
+static int vxlan_ctrl_set_multicast_if(struct vxlan_softc * , void *);
static int vxlan_ctrl_set_ttl(struct vxlan_softc *, void *);
static int vxlan_ctrl_set_learn(struct vxlan_softc *, void *);
static int vxlan_ctrl_ftable_entry_add(struct vxlan_softc *, void *);
@@ -459,8 +459,8 @@ static const struct vxlan_control vxlan_
VXLAN_CTRL_FLAG_COPYIN | VXLAN_CTRL_FLAG_SUSER,
},
- [VXLAN_CMD_SET_MC_INTERFACE] =
- { vxlan_ctrl_set_mc_interface, sizeof(struct ifvxlancmd),
+ [VXLAN_CMD_SET_MULTICAST_IF] =
+ { vxlan_ctrl_set_multicast_if, sizeof(struct ifvxlancmd),
VXLAN_CTRL_FLAG_COPYIN | VXLAN_CTRL_FLAG_SUSER,
},
@@ -753,6 +753,7 @@ vxlan_ftable_entry_insert(struct vxlan_s
out:
sc->vxl_ftable_cnt++;
+
return (0);
}
@@ -983,8 +984,10 @@ vxlan_socket_create(struct ifnet *ifp, i
if (multicast != 0) {
if (VXLAN_SOCKADDR_IS_IPV4(&laddr))
laddr.in4.sin_addr.s_addr = INADDR_ANY;
+#ifdef INET6
else
laddr.in6.sin6_addr = in6addr_any;
+#endif
}
vso = vxlan_socket_alloc(&laddr);
@@ -1040,8 +1043,10 @@ vxlan_socket_mc_lookup(const union vxlan
if (VXLAN_SOCKADDR_IS_IPV4(&laddr))
laddr.in4.sin_addr.s_addr = INADDR_ANY;
+#ifdef INET6
else
laddr.in6.sin6_addr = in6addr_any;
+#endif
vso = vxlan_socket_lookup(&laddr);
@@ -1699,10 +1704,8 @@ vxlan_teardown_locked(struct vxlan_softc
{
struct ifnet *ifp;
struct vxlan_socket *vso;
- union vxlan_sockaddr *daddr;
ifp = sc->vxl_ifp;
- daddr = &sc->vxl_dst_addr;
VXLAN_LOCK_WASSERT(sc);
MPASS(sc->vxl_flags & VXLAN_FLAG_TEARDOWN);
@@ -1820,6 +1823,8 @@ vxlan_ctrl_get_config(struct vxlan_softc
cfg->vxlc_ftable_cnt = sc->vxl_ftable_cnt;
cfg->vxlc_ftable_max = sc->vxl_ftable_max;
cfg->vxlc_ftable_timeout = sc->vxl_ftable_timeout;
+ cfg->vxlc_port_min = sc->vxl_min_port;
+ cfg->vxlc_port_max = sc->vxl_max_port;
cfg->vxlc_learn = (sc->vxl_flags & VXLAN_FLAG_LEARN) != 0;
cfg->vxlc_ttl = sc->vxl_ttl;
VXLAN_RUNLOCK(sc);
@@ -2008,7 +2013,7 @@ vxlan_ctrl_set_ftable_max(struct vxlan_s
}
static int
-vxlan_ctrl_set_mc_interface(struct vxlan_softc * sc, void *arg)
+vxlan_ctrl_set_multicast_if(struct vxlan_softc * sc, void *arg)
{
struct ifvxlancmd *cmd;
int error;
@@ -2447,8 +2452,6 @@ vxlan_rcv_udp_packet(struct mbuf *m, int
uint32_t vni;
int error;
- INP_RUNLOCK(inpcb);
-
M_ASSERTPKTHDR(m);
vso = xvso;
offset += sizeof(struct udphdr);
@@ -2477,8 +2480,6 @@ vxlan_rcv_udp_packet(struct mbuf *m, int
out:
if (m != NULL)
m_freem(m);
-
- INP_RLOCK(inpcb);
}
static int
@@ -2515,7 +2516,7 @@ vxlan_input(struct vxlan_socket *vso, ui
m->m_pkthdr.rcvif = ifp;
M_SETFIB(m, ifp->if_fib);
- error = netisr_dispatch(NETISR_ETHER, m);
+ error = netisr_queue_src(NETISR_ETHER, 0 ,m);
*m0 = NULL;
out:
@@ -2600,7 +2601,7 @@ vxlan_set_user_config(struct vxlan_softc
}
}
- if (vxlp->vxlp_with & VXLAN_PARAM_WITH_MC_INTERFACE)
+ if (vxlp->vxlp_with & VXLAN_PARAM_WITH_MULTICAST_IF)
strlcpy(sc->vxl_mc_ifname, vxlp->vxlp_mc_ifname, IFNAMSIZ);
if (vxlp->vxlp_with & VXLAN_PARAM_WITH_FTABLE_TIMEOUT) {
Modified: projects/vxlan/sys/net/if_vxlan.h
==============================================================================
--- projects/vxlan/sys/net/if_vxlan.h Sun Jun 29 01:04:11 2014 (r268012)
+++ projects/vxlan/sys/net/if_vxlan.h Sun Jun 29 01:21:35 2014 (r268013)
@@ -65,7 +65,7 @@ struct ifvxlanparam {
#define VXLAN_PARAM_WITH_PORT_RANGE 0x0080
#define VXLAN_PARAM_WITH_FTABLE_TIMEOUT 0x0100
#define VXLAN_PARAM_WITH_FTABLE_MAX 0x0200
-#define VXLAN_PARAM_WITH_MC_INTERFACE 0x0400
+#define VXLAN_PARAM_WITH_MULTICAST_IF 0x0400
#define VXLAN_PARAM_WITH_TTL 0x0800
#define VXLAN_PARAM_WITH_LEARN 0x1000
@@ -105,7 +105,7 @@ union vxlan_sockaddr {
#define VXLAN_CMD_SET_PORT_RANGE 7
#define VXLAN_CMD_SET_FTABLE_TIMEOUT 8
#define VXLAN_CMD_SET_FTABLE_MAX 9
-#define VXLAN_CMD_SET_MC_INTERFACE 10
+#define VXLAN_CMD_SET_MULTICAST_IF 10
#define VXLAN_CMD_SET_TTL 11
#define VXLAN_CMD_SET_LEARN 12
#define VXLAN_CMD_FTABLE_ENTRY_ADD 13
@@ -121,6 +121,8 @@ struct ifvxlancfg {
uint32_t vxlc_ftable_cnt;
uint32_t vxlc_ftable_max;
uint32_t vxlc_ftable_timeout;
+ uint16_t vxlc_port_min;
+ uint16_t vxlc_port_max;
uint8_t vxlc_learn;
uint8_t vxlc_ttl;
};
More information about the svn-src-projects
mailing list