diff mbox

[net-next,v11,01/11] ipv6: move ip6_dst_hoplimit() into core kernel

Message ID 1377918448-29888-2-git-send-email-amwang@redhat.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Amerigo Wang Aug. 31, 2013, 3:07 a.m. UTC
From: Cong Wang <amwang@redhat.com>

It will be used by vxlan, and may not be inlined.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
 include/net/ip6_route.h |    2 --
 include/net/ipv6.h      |    2 ++
 net/ipv6/output_core.c  |   22 ++++++++++++++++++++++
 net/ipv6/route.c        |   19 -------------------
 4 files changed, 24 insertions(+), 21 deletions(-)

Comments

David Miller Aug. 31, 2013, 4:59 a.m. UTC | #1
From: Cong Wang <amwang@redhat.com>
Date: Sat, 31 Aug 2013 11:07:18 +0800

> @@ -75,3 +76,24 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
>  	return offset;
>  }
>  EXPORT_SYMBOL(ip6_find_1stfragopt);
> +
> +#if IS_ENABLED(CONFIG_IPV6)
> +int ip6_dst_hoplimit(struct dst_entry *dst)
 ...
> +#endif
> +EXPORT_SYMBOL(ip6_dst_hoplimit);

I don't think the export should be outside of the #if region.

Did you test the build with IPV6 disabled?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Amerigo Wang Aug. 31, 2013, 5:07 a.m. UTC | #2
On Sat, 2013-08-31 at 00:59 -0400, David Miller wrote:
> From: Cong Wang <amwang@redhat.com>
> Date: Sat, 31 Aug 2013 11:07:18 +0800
> 
> > @@ -75,3 +76,24 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
> >  	return offset;
> >  }
> >  EXPORT_SYMBOL(ip6_find_1stfragopt);
> > +
> > +#if IS_ENABLED(CONFIG_IPV6)
> > +int ip6_dst_hoplimit(struct dst_entry *dst)
>  ...
> > +#endif
> > +EXPORT_SYMBOL(ip6_dst_hoplimit);
> 
> I don't think the export should be outside of the #if region.
> 
> Did you test the build with IPV6 disabled?

Yes, but it didn't show me any error.

Below is my 3 config's for IPV6:

% grep IPV6 .config_ipv6_*
.config_ipv6_m:CONFIG_IPV6=m
.config_ipv6_m:CONFIG_IPV6_PRIVACY=y
.config_ipv6_m:CONFIG_IPV6_ROUTER_PREF=y
.config_ipv6_m:CONFIG_IPV6_ROUTE_INFO=y
.config_ipv6_m:CONFIG_IPV6_OPTIMISTIC_DAD=y
.config_ipv6_m:CONFIG_IPV6_MIP6=m
.config_ipv6_m:CONFIG_IPV6_SIT=m
.config_ipv6_m:CONFIG_IPV6_SIT_6RD=y
.config_ipv6_m:CONFIG_IPV6_NDISC_NODETYPE=y
.config_ipv6_m:CONFIG_IPV6_TUNNEL=m
.config_ipv6_m:CONFIG_IPV6_GRE=m
.config_ipv6_m:CONFIG_IPV6_MULTIPLE_TABLES=y
.config_ipv6_m:CONFIG_IPV6_SUBTREES=y
.config_ipv6_m:CONFIG_IPV6_MROUTE=y
.config_ipv6_m:CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y
.config_ipv6_m:CONFIG_IPV6_PIMSM_V2=y
.config_ipv6_m:CONFIG_NF_DEFRAG_IPV6=m
.config_ipv6_m:CONFIG_NF_CONNTRACK_IPV6=m
.config_ipv6_m:CONFIG_IP6_NF_MATCH_IPV6HEADER=m
.config_ipv6_m:CONFIG_NF_NAT_IPV6=m
.config_ipv6_n:# CONFIG_IPV6 is not set
.config_ipv6_y:CONFIG_IPV6=y
.config_ipv6_y:CONFIG_IPV6_PRIVACY=y
.config_ipv6_y:CONFIG_IPV6_ROUTER_PREF=y
.config_ipv6_y:CONFIG_IPV6_ROUTE_INFO=y
.config_ipv6_y:CONFIG_IPV6_OPTIMISTIC_DAD=y
.config_ipv6_y:CONFIG_IPV6_MIP6=y
.config_ipv6_y:CONFIG_IPV6_SIT=y
.config_ipv6_y:CONFIG_IPV6_SIT_6RD=y
.config_ipv6_y:CONFIG_IPV6_NDISC_NODETYPE=y
.config_ipv6_y:CONFIG_IPV6_TUNNEL=y
.config_ipv6_y:CONFIG_IPV6_GRE=y
.config_ipv6_y:CONFIG_IPV6_MULTIPLE_TABLES=y
.config_ipv6_y:CONFIG_IPV6_SUBTREES=y
.config_ipv6_y:CONFIG_IPV6_MROUTE=y
.config_ipv6_y:CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y
.config_ipv6_y:CONFIG_IPV6_PIMSM_V2=y
.config_ipv6_y:# CONFIG_IP_VS_IPV6 is not set
.config_ipv6_y:# CONFIG_NF_DEFRAG_IPV6 is not set
.config_ipv6_y:# CONFIG_NF_CONNTRACK_IPV6 is not set


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Aug. 31, 2013, 5:56 a.m. UTC | #3
From: Cong Wang <amwang@redhat.com>
Date: Sat, 31 Aug 2013 13:07:34 +0800

