in6_mcast.c (33cde13046eaba762428c55bb5d5e07c1a7c5f33) | in6_mcast.c (f6dfe47a145263dc5eb67fa4789925ab708709bc) |
---|---|
1/* 2 * Copyright (c) 2009 Bruce Simpson. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1288 unchanged lines hidden (view full) --- 1297 * SMPng: NOTE: Must take Giant as a join may create a new ifma. 1298 * 1299 * Return 0 if successful, otherwise return an appropriate error code. 1300 */ 1301static int 1302in6p_block_unblock_source(struct inpcb *inp, struct sockopt *sopt) 1303{ 1304 INIT_VNET_NET(curvnet); | 1/* 2 * Copyright (c) 2009 Bruce Simpson. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1288 unchanged lines hidden (view full) --- 1297 * SMPng: NOTE: Must take Giant as a join may create a new ifma. 1298 * 1299 * Return 0 if successful, otherwise return an appropriate error code. 1300 */ 1301static int 1302in6p_block_unblock_source(struct inpcb *inp, struct sockopt *sopt) 1303{ 1304 INIT_VNET_NET(curvnet); |
1305 INIT_VNET_INET6(curvnet); | |
1306 struct group_source_req gsr; 1307 sockunion_t *gsa, *ssa; 1308 struct ifnet *ifp; 1309 struct in6_mfilter *imf; 1310 struct ip6_moptions *imo; 1311 struct in6_msource *ims; 1312 struct in6_multi *inm; 1313 size_t idx; --- 144 unchanged lines hidden (view full) --- 1458 * an unlocked inpcb pointer, but will return it locked. May sleep. 1459 * 1460 * SMPng: NOTE: Potentially calls malloc(M_WAITOK) with Giant held. 1461 * SMPng: NOTE: Returns with the INP write lock held. 1462 */ 1463static struct ip6_moptions * 1464in6p_findmoptions(struct inpcb *inp) 1465{ | 1305 struct group_source_req gsr; 1306 sockunion_t *gsa, *ssa; 1307 struct ifnet *ifp; 1308 struct in6_mfilter *imf; 1309 struct ip6_moptions *imo; 1310 struct in6_msource *ims; 1311 struct in6_multi *inm; 1312 size_t idx; --- 144 unchanged lines hidden (view full) --- 1457 * an unlocked inpcb pointer, but will return it locked. May sleep. 1458 * 1459 * SMPng: NOTE: Potentially calls malloc(M_WAITOK) with Giant held. 1460 * SMPng: NOTE: Returns with the INP write lock held. 1461 */ 1462static struct ip6_moptions * 1463in6p_findmoptions(struct inpcb *inp) 1464{ |
1465 INIT_VNET_INET6(curvnet); |
|
1466 struct ip6_moptions *imo; 1467 struct in6_multi **immp; 1468 struct in6_mfilter *imfp; 1469 size_t idx; 1470 1471 INP_WLOCK(inp); 1472 if (inp->in6p_moptions != NULL) 1473 return (inp->in6p_moptions); --- 266 unchanged lines hidden (view full) --- 1740 * FUTURE: Support multiple forwarding tables for IPv6. 1741 * 1742 * Returns NULL if no ifp could be found. 1743 */ 1744static struct ifnet * 1745in6p_lookup_mcast_ifp(const struct inpcb *in6p __unused, 1746 const struct sockaddr_in6 *gsin6) 1747{ | 1466 struct ip6_moptions *imo; 1467 struct in6_multi **immp; 1468 struct in6_mfilter *imfp; 1469 size_t idx; 1470 1471 INP_WLOCK(inp); 1472 if (inp->in6p_moptions != NULL) 1473 return (inp->in6p_moptions); --- 266 unchanged lines hidden (view full) --- 1740 * FUTURE: Support multiple forwarding tables for IPv6. 1741 * 1742 * Returns NULL if no ifp could be found. 1743 */ 1744static struct ifnet * 1745in6p_lookup_mcast_ifp(const struct inpcb *in6p __unused, 1746 const struct sockaddr_in6 *gsin6) 1747{ |
1748 INIT_VNET_INET6(curvnet); | |
1749 struct route_in6 ro6; 1750 struct ifnet *ifp; 1751 1752 KASSERT(in6p->inp_vflag & INP_IPV6, 1753 ("%s: not INP_IPV6 inpcb", __func__)); 1754 KASSERT(gsin6->sin6_family == AF_INET6, 1755 ("%s: not AF_INET6 group", __func__)); 1756 KASSERT(IN6_IS_ADDR_MULTICAST(&gsin6->sin6_addr), --- 270 unchanged lines hidden (view full) --- 2027 2028/* 2029 * Leave an IPv6 multicast group on an inpcb, possibly with a source. 2030 */ 2031static int 2032in6p_leave_group(struct inpcb *inp, struct sockopt *sopt) 2033{ 2034 INIT_VNET_NET(curvnet); | 1748 struct route_in6 ro6; 1749 struct ifnet *ifp; 1750 1751 KASSERT(in6p->inp_vflag & INP_IPV6, 1752 ("%s: not INP_IPV6 inpcb", __func__)); 1753 KASSERT(gsin6->sin6_family == AF_INET6, 1754 ("%s: not AF_INET6 group", __func__)); 1755 KASSERT(IN6_IS_ADDR_MULTICAST(&gsin6->sin6_addr), --- 270 unchanged lines hidden (view full) --- 2026 2027/* 2028 * Leave an IPv6 multicast group on an inpcb, possibly with a source. 2029 */ 2030static int 2031in6p_leave_group(struct inpcb *inp, struct sockopt *sopt) 2032{ 2033 INIT_VNET_NET(curvnet); |
2035 INIT_VNET_INET(curvnet); | |
2036 struct group_source_req gsr; 2037 sockunion_t *gsa, *ssa; 2038 struct ifnet *ifp; 2039 struct in6_mfilter *imf; 2040 struct ip6_moptions *imo; 2041 struct in6_msource *ims; 2042 struct in6_multi *inm; 2043 size_t idx; --- 200 unchanged lines hidden (view full) --- 2244 * may be passed to this socket option. An address of in6addr_any or an 2245 * interface index of 0 is used to remove a previous selection. 2246 * When no interface is selected, one is chosen for every send. 2247 */ 2248static int 2249in6p_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) 2250{ 2251 INIT_VNET_NET(curvnet); | 2034 struct group_source_req gsr; 2035 sockunion_t *gsa, *ssa; 2036 struct ifnet *ifp; 2037 struct in6_mfilter *imf; 2038 struct ip6_moptions *imo; 2039 struct in6_msource *ims; 2040 struct in6_multi *inm; 2041 size_t idx; --- 200 unchanged lines hidden (view full) --- 2242 * may be passed to this socket option. An address of in6addr_any or an 2243 * interface index of 0 is used to remove a previous selection. 2244 * When no interface is selected, one is chosen for every send. 2245 */ 2246static int 2247in6p_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) 2248{ 2249 INIT_VNET_NET(curvnet); |
2252 INIT_VNET_INET6(curvnet); | |
2253 struct ifnet *ifp; 2254 struct ip6_moptions *imo; 2255 u_int ifindex; 2256 int error; 2257 2258 if (sopt->sopt_valsize != sizeof(u_int)) 2259 return (EINVAL); 2260 --- 188 unchanged lines hidden (view full) --- 2449 * of the IPv6 multicast part of the BSD Sockets API must be preserved; 2450 * the effects of these options must be treated as separate and distinct. 2451 * 2452 * SMPng: XXX: Unlocked read of inp_socket believed OK. 2453 */ 2454int 2455ip6_setmoptions(struct inpcb *inp, struct sockopt *sopt) 2456{ | 2250 struct ifnet *ifp; 2251 struct ip6_moptions *imo; 2252 u_int ifindex; 2253 int error; 2254 2255 if (sopt->sopt_valsize != sizeof(u_int)) 2256 return (EINVAL); 2257 --- 188 unchanged lines hidden (view full) --- 2446 * of the IPv6 multicast part of the BSD Sockets API must be preserved; 2447 * the effects of these options must be treated as separate and distinct. 2448 * 2449 * SMPng: XXX: Unlocked read of inp_socket believed OK. 2450 */ 2451int 2452ip6_setmoptions(struct inpcb *inp, struct sockopt *sopt) 2453{ |
2454 INIT_VNET_INET6(curvnet); |
|
2457 struct ip6_moptions *im6o; 2458 int error; 2459 2460 error = 0; 2461 2462 /* 2463 * If socket is neither of type SOCK_RAW or SOCK_DGRAM, 2464 * or is a divert socket, reject it. --- 270 unchanged lines hidden --- | 2455 struct ip6_moptions *im6o; 2456 int error; 2457 2458 error = 0; 2459 2460 /* 2461 * If socket is neither of type SOCK_RAW or SOCK_DGRAM, 2462 * or is a divert socket, reject it. --- 270 unchanged lines hidden --- |