summaryrefslogtreecommitdiffstats
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2009-03-09 17:53:05 +0000
committerbms <bms@FreeBSD.org>2009-03-09 17:53:05 +0000
commit71233409ea6a2f4d751847c05e7aad9375278d94 (patch)
tree3d95180b6661648cd67dba62e6daefc7c8661793 /sys/netinet/udp_usrreq.c
parent2173e9258f5b3400a58f42bd91fd01c1efc4441d (diff)
downloadFreeBSD-src-71233409ea6a2f4d751847c05e7aad9375278d94.zip
FreeBSD-src-71233409ea6a2f4d751847c05e7aad9375278d94.tar.gz
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.
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c69
1 files changed, 16 insertions, 53 deletions
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;
}
OpenPOWER on IntegriCloud