From ffd77d9ba5a1376d64ccbb2909a7179c05de81bc Mon Sep 17 00:00:00 2001 From: bms Date: Tue, 12 Jun 2007 16:24:56 +0000 Subject: Import rewrite of IPv4 socket multicast layer to support source-specific and protocol-independent host mode multicast. The code is written to accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work. This change only pertains to FreeBSD's use as a multicast end-station and does not concern multicast routing; for an IGMPv3/MLDv2 router implementation, consider the XORP project. The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6, which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html Summary * IPv4 multicast socket processing is now moved out of ip_output.c into a new module, in_mcast.c. * The in_mcast.c module implements the IPv4 legacy any-source API in terms of the protocol-independent source-specific API. * Source filters are lazy allocated as the common case does not use them. They are part of per inpcb state and are covered by the inpcb lock. * struct ip_mreqn is now supported to allow applications to specify multicast joins by interface index in the legacy IPv4 any-source API. * In UDP, an incoming multicast datagram only requires that the source port matches the 4-tuple if the socket was already bound by source port. An unbound socket SHOULD be able to receive multicasts sent from an ephemeral source port. * The UDP socket multicast filter mode defaults to exclusive, that is, sources present in the per-socket list will be blocked from delivery. * The RFC 3678 userland functions have been added to libc: setsourcefilter, getsourcefilter, setipv4sourcefilter, getipv4sourcefilter. * Definitions for IGMPv3 are merged but not yet used. * struct sockaddr_storage is now referenced from . It is therefore defined there if not already declared in the same way as for the C99 types. * The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF which are then interpreted as interface indexes) is now deprecated. * A patch for the Rhyolite.com routed in the FreeBSD base system is available in the -net archives. This only affects individuals running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces. * Make IPv6 detach path similar to IPv4's in code flow; functionally same. * Bump __FreeBSD_version to 700048; see UPDATING. This work was financially supported by another FreeBSD committer. Obtained from: p4://bms_netdev Submitted by: Wilbert de Graaf (original work) Reviewed by: rwatson (locking), silence from fenner, net@ (but with encouragement) --- lib/libc/net/Makefile.inc | 5 ++++- lib/libc/net/Symbol.map | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index 3592f50..23c1c9d 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -14,7 +14,7 @@ SRCS+= base64.c ether_addr.c eui64.c \ ip6opt.c linkaddr.c map_v4v6.c name6.c ntoh.c \ nsdispatch.c nslexer.c nsparser.c nss_compat.c \ rcmd.c rcmdsh.c recv.c rthdr.c sctp_sys_calls.c send.c \ - sockatmark.c vars.c + sockatmark.c sourcefilter.c vars.c .if ${MK_NS_CACHING} != "no" SRCS+= nscache.c nscachedcli.c @@ -52,6 +52,7 @@ MAN+= byteorder.3 ethers.3 eui64.3 \ inet6_opt_init.3 inet6_option_space.3 inet6_rth_space.3 \ inet6_rthdr_space.3 linkaddr.3 \ nsdispatch.3 rcmd.3 rcmdsh.3 resolver.3 sockatmark.3 \ + setsourcefilter.3 \ sctp_bindx.3 sctp_connectx.3 sctp_freepaddrs.3 \ sctp_getaddrlen.3 sctp_getassocid.3 sctp_getpaddrs.3 \ sctp_opt_info.3 sctp_recvmsg.3 sctp_send.3 sctp_sendmsg.3 \ @@ -121,6 +122,8 @@ MLINKS+=resolver.3 dn_comp.3 resolver.3 dn_expand.3 resolver.3 res_init.3 \ resolver.3 res_search.3 resolver.3 res_send.3 resolver.3 dn_skipname.3 \ resolver.3 ns_get16.3 resolver.3 ns_get32.3 \ resolver.3 ns_put16.3 resolver.3 ns_put32.3 +MLINKS+=sourcefilter.3 setipv4sourcefilter.3 getipv4sourcefilter.3 \ + sourcefilter.3 setsourcefilter.3 getsourcefilter.3 .if ${MK_HESIOD} != "no" SRCS+= hesiod.c diff --git a/lib/libc/net/Symbol.map b/lib/libc/net/Symbol.map index 7fb0f3b..de44cc5 100644 --- a/lib/libc/net/Symbol.map +++ b/lib/libc/net/Symbol.map @@ -137,6 +137,10 @@ FBSD_1.0 { sctp_send; sctp_sendx; sctp_recvmsg; + setipv4sourcefilter; + getipv4sourcefilter; + getsourcefilter; + setsourcefilter; }; FBSDprivate_1.0 { -- cgit v1.1