From 71233409ea6a2f4d751847c05e7aad9375278d94 Mon Sep 17 00:00:00 2001 From: bms Date: Mon, 9 Mar 2009 17:53:05 +0000 Subject: Merge IGMPv3 and Source-Specific Multicast (SSM) to the FreeBSD IPv4 stack. Diffs are minimized against p4. PCS has been used for some protocol verification, more widespread testing of recorded sources in Group-and-Source queries is needed. sizeof(struct igmpstat) has changed. __FreeBSD_version is bumped to 800070. --- sys/netinet/udp_usrreq.c | 69 +++++++++++------------------------------------- 1 file changed, 16 insertions(+), 53 deletions(-) (limited to 'sys/netinet/udp_usrreq.c') diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 804f5fe..33df73e 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -413,12 +413,6 @@ udp_input(struct mbuf *m, int off) if (inp->inp_faddr.s_addr != INADDR_ANY && inp->inp_faddr.s_addr != ip->ip_src.s_addr) continue; - /* - * XXX: Do not check source port of incoming datagram - * unless inp_connect() has been called to bind the - * fport part of the 4-tuple; the source could be - * trying to talk to us with an ephemeral port. - */ if (inp->inp_fport != 0 && inp->inp_fport != uh->uh_sport) continue; @@ -432,54 +426,23 @@ udp_input(struct mbuf *m, int off) imo = inp->inp_moptions; if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) && imo != NULL) { - struct sockaddr_in sin; - struct in_msource *ims; - int blocked, mode; - size_t idx; - - bzero(&sin, sizeof(struct sockaddr_in)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_addr = ip->ip_dst; - - blocked = 0; - idx = imo_match_group(imo, ifp, - (struct sockaddr *)&sin); - if (idx == -1) { - /* - * No group membership for this socket. - * Do not bump udps_noportbcast, as - * this will happen further down. - */ - blocked++; - } else { - /* - * Check for a multicast source filter - * entry on this socket for this group. - * MCAST_EXCLUDE is the default - * behaviour. It means default accept; - * entries, if present, denote sources - * to be excluded from delivery. - */ - ims = imo_match_source(imo, idx, - (struct sockaddr *)&udp_in); - mode = imo->imo_mfilters[idx].imf_fmode; - if ((ims != NULL && - mode == MCAST_EXCLUDE) || - (ims == NULL && - mode == MCAST_INCLUDE)) { -#ifdef DIAGNOSTIC - if (bootverbose) { - printf("%s: blocked by" - " source filter\n", - __func__); - } -#endif + struct sockaddr_in group; + int blocked; + + bzero(&group, sizeof(struct sockaddr_in)); + group.sin_len = sizeof(struct sockaddr_in); + group.sin_family = AF_INET; + group.sin_addr = ip->ip_dst; + + blocked = imo_multi_filter(imo, ifp, + (struct sockaddr *)&group, + (struct sockaddr *)&udp_in); + if (blocked != MCAST_PASS) { + if (blocked == MCAST_NOTGMEMBER) + V_ipstat.ips_notmember++; + if (blocked == MCAST_NOTSMEMBER || + blocked == MCAST_MUTED) V_udpstat.udps_filtermcast++; - blocked++; - } - } - if (blocked != 0) { INP_RUNLOCK(inp); continue; } -- cgit v1.1