igmp.c (866f3b25a2eb60d7529c227a0ecd80c3aba443fd) igmp.c (57e1ab6eaddc9f2c358cd4afb497cda6e3c6821a)
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

--- 286 unchanged lines hidden (view full) ---

295 for (psf=pmc->sources; psf; psf=psf->sf_next) {
296 if (!is_in(pmc, psf, type, gdeleted, sdeleted))
297 continue;
298 scount++;
299 }
300 return scount;
301}
302
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

--- 286 unchanged lines hidden (view full) ---

295 for (psf=pmc->sources; psf; psf=psf->sf_next) {
296 if (!is_in(pmc, psf, type, gdeleted, sdeleted))
297 continue;
298 scount++;
299 }
300 return scount;
301}
302
303#define igmp_skb_size(skb) (*(unsigned int *)((skb)->cb))
304
303static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
304{
305 struct sk_buff *skb;
306 struct rtable *rt;
307 struct iphdr *pip;
308 struct igmpv3_report *pig;
309 struct net *net = dev_net(dev);
310
305static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
306{
307 struct sk_buff *skb;
308 struct rtable *rt;
309 struct iphdr *pip;
310 struct igmpv3_report *pig;
311 struct net *net = dev_net(dev);
312
311 skb = alloc_skb(size + LL_ALLOCATED_SPACE(dev), GFP_ATOMIC);
312 if (skb == NULL)
313 return NULL;
313 while (1) {
314 skb = alloc_skb(size + LL_ALLOCATED_SPACE(dev),
315 GFP_ATOMIC | __GFP_NOWARN);
316 if (skb)
317 break;
318 size >>= 1;
319 if (size < 256)
320 return NULL;
321 }
322 igmp_skb_size(skb) = size;
314
315 {
316 struct flowi fl = { .oif = dev->ifindex,
317 .fl4_dst = IGMPV3_ALL_MCR,
318 .proto = IPPROTO_IGMP };
319 if (ip_route_output_key(net, &rt, &fl)) {
320 kfree_skb(skb);
321 return NULL;

--- 72 unchanged lines hidden (view full) ---

394 pgr->grec_nsrcs = 0;
395 pgr->grec_mca = pmc->multiaddr;
396 pih = igmpv3_report_hdr(skb);
397 pih->ngrec = htons(ntohs(pih->ngrec)+1);
398 *ppgr = pgr;
399 return skb;
400}
401
323
324 {
325 struct flowi fl = { .oif = dev->ifindex,
326 .fl4_dst = IGMPV3_ALL_MCR,
327 .proto = IPPROTO_IGMP };
328 if (ip_route_output_key(net, &rt, &fl)) {
329 kfree_skb(skb);
330 return NULL;

--- 72 unchanged lines hidden (view full) ---

403 pgr->grec_nsrcs = 0;
404 pgr->grec_mca = pmc->multiaddr;
405 pih = igmpv3_report_hdr(skb);
406 pih->ngrec = htons(ntohs(pih->ngrec)+1);
407 *ppgr = pgr;
408 return skb;
409}
410
402#define AVAILABLE(skb) ((skb) ? ((skb)->dev ? (skb)->dev->mtu - (skb)->len : \
411#define AVAILABLE(skb) ((skb) ? ((skb)->dev ? igmp_skb_size(skb) - (skb)->len : \
403 skb_tailroom(skb)) : 0)
404
405static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
406 int type, int gdeleted, int sdeleted)
407{
408 struct net_device *dev = pmc->interface->dev;
409 struct igmpv3_report *pih;
410 struct igmpv3_grec *pgr = NULL;

--- 2269 unchanged lines hidden ---
412 skb_tailroom(skb)) : 0)
413
414static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
415 int type, int gdeleted, int sdeleted)
416{
417 struct net_device *dev = pmc->interface->dev;
418 struct igmpv3_report *pih;
419 struct igmpv3_grec *pgr = NULL;

--- 2269 unchanged lines hidden ---