| 2188 | } |
| 2189 | |
| 2190 | static int |
| 2191 | vxlan_ctrl_ftable_entry_add(struct vxlan_softc *sc, void *arg) |
| 2192 | { |
| 2193 | union vxlan_sockaddr vxlsa; |
| 2194 | struct ifvxlancmd *cmd; |
| 2195 | struct vxlan_ftable_entry *fe; |
| 2196 | int error; |
| 2197 | |
| 2198 | cmd = arg; |
| 2199 | vxlsa = cmd->vxlcmd_sa; |
| 2200 | |
| 2201 | if (!VXLAN_SOCKADDR_IS_IPV46(&vxlsa)) |
| 2202 | return (EINVAL); |
| 2203 | if (vxlan_sockaddr_in_any(&vxlsa) != 0) |
| 2204 | return (EINVAL); |
| 2205 | if (vxlan_sockaddr_in_multicast(&vxlsa) != 0) |
| 2206 | return (EINVAL); |
| 2207 | /* BMV: We could support both IPv4 and IPv6 later. */ |
| 2208 | if (vxlsa.sa.sa_family != sc->vxl_dst_addr.sa.sa_family) |
| 2209 | return (EAFNOSUPPORT); |
| 2210 | |
| 2211 | if (VXLAN_SOCKADDR_IS_IPV6(&vxlsa)) { |
| 2212 | error = vxlan_sockaddr_in6_embedscope(&vxlsa); |
| 2213 | if (error) |
| 2214 | return (error); |
| 2215 | } |
| 2216 | |
| 2217 | fe = vxlan_ftable_entry_alloc(); |
| 2218 | if (fe == NULL) |
| 2219 | return (ENOMEM); |
| 2220 | |
| 2221 | if (vxlsa.in4.sin_port == 0) |
| 2222 | vxlsa.in4.sin_port = sc->vxl_dst_addr.in4.sin_port; |
| 2223 | |
| 2224 | vxlan_ftable_entry_init(sc, fe, cmd->vxlcmd_mac, &vxlsa.sa, |
| 2225 | VXLAN_FE_FLAG_STATIC); |
| 2226 | |
| 2227 | VXLAN_WLOCK(sc); |
| 2228 | error = vxlan_ftable_entry_insert(sc, fe); |
| 2229 | VXLAN_WUNLOCK(sc); |
| 2230 | |
| 2231 | if (error) |
| 2232 | vxlan_ftable_entry_free(fe); |
| 2233 | |
| 2234 | return (error); |
| 2235 | } |
| 2236 | |
| 2237 | static int |
| 2238 | vxlan_ctrl_ftable_entry_rem(struct vxlan_softc *sc, void *arg) |
nothing calls this directly
no test coverage detected