in_mcast.c (197132) | in_mcast.c (197135) |
---|---|
1/*- 2 * Copyright (c) 2007-2009 Bruce Simpson. 3 * Copyright (c) 2005 Robert N. M. Watson. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28 * SUCH DAMAGE. 29 */ 30 31/* 32 * IPv4 multicast socket, group, and socket option processing module. 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007-2009 Bruce Simpson. 3 * Copyright (c) 2005 Robert N. M. Watson. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28 * SUCH DAMAGE. 29 */ 30 31/* 32 * IPv4 multicast socket, group, and socket option processing module. 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/netinet/in_mcast.c 197132 2009-09-12 19:45:55Z bms $"); | 36__FBSDID("$FreeBSD: head/sys/netinet/in_mcast.c 197135 2009-09-12 20:18:23Z bms $"); |
37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/malloc.h> 42#include <sys/mbuf.h> 43#include <sys/protosw.h> 44#include <sys/socket.h> --- 1932 unchanged lines hidden (view full) --- 1977 /* Throw out duplicates. */ 1978 lims = imo_match_source(imo, idx, &ssa->sa); 1979 if (lims != NULL) { 1980 error = EADDRNOTAVAIL; 1981 goto out_inp_locked; 1982 } 1983 } else { 1984 /* | 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/malloc.h> 42#include <sys/mbuf.h> 43#include <sys/protosw.h> 44#include <sys/socket.h> --- 1932 unchanged lines hidden (view full) --- 1977 /* Throw out duplicates. */ 1978 lims = imo_match_source(imo, idx, &ssa->sa); 1979 if (lims != NULL) { 1980 error = EADDRNOTAVAIL; 1981 goto out_inp_locked; 1982 } 1983 } else { 1984 /* |
1985 * MCAST_JOIN_GROUP on an existing inclusive 1986 * membership is an error; if you want to change 1987 * filter mode, you must use the userland API 1988 * setsourcefilter(). | 1985 * MCAST_JOIN_GROUP alone, on any existing membership, 1986 * is rejected, to stop the same inpcb tying up 1987 * multiple refs to the in_multi. 1988 * On an existing inclusive membership, this is also 1989 * an error; if you want to change filter mode, 1990 * you must use the userland API setsourcefilter(). 1991 * XXX We don't reject this for imf in UNDEFINED 1992 * state at t1, because allocation of a filter 1993 * is atomic with allocation of a membership. |
1989 */ | 1994 */ |
1990 if (imf->imf_st[1] == MCAST_INCLUDE) { 1991 error = EINVAL; 1992 goto out_inp_locked; 1993 } | 1995 error = EINVAL; 1996 goto out_inp_locked; |
1994 } 1995 } 1996 1997 /* 1998 * Begin state merge transaction at socket layer. 1999 */ 2000 INP_WLOCK_ASSERT(inp); 2001 --- 18 unchanged lines hidden (view full) --- 2020 ("%s: imf_sources not empty", __func__)); 2021 } 2022 2023 /* 2024 * Graft new source into filter list for this inpcb's 2025 * membership of the group. The in_multi may not have 2026 * been allocated yet if this is a new membership, however, 2027 * the in_mfilter slot will be allocated and must be initialized. | 1997 } 1998 } 1999 2000 /* 2001 * Begin state merge transaction at socket layer. 2002 */ 2003 INP_WLOCK_ASSERT(inp); 2004 --- 18 unchanged lines hidden (view full) --- 2023 ("%s: imf_sources not empty", __func__)); 2024 } 2025 2026 /* 2027 * Graft new source into filter list for this inpcb's 2028 * membership of the group. The in_multi may not have 2029 * been allocated yet if this is a new membership, however, 2030 * the in_mfilter slot will be allocated and must be initialized. |
2031 * 2032 * Note: Grafting of exclusive mode filters doesn't happen 2033 * in this path. |
|
2028 */ 2029 if (ssa->ss.ss_family != AF_UNSPEC) { 2030 /* Membership starts in IN mode */ 2031 if (is_new) { 2032 CTR1(KTR_IGMPV3, "%s: new join w/source", __func__); 2033 imf_init(imf, MCAST_UNDEFINED, MCAST_INCLUDE); 2034 } else { 2035 CTR2(KTR_IGMPV3, "%s: %s source", __func__, "allow"); --- 847 unchanged lines hidden --- | 2034 */ 2035 if (ssa->ss.ss_family != AF_UNSPEC) { 2036 /* Membership starts in IN mode */ 2037 if (is_new) { 2038 CTR1(KTR_IGMPV3, "%s: new join w/source", __func__); 2039 imf_init(imf, MCAST_UNDEFINED, MCAST_INCLUDE); 2040 } else { 2041 CTR2(KTR_IGMPV3, "%s: %s source", __func__, "allow"); --- 847 unchanged lines hidden --- |