Netdev List
 help / color / mirror / Atom feed
* [PATCH] [IPV6] remove unused parameter (struct sock parameter) from ip6_route_output()
@ 2008-03-18  9:03 Rami Rosen
  2008-03-18  9:15 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 2+ messages in thread
From: Rami Rosen @ 2008-03-18  9:03 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, yoshfuji, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

Hi,
This patch removes the struct sock parameter from ip6_route_output();
looking at the ip6_route_output() implementation in net/ipv6/route.c
will show immediately that it is not used in this method.

In fact, icmp.c and ip6_output.c are the only places in the kernel
where the sk (struct sock) parameter passed to ip6_route_output() is not NULL;
anyhow, as explained above, this parameter is unused; changing
the ip6_route_output() prototype by omitting the struct sock parameter
does not break anything.


Regards,
Rami Rosen


Signed-off-by: Rami Rosen <ramirose@gmail.com>

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 5991 bytes --]

diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 0e2895c..781923a 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -44,7 +44,6 @@ extern struct rt6_info	*ip6_blk_hole_entry;
 extern void			ip6_route_input(struct sk_buff *skb);
 
 extern struct dst_entry *	ip6_route_output(struct net *net,
-						 struct sock *sk,
 						 struct flowi *fl);
 
 extern int			ip6_route_init(void);
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 6b5391a..16f8ea2 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -179,7 +179,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
 	 * XXX: perhaps the expire for routing entries cloned by
 	 * this lookup should be more aggressive (not longer than timeout).
 	 */
-	dst = ip6_route_output(net, sk, fl);
+	dst = ip6_route_output(net, fl);
 	if (dst->error) {
 		IP6_INC_STATS(ip6_dst_idev(dst),
 			      IPSTATS_MIB_OUTNOROUTES);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 98762fd..62c5e87 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -915,7 +915,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
 	struct net *net = sk->sk_net;
 
 	if (*dst == NULL)
-		*dst = ip6_route_output(net, sk, fl);
+		*dst = ip6_route_output(net, fl);
 
 	if ((err = (*dst)->error))
 		goto out_err_release;
@@ -956,7 +956,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
 				dst_release(*dst);
 				memcpy(&fl_gw, fl, sizeof(struct flowi));
 				memset(&fl_gw.fl6_dst, 0, sizeof(struct in6_addr));
-				*dst = ip6_route_output(net, sk, &fl_gw);
+				*dst = ip6_route_output(net, &fl_gw);
 				if ((err = (*dst)->error))
 					goto out_err_release;
 			}
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 61517fe..afaf9fe 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -847,7 +847,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
 	if ((dst = ip6_tnl_dst_check(t)) != NULL)
 		dst_hold(dst);
 	else {
-		dst = ip6_route_output(&init_net, NULL, fl);
+		dst = ip6_route_output(&init_net, fl);
 
 		if (dst->error || xfrm_lookup(&dst, fl, NULL, 0) < 0)
 			goto tx_err_link_failure;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 24e76ed..79fb551 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1427,7 +1427,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
 	icmpv6_flow_init(sk, &fl, NDISC_REDIRECT,
 			 &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex);
 
-	dst = ip6_route_output(net, NULL, &fl);
+	dst = ip6_route_output(net, &fl);
 	if (dst == NULL)
 		return;
 
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index aed51bc..221fbc8 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -23,7 +23,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
 		    .saddr = iph->saddr, } },
 	};
 
-	dst = ip6_route_output(&init_net, skb->sk, &fl);
+	dst = ip6_route_output(&init_net, &fl);
 
 #ifdef CONFIG_XFRM
 	if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
