From owner-svn-src-projects@FreeBSD.ORG Sun Jun 29 01:21:36 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AB51D99; Sun, 29 Jun 2014 01:21:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7783D290C; Sun, 29 Jun 2014 01:21:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5T1Latx094123; Sun, 29 Jun 2014 01:21:36 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5T1LZ7l094120; Sun, 29 Jun 2014 01:21:35 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201406290121.s5T1LZ7l094120@svn.freebsd.org> From: Bryan Venteicher Date: Sun, 29 Jun 2014 01:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r268013 - in projects/vxlan: sbin/ifconfig sys/net X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jun 2014 01:21:36 -0000 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; };