aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/igmp.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 00:00:52 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:42 -0500
commit78fbfd8a653ca972afe479517a40661bfff6d8c3 (patch)
tree9dccc5c16bf269d53d8499064ec95a998e84c646 /net/ipv4/igmp.c
parent1561747ddf9d28185548687b11aae7074d6129c4 (diff)
ipv4: Create and use route lookup helpers.
The idea here is this minimizes the number of places one has to edit in order to make changes to how flows are defined and used. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/igmp.c')
-rw-r--r--net/ipv4/igmp.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 12b65ccca8e9..1fd3d9ce8398 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -321,15 +321,12 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
321 } 321 }
322 igmp_skb_size(skb) = size; 322 igmp_skb_size(skb) = size;
323 323
324 { 324 rt = ip_route_output_ports(net, NULL, IGMPV3_ALL_MCR, 0,
325 struct flowi fl = { .oif = dev->ifindex, 325 0, 0,
326 .fl4_dst = IGMPV3_ALL_MCR, 326 IPPROTO_IGMP, 0, dev->ifindex);
327 .proto = IPPROTO_IGMP }; 327 if (IS_ERR(rt)) {
328 rt = ip_route_output_key(net, &fl); 328 kfree_skb(skb);
329 if (IS_ERR(rt)) { 329 return NULL;
330 kfree_skb(skb);
331 return NULL;
332 }
333 } 330 }
334 if (rt->rt_src == 0) { 331 if (rt->rt_src == 0) {
335 kfree_skb(skb); 332 kfree_skb(skb);
@@ -667,14 +664,12 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
667 else 664 else
668 dst = group; 665 dst = group;
669 666
670 { 667 rt = ip_route_output_ports(net, NULL, dst, 0,
671 struct flowi fl = { .oif = dev->ifindex, 668 0, 0,
672 .fl4_dst = dst, 669 IPPROTO_IGMP, 0, dev->ifindex);
673 .proto = IPPROTO_IGMP }; 670 if (IS_ERR(rt))
674 rt = ip_route_output_key(net, &fl); 671 return -1;
675 if (IS_ERR(rt)) 672
676 return -1;
677 }
678 if (rt->rt_src == 0) { 673 if (rt->rt_src == 0) {
679 ip_rt_put(rt); 674 ip_rt_put(rt);
680 return -1; 675 return -1;
@@ -1441,7 +1436,6 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
1441/* RTNL is locked */ 1436/* RTNL is locked */
1442static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr) 1437static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
1443{ 1438{
1444 struct flowi fl = { .fl4_dst = imr->imr_multiaddr.s_addr };
1445 struct net_device *dev = NULL; 1439 struct net_device *dev = NULL;
1446 struct in_device *idev = NULL; 1440 struct in_device *idev = NULL;
1447 1441
@@ -1456,7 +1450,9 @@ static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
1456 } 1450 }
1457 1451
1458 if (!dev) { 1452 if (!dev) {
1459 struct rtable *rt = ip_route_output_key(net, &fl); 1453 struct rtable *rt = ip_route_output(net,
1454 imr->imr_multiaddr.s_addr,
1455 0, 0, 0);
1460 if (!IS_ERR(rt)) { 1456 if (!IS_ERR(rt)) {
1461 dev = rt->dst.dev; 1457 dev = rt->dst.dev;
1462 ip_rt_put(rt); 1458 ip_rt_put(rt);