netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] icmp: allow icmpv6_ndo_send to work with CONFIG_IPV6=n
@ 2020-02-25 10:05 Jason A. Donenfeld
  2020-02-25 19:02 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jason A. Donenfeld @ 2020-02-25 10:05 UTC (permalink / raw)
  To: davem, netdev; +Cc: Jason A. Donenfeld, Chen Zhou, Hulk Robot

The icmpv6_send function has long had a static inline implementation
with an empty body for CONFIG_IPV6=n, so that code calling it doesn't
need to be ifdef'd. The new icmpv6_ndo_send function, which is intended
for drivers as a drop-in replacement with an identical function
signature, should follow the same pattern. Without this patch, drivers
that used to work with CONFIG_IPV6=n now result in a linker error.

Cc: Chen Zhou <chenzhou10@huawei.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 0b41713b6066 ("icmp: introduce helper for nat'd source address in network device context")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 include/linux/icmpv6.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 93338fd54af8..33d379602314 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -22,19 +22,23 @@ extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
 int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
 			       unsigned int data_len);
 
+#if IS_ENABLED(CONFIG_NF_NAT)
+void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);
+#else
+#define icmpv6_ndo_send icmpv6_send
+#endif
+
 #else
 
 static inline void icmpv6_send(struct sk_buff *skb,
 			       u8 type, u8 code, __u32 info)
 {
-
 }
-#endif
 
-#if IS_ENABLED(CONFIG_NF_NAT)
-void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);
-#else
-#define icmpv6_ndo_send icmpv6_send
+static inline void icmpv6_ndo_send(struct sk_buff *skb,
+				   u8 type, u8 code, __u32 info)
+{
+}
 #endif
 
 extern int				icmpv6_init(void);
-- 
2.25.0


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

* Re: [PATCH net] icmp: allow icmpv6_ndo_send to work with CONFIG_IPV6=n
  2020-02-25 10:05 [PATCH net] icmp: allow icmpv6_ndo_send to work with CONFIG_IPV6=n Jason A. Donenfeld
@ 2020-02-25 19:02 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-02-25 19:02 UTC (permalink / raw)
  To: Jason; +Cc: netdev, chenzhou10, hulkci

From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Tue, 25 Feb 2020 18:05:35 +0800

> The icmpv6_send function has long had a static inline implementation
> with an empty body for CONFIG_IPV6=n, so that code calling it doesn't
> need to be ifdef'd. The new icmpv6_ndo_send function, which is intended
> for drivers as a drop-in replacement with an identical function
> signature, should follow the same pattern. Without this patch, drivers
> that used to work with CONFIG_IPV6=n now result in a linker error.
> 
> Cc: Chen Zhou <chenzhou10@huawei.com>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: 0b41713b6066 ("icmp: introduce helper for nat'd source address in network device context")
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Applied, thanks Jason.

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

end of thread, other threads:[~2020-02-25 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25 10:05 [PATCH net] icmp: allow icmpv6_ndo_send to work with CONFIG_IPV6=n Jason A. Donenfeld
2020-02-25 19:02 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).