@@ -86,7 +86,7 @@ static int nf_ip6_reroute(struct sk_buff *skb,
 
 static int nf_ip6_route(struct dst_entry **dst, struct flowi *fl)
 {
-	*dst = ip6_route_output(&init_net, NULL, fl);
+	*dst = ip6_route_output(&init_net, fl);
 	return (*dst)->error;
 }
 
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index baf8290..f958faf 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -93,7 +93,7 @@ static void send_reset(struct sk_buff *oldskb)
 	fl.fl_ip_sport = otcph.dest;
 	fl.fl_ip_dport = otcph.source;
 	security_skb_classify_flow(oldskb, &fl);
-	dst = ip6_route_output(&init_net, NULL, &fl);
+	dst = ip6_route_output(&init_net, &fl);
 	if (dst == NULL)
 		return;
 	if (dst->error || xfrm_lookup(&dst, &fl, NULL, 0))
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index a4b5aee..6fcc164 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -772,8 +772,7 @@ static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table
 	return ip6_pol_route(net, table, fl->oif, fl, flags);
 }
 
-struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
-				    struct flowi *fl)
+struct dst_entry * ip6_route_output(struct net *net,struct flowi *fl)
 {
 	int flags = 0;
 
@@ -2261,7 +2260,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
 	skb_reset_mac_header(skb);
 	skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr));
 
-	rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl);
+	rt = (struct rt6_info*) ip6_route_output(net, &fl);
 	skb->dst = &rt->u.dst;
 
 	err = rt6_fill_node(skb, rt, &fl.fl6_dst, &fl.fl6_src, iif,
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 1b8196c..1b86940 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -393,7 +393,7 @@ isatap_srcok(struct sk_buff *skb, struct iphdr *iph, struct net_device *dev)
 	fl.oif = dev->ifindex;
 	security_skb_classify_flow(skb, &fl);
 
-	dst = ip6_route_output(&init_net, NULL, &fl);
+	dst = ip6_route_output(&init_net, &fl);
 	if (!dst->error && (dst->dev == dev) && (neigh = dst->neighbour)) {
 
 		addr6 = (struct in6_addr*)&neigh->primary_key;
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index e96dafd..8ef4821 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -38,7 +38,7 @@ static struct dst_entry *xfrm6_dst_lookup(int tos, xfrm_address_t *saddr,
 	if (saddr)
 		memcpy(&fl.fl6_src, saddr, sizeof(fl.fl6_src));
 
-	dst = ip6_route_output(&init_net, NULL, &fl);
+	dst = ip6_route_output(&init_net, &fl);
 
 	err = dst->error;
 	if (dst->error) {
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 1937be5..61fbcf6 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -259,7 +259,7 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
 			NIP6(fl.fl6_src));
 	}
 
-	dst = ip6_route_output(&init_net, NULL, &fl);
+	dst = ip6_route_output(&init_net, &fl);
 	if (!dst->error) {
 		struct rt6_info *rt;
 		rt = (struct rt6_info *)dst;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [IPV6] remove unused parameter (struct sock parameter) from ip6_route_output()
  2008-03-18  9:03 [PATCH] [IPV6] remove unused parameter (struct sock parameter) from ip6_route_output() Rami Rosen
@ 2008-03-18  9:15 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 0 replies; 2+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-03-18  9:15 UTC (permalink / raw)
  To: ramirose, davem; +Cc: netdev, linux-kernel, yoshfuji

NAK; I have a plan to use it in net-2.6.26 tree.

--yoshfuji

In article <eb3ff54b0803180203h18cda4ceja6ae28033638d338@mail.gmail.com> (at Tue, 18 Mar 2008 11:03:04 +0200), "Rami Rosen" <ramirose@gmail.com> says:

> Hi,
> This patch removes the struct sock parameter from ip6_route_output();
> looking at the ip6_route_output() implementation in net/ipv6/route.c
> will show immediately that it is not used in this method.
> 
> In fact, icmp.c and ip6_output.c are the only places in the kernel
> where the sk (struct sock) parameter passed to ip6_route_output() is not NULL;
> anyhow, as explained above, this parameter is unused; changing
> the ip6_route_output() prototype by omitting the struct sock parameter
> does not break anything.
> 
> 
> Regards,
> Rami Rosen
> 
> 
> Signed-off-by: Rami Rosen <ramirose@gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-18  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18  9:03 [PATCH] [IPV6] remove unused parameter (struct sock parameter) from ip6_route_output() Rami Rosen
2008-03-18  9:15 ` YOSHIFUJI Hideaki / 吉藤英明

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox