igmp.c (d8a382d2662822248a97ce9d670b90e68aefbd3a) | igmp.c (9a57a9d291980302b4a3184fbc47dbddac71903e) |
---|---|
1/* 2 * Linux NET3: Internet Group Management Protocol [IGMP] 3 * 4 * This code implements the IGMP protocol as defined in RFC1112. There has 5 * been a further revision of this protocol since which is now supported. 6 * 7 * If you have trouble with this module be careful what gcc you have used, 8 * the older version didn't come out right using gcc 2.5.8, the newer one --- 902 unchanged lines hidden (view full) --- 911 igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); 912 spin_unlock_bh(&im->lock); 913 if (changed) 914 igmp_mod_timer(im, max_delay); 915 } 916 read_unlock(&in_dev->mc_list_lock); 917} 918 | 1/* 2 * Linux NET3: Internet Group Management Protocol [IGMP] 3 * 4 * This code implements the IGMP protocol as defined in RFC1112. There has 5 * been a further revision of this protocol since which is now supported. 6 * 7 * If you have trouble with this module be careful what gcc you have used, 8 * the older version didn't come out right using gcc 2.5.8, the newer one --- 902 unchanged lines hidden (view full) --- 911 igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); 912 spin_unlock_bh(&im->lock); 913 if (changed) 914 igmp_mod_timer(im, max_delay); 915 } 916 read_unlock(&in_dev->mc_list_lock); 917} 918 |
919/* called in rcu_read_lock() section */ |
|
919int igmp_rcv(struct sk_buff *skb) 920{ 921 /* This basically follows the spec line by line -- see RFC1112 */ 922 struct igmphdr *ih; | 920int igmp_rcv(struct sk_buff *skb) 921{ 922 /* This basically follows the spec line by line -- see RFC1112 */ 923 struct igmphdr *ih; |
923 struct in_device *in_dev = in_dev_get(skb->dev); | 924 struct in_device *in_dev = __in_dev_get_rcu(skb->dev); |
924 int len = skb->len; 925 926 if (in_dev == NULL) 927 goto drop; 928 929 if (!pskb_may_pull(skb, sizeof(struct igmphdr))) | 925 int len = skb->len; 926 927 if (in_dev == NULL) 928 goto drop; 929 930 if (!pskb_may_pull(skb, sizeof(struct igmphdr))) |
930 goto drop_ref; | 931 goto drop; |
931 932 switch (skb->ip_summed) { 933 case CHECKSUM_COMPLETE: 934 if (!csum_fold(skb->csum)) 935 break; 936 /* fall through */ 937 case CHECKSUM_NONE: 938 skb->csum = 0; 939 if (__skb_checksum_complete(skb)) | 932 933 switch (skb->ip_summed) { 934 case CHECKSUM_COMPLETE: 935 if (!csum_fold(skb->csum)) 936 break; 937 /* fall through */ 938 case CHECKSUM_NONE: 939 skb->csum = 0; 940 if (__skb_checksum_complete(skb)) |
940 goto drop_ref; | 941 goto drop; |
941 } 942 943 ih = igmp_hdr(skb); 944 switch (ih->type) { 945 case IGMP_HOST_MEMBERSHIP_QUERY: 946 igmp_heard_query(in_dev, skb, len); 947 break; 948 case IGMP_HOST_MEMBERSHIP_REPORT: 949 case IGMPV2_HOST_MEMBERSHIP_REPORT: 950 /* Is it our report looped back? */ 951 if (skb_rtable(skb)->fl.iif == 0) 952 break; 953 /* don't rely on MC router hearing unicast reports */ 954 if (skb->pkt_type == PACKET_MULTICAST || 955 skb->pkt_type == PACKET_BROADCAST) 956 igmp_heard_report(in_dev, ih->group); 957 break; 958 case IGMP_PIM: 959#ifdef CONFIG_IP_PIMSM_V1 | 942 } 943 944 ih = igmp_hdr(skb); 945 switch (ih->type) { 946 case IGMP_HOST_MEMBERSHIP_QUERY: 947 igmp_heard_query(in_dev, skb, len); 948 break; 949 case IGMP_HOST_MEMBERSHIP_REPORT: 950 case IGMPV2_HOST_MEMBERSHIP_REPORT: 951 /* Is it our report looped back? */ 952 if (skb_rtable(skb)->fl.iif == 0) 953 break; 954 /* don't rely on MC router hearing unicast reports */ 955 if (skb->pkt_type == PACKET_MULTICAST || 956 skb->pkt_type == PACKET_BROADCAST) 957 igmp_heard_report(in_dev, ih->group); 958 break; 959 case IGMP_PIM: 960#ifdef CONFIG_IP_PIMSM_V1 |
960 in_dev_put(in_dev); | |
961 return pim_rcv_v1(skb); 962#endif 963 case IGMPV3_HOST_MEMBERSHIP_REPORT: 964 case IGMP_DVMRP: 965 case IGMP_TRACE: 966 case IGMP_HOST_LEAVE_MESSAGE: 967 case IGMP_MTRACE: 968 case IGMP_MTRACE_RESP: 969 break; 970 default: 971 break; 972 } 973 | 961 return pim_rcv_v1(skb); 962#endif 963 case IGMPV3_HOST_MEMBERSHIP_REPORT: 964 case IGMP_DVMRP: 965 case IGMP_TRACE: 966 case IGMP_HOST_LEAVE_MESSAGE: 967 case IGMP_MTRACE: 968 case IGMP_MTRACE_RESP: 969 break; 970 default: 971 break; 972 } 973 |
974drop_ref: 975 in_dev_put(in_dev); | |
976drop: 977 kfree_skb(skb); 978 return 0; 979} 980 981#endif 982 983 --- 657 unchanged lines hidden (view full) --- 1641 /* 1642 * add or update "delete" records if an active filter 1643 * is now inactive 1644 */ 1645 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) 1646 if (dpsf->sf_inaddr == psf->sf_inaddr) 1647 break; 1648 if (!dpsf) { | 974drop: 975 kfree_skb(skb); 976 return 0; 977} 978 979#endif 980 981 --- 657 unchanged lines hidden (view full) --- 1639 /* 1640 * add or update "delete" records if an active filter 1641 * is now inactive 1642 */ 1643 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) 1644 if (dpsf->sf_inaddr == psf->sf_inaddr) 1645 break; 1646 if (!dpsf) { |
1649 dpsf = (struct ip_sf_list *) 1650 kmalloc(sizeof(*dpsf), GFP_ATOMIC); | 1647 dpsf = kmalloc(sizeof(*dpsf), GFP_ATOMIC); |
1651 if (!dpsf) 1652 continue; 1653 *dpsf = *psf; 1654 /* pmc->lock held by callers */ 1655 dpsf->sf_next = pmc->tomb; 1656 pmc->tomb = dpsf; 1657 } 1658 dpsf->sf_crcount = qrv; --- 1028 unchanged lines hidden --- | 1648 if (!dpsf) 1649 continue; 1650 *dpsf = *psf; 1651 /* pmc->lock held by callers */ 1652 dpsf->sf_next = pmc->tomb; 1653 pmc->tomb = dpsf; 1654 } 1655 dpsf->sf_crcount = qrv; --- 1028 unchanged lines hidden --- |