> On Sat, 2013-08-31 at 00:59 -0400, David Miller wrote:
>> From: Cong Wang <amwang@redhat.com>
>> Date: Sat, 31 Aug 2013 11:07:18 +0800
>> 
>> > @@ -75,3 +76,24 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
>> >  	return offset;
>> >  }
>> >  EXPORT_SYMBOL(ip6_find_1stfragopt);
>> > +
>> > +#if IS_ENABLED(CONFIG_IPV6)
>> > +int ip6_dst_hoplimit(struct dst_entry *dst)
>>  ...
>> > +#endif
>> > +EXPORT_SYMBOL(ip6_dst_hoplimit);
>> 
>> I don't think the export should be outside of the #if region.
>> 
>> Did you test the build with IPV6 disabled?
> 
> Yes, but it didn't show me any error.

Weird, please correct this anyways.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index f667248..f525e70 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -112,8 +112,6 @@  extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
 					   const struct in6_addr *addr,
 					   bool anycast);
 
-extern int			ip6_dst_hoplimit(struct dst_entry *dst);
-
 /*
  *	support functions for ND
  *
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 7bdff04..bbf1c8f 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -658,6 +658,8 @@  static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
 
 extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
 
+extern int ip6_dst_hoplimit(struct dst_entry *dst);
+
 /*
  *	Header manipulation
  */
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
index ab92a36..2766566 100644
--- a/net/ipv6/output_core.c
+++ b/net/ipv6/output_core.c
@@ -5,6 +5,7 @@ 
 #include <linux/export.h>
 #include <net/ipv6.h>
 #include <net/ip6_fib.h>
+#include <net/addrconf.h>
 
 void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)
 {
@@ -75,3 +76,24 @@  int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
 	return offset;
 }
 EXPORT_SYMBOL(ip6_find_1stfragopt);
+
+#if IS_ENABLED(CONFIG_IPV6)
+int ip6_dst_hoplimit(struct dst_entry *dst)
+{
+	int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
+	if (hoplimit == 0) {
+		struct net_device *dev = dst->dev;
+		struct inet6_dev *idev;
+
+		rcu_read_lock();
+		idev = __in6_dev_get(dev);
+		if (idev)
+			hoplimit = idev->cnf.hop_limit;
+		else
+			hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit;
+		rcu_read_unlock();
+	}
+	return hoplimit;
+}
+#endif
+EXPORT_SYMBOL(ip6_dst_hoplimit);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 55236a8..b770085 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1354,25 +1354,6 @@  out:
 	return entries > rt_max_size;
 }
 
-int ip6_dst_hoplimit(struct dst_entry *dst)
-{
-	int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
-	if (hoplimit == 0) {
-		struct net_device *dev = dst->dev;
-		struct inet6_dev *idev;
-
-		rcu_read_lock();
-		idev = __in6_dev_get(dev);
-		if (idev)
-			hoplimit = idev->cnf.hop_limit;
-		else
-			hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit;
-		rcu_read_unlock();
-	}
-	return hoplimit;
-}
-EXPORT_SYMBOL(ip6_dst_hoplimit);
-
 /*
  *
  */