All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter
@ 2018-02-14 18:13 Matteo Croce
  2018-02-14 18:13 ` [PATCH 1/3] ipvlan: drop ipv6 dependency Matteo Croce
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Matteo Croce @ 2018-02-14 18:13 UTC (permalink / raw)
  To: netdev; +Cc: Mahesh Bandewar

The IPVlan module currently depends on IPv6 and Netfilter.
Refactor the code to allow building IPVlan module regardless of the value of
CONFIG_IPV6 and CONFIG_NETFILTER.
Also change the dependency to CONFIG_NET_L3_MASTER_DEV into a select,
as compiling L3 Master device alone has no sense.

$ grep -wE 'CONFIG_(IPV6|NETFILTER|IPVLAN)' .config
CONFIG_IPV6=y
CONFIG_NETFILTER=y
CONFIG_IPVLAN=m
$ ll drivers/net/ipvlan/ipvlan.ko
48K drivers/net/ipvlan/ipvlan.ko

$ grep -wE 'CONFIG_(IPV6|NETFILTER|IPVLAN)' .config
# CONFIG_IPV6 is not set
CONFIG_NETFILTER=y
CONFIG_IPVLAN=m
$ ll drivers/net/ipvlan/ipvlan.ko
44K drivers/net/ipvlan/ipvlan.ko

$ grep -wE 'CONFIG_(IPV6|NETFILTER|IPVLAN)' .config
CONFIG_IPV6=m
# CONFIG_NETFILTER is not set
CONFIG_IPVLAN=m
$ ll drivers/net/ipvlan/ipvlan.ko
46K drivers/net/ipvlan/ipvlan.ko

$ grep -wE 'CONFIG_(IPV6|NETFILTER|IPVLAN)' .config
# CONFIG_IPV6 is not set
# CONFIG_NETFILTER is not set
CONFIG_IPVLAN=m
$ ll drivers/net/ipvlan/ipvlan.ko
43K drivers/net/ipvlan/ipvlan.ko

Matteo Croce (3):
  ipvlan: drop ipv6 dependency
  ipvlan: drop netfilter dependency
  ipvlan: selects master_l3 device instead of depending on it

 drivers/net/Kconfig              |  4 +-
 drivers/net/ipvlan/ipvlan.h      |  2 +
 drivers/net/ipvlan/ipvlan_core.c | 73 ++++++++++++++++++++++++++++---------
 drivers/net/ipvlan/ipvlan_main.c | 79 +++++++++++++++++++++++++++-------------
 4 files changed, 111 insertions(+), 47 deletions(-)

-- 
2.14.3

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

* [PATCH 1/3] ipvlan: drop ipv6 dependency
  2018-02-14 18:13 [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Matteo Croce
@ 2018-02-14 18:13 ` Matteo Croce
  2018-02-14 18:13 ` [PATCH 2/3] ipvlan: drop netfilter dependency Matteo Croce
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Matteo Croce @ 2018-02-14 18:13 UTC (permalink / raw)
  To: netdev; +Cc: Mahesh Bandewar

IPVlan has an hard dependency on IPv6.
Refactor the ipvlan code to allow compiling it with IPv6 disabled.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
 drivers/net/Kconfig              |  1 -
 drivers/net/ipvlan/ipvlan_core.c | 71 ++++++++++++++++++++++++++++++----------
 drivers/net/ipvlan/ipvlan_main.c | 48 +++++++++++++++++----------
 3 files changed, 84 insertions(+), 36 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 944ec3c9282c..3234c6618d75 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -149,7 +149,6 @@ config MACVTAP
 config IPVLAN
     tristate "IP-VLAN support"
     depends on INET
-    depends on IPV6
     depends on NETFILTER
     depends on NET_L3_MASTER_DEV
     ---help---
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index c1f008fe4e1d..653b00738616 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -35,6 +35,7 @@ void ipvlan_count_rx(const struct ipvl_dev *ipvlan,
 }
 EXPORT_SYMBOL_GPL(ipvlan_count_rx);
 
+#if IS_ENABLED(CONFIG_IPV6)
 static u8 ipvlan_get_v6_hash(const void *iaddr)
 {
 	const struct in6_addr *ip6_addr = iaddr;
@@ -42,6 +43,12 @@ static u8 ipvlan_get_v6_hash(const void *iaddr)
 	return __ipv6_addr_jhash(ip6_addr, ipvlan_jhash_secret) &
 	       IPVLAN_HASH_MASK;
 }
+#else
+static u8 ipvlan_get_v6_hash(const void *iaddr)
+{
+	return 0;
+}
+#endif
 
 static u8 ipvlan_get_v4_hash(const void *iaddr)
 {
@@ -51,6 +58,22 @@ static u8 ipvlan_get_v4_hash(const void *iaddr)
 	       IPVLAN_HASH_MASK;
 }
 
+static bool addr_equal(bool is_v6, struct ipvl_addr *addr, const void *iaddr) {
+	if (!is_v6 && addr->atype == IPVL_IPV4) {
+		struct in_addr *i4addr = (struct in_addr *)iaddr;
+
+		return addr->ip4addr.s_addr == i4addr->s_addr;
+#if IS_ENABLED(CONFIG_IPV6)
+	} else if (is_v6 && addr->atype == IPVL_IPV6) {
+		struct in6_addr *i6addr = (struct in6_addr *)iaddr;
+
+		return ipv6_addr_equal(&addr->ip6addr, i6addr);
+#endif
+	}
+
+	return false;
+}
+
 static struct ipvl_addr *ipvlan_ht_addr_lookup(const struct ipvl_port *port,
 					       const void *iaddr, bool is_v6)
 {
@@ -59,15 +82,9 @@ static struct ipvl_addr *ipvlan_ht_addr_lookup(const struct ipvl_port *port,
 
 	hash = is_v6 ? ipvlan_get_v6_hash(iaddr) :
 	       ipvlan_get_v4_hash(iaddr);
-	hlist_for_each_entry_rcu(addr, &port->hlhead[hash], hlnode) {
-		if (is_v6 && addr->atype == IPVL_IPV6 &&
-		    ipv6_addr_equal(&addr->ip6addr, iaddr))
+	hlist_for_each_entry_rcu(addr, &port->hlhead[hash], hlnode)
+		if (addr_equal(is_v6, addr, iaddr))
 			return addr;
-		else if (!is_v6 && addr->atype == IPVL_IPV4 &&
-			 addr->ip4addr.s_addr ==
-				((struct in_addr *)iaddr)->s_addr)
-			return addr;
-	}
 	return NULL;
 }
 
@@ -93,13 +110,9 @@ struct ipvl_addr *ipvlan_find_addr(const struct ipvl_dev *ipvlan,
 {
 	struct ipvl_addr *addr;
 
-	list_for_each_entry(addr, &ipvlan->addrs, anode) {
-		if ((is_v6 && addr->atype == IPVL_IPV6 &&
-		    ipv6_addr_equal(&addr->ip6addr, iaddr)) ||
-		    (!is_v6 && addr->atype == IPVL_IPV4 &&
-		    addr->ip4addr.s_addr == ((struct in_addr *)iaddr)->s_addr))
+	list_for_each_entry(addr, &ipvlan->addrs, anode)
+		if (addr_equal(is_v6, addr, iaddr))
 			return addr;
-	}
 	return NULL;
 }
 
@@ -150,6 +163,7 @@ static void *ipvlan_get_L3_hdr(struct ipvl_port *port, struct sk_buff *skb, int
 		lyr3h = ip4h;
 		break;
 	}
+#if IS_ENABLED(CONFIG_IPV6)
 	case htons(ETH_P_IPV6): {
 		struct ipv6hdr *ip6h;
 
@@ -188,6 +202,7 @@ static void *ipvlan_get_L3_hdr(struct ipvl_port *port, struct sk_buff *skb, int
 		}
 		break;
 	}
+#endif
 	default:
 		return NULL;
 	}
@@ -337,14 +352,18 @@ static struct ipvl_addr *ipvlan_addr_lookup(struct ipvl_port *port,
 {
 	struct ipvl_addr *addr = NULL;
 
-	if (addr_type == IPVL_IPV6) {
+	switch (addr_type) {
+#if IS_ENABLED(CONFIG_IPV6)
+	case IPVL_IPV6: {
 		struct ipv6hdr *ip6h;
 		struct in6_addr *i6addr;
 
 		ip6h = (struct ipv6hdr *)lyr3h;
 		i6addr = use_dest ? &ip6h->daddr : &ip6h->saddr;
 		addr = ipvlan_ht_addr_lookup(port, i6addr, true);
-	} else if (addr_type == IPVL_ICMPV6) {
+		break;
+	}
+	case IPVL_ICMPV6: {
 		struct nd_msg *ndmh;
 		struct in6_addr *i6addr;
 
@@ -356,14 +375,19 @@ static struct ipvl_addr *ipvlan_addr_lookup(struct ipvl_port *port,
 			i6addr = &ndmh->target;
 			addr = ipvlan_ht_addr_lookup(port, i6addr, true);
 		}
-	} else if (addr_type == IPVL_IPV4) {
+		break;
+	}
+#endif
+	case IPVL_IPV4: {
 		struct iphdr *ip4h;
 		__be32 *i4addr;
 
 		ip4h = (struct iphdr *)lyr3h;
 		i4addr = use_dest ? &ip4h->daddr : &ip4h->saddr;
 		addr = ipvlan_ht_addr_lookup(port, i4addr, false);
-	} else if (addr_type == IPVL_ARP) {
+		break;
+	}
+	case IPVL_ARP: {
 		struct arphdr *arph;
 		unsigned char *arp_ptr;
 		__be32 dip;
@@ -377,6 +401,8 @@ static struct ipvl_addr *ipvlan_addr_lookup(struct ipvl_port *port,
 
 		memcpy(&dip, arp_ptr, 4);
 		addr = ipvlan_ht_addr_lookup(port, &dip, false);
+		break;
+	}
 	}
 
 	return addr;
@@ -420,6 +446,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb)
 	return ret;
 }
 
+#if IS_ENABLED(CONFIG_IPV6)
 static int ipvlan_process_v6_outbound(struct sk_buff *skb)
 {
 	const struct ipv6hdr *ip6h = ipv6_hdr(skb);
@@ -456,6 +483,12 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
 out:
 	return ret;
 }
+#else
+static int ipvlan_process_v6_outbound(struct sk_buff *skb)
+{
+	return NET_XMIT_DROP;
+}
+#endif
 
 static int ipvlan_process_outbound(struct sk_buff *skb)
 {
@@ -759,6 +792,7 @@ struct sk_buff *ipvlan_l3_rcv(struct net_device *dev, struct sk_buff *skb,
 			goto out;
 		break;
 	}
+#if IS_ENABLED(CONFIG_IPV6)
 	case AF_INET6:
 	{
 		struct dst_entry *dst;
@@ -778,6 +812,7 @@ struct sk_buff *ipvlan_l3_rcv(struct net_device *dev, struct sk_buff *skb,
 		skb_dst_set(skb, dst);
 		break;
 	}
+#endif
 	default:
 		break;
 	}
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 2469df118fbf..67c91ceda979 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -22,12 +22,14 @@ static const struct nf_hook_ops ipvl_nfops[] = {
 		.hooknum  = NF_INET_LOCAL_IN,
 		.priority = INT_MAX,
 	},
+#if IS_ENABLED(CONFIG_IPV6)
 	{
 		.hook     = ipvlan_nf_input,
 		.pf       = NFPROTO_IPV6,
 		.hooknum  = NF_INET_LOCAL_IN,
 		.priority = INT_MAX,
 	},
+#endif
 };
 
 static const struct l3mdev_ops ipvl_l3mdev_ops = {
@@ -800,12 +802,14 @@ static int ipvlan_add_addr(struct ipvl_dev *ipvlan, void *iaddr, bool is_v6)
 		return -ENOMEM;
 
 	addr->master = ipvlan;
-	if (is_v6) {
-		memcpy(&addr->ip6addr, iaddr, sizeof(struct in6_addr));
-		addr->atype = IPVL_IPV6;
-	} else {
+	if (!is_v6) {
 		memcpy(&addr->ip4addr, iaddr, sizeof(struct in_addr));
 		addr->atype = IPVL_IPV4;
+#if IS_ENABLED(CONFIG_IPV6)
+	} else {
+		memcpy(&addr->ip6addr, iaddr, sizeof(struct in6_addr));
+		addr->atype = IPVL_IPV6;
+#endif
 	}
 	list_add_tail(&addr->anode, &ipvlan->addrs);
 
@@ -833,6 +837,20 @@ static void ipvlan_del_addr(struct ipvl_dev *ipvlan, void *iaddr, bool is_v6)
 	return;
 }
 
+static bool ipvlan_is_valid_dev(const struct net_device *dev)
+{
+	struct ipvl_dev *ipvlan = netdev_priv(dev);
+
+	if (!netif_is_ipvlan(dev))
+		return false;
+
+	if (!ipvlan || !ipvlan->port)
+		return false;
+
+	return true;
+}
+
+#if IS_ENABLED(CONFIG_IPV6)
 static int ipvlan_add_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr)
 {
 	if (ipvlan_addr_busy(ipvlan->port, ip6_addr, true)) {
@@ -850,19 +868,6 @@ static void ipvlan_del_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr)
 	return ipvlan_del_addr(ipvlan, ip6_addr, true);
 }
 
-static bool ipvlan_is_valid_dev(const struct net_device *dev)
-{
-	struct ipvl_dev *ipvlan = netdev_priv(dev);
-
-	if (!netif_is_ipvlan(dev))
-		return false;
-
-	if (!ipvlan || !ipvlan->port)
-		return false;
-
-	return true;
-}
-
 static int ipvlan_addr6_event(struct notifier_block *unused,
 			      unsigned long event, void *ptr)
 {
@@ -913,6 +918,7 @@ static int ipvlan_addr6_validator_event(struct notifier_block *unused,
 
 	return NOTIFY_OK;
 }
+#endif
 
 static int ipvlan_add_addr4(struct ipvl_dev *ipvlan, struct in_addr *ip4_addr)
 {
@@ -993,6 +999,7 @@ static struct notifier_block ipvlan_notifier_block __read_mostly = {
 	.notifier_call = ipvlan_device_event,
 };
 
+#if IS_ENABLED(CONFIG_IPV6)
 static struct notifier_block ipvlan_addr6_notifier_block __read_mostly = {
 	.notifier_call = ipvlan_addr6_event,
 };
@@ -1000,6 +1007,7 @@ static struct notifier_block ipvlan_addr6_notifier_block __read_mostly = {
 static struct notifier_block ipvlan_addr6_vtor_notifier_block __read_mostly = {
 	.notifier_call = ipvlan_addr6_validator_event,
 };
+#endif
 
 static void ipvlan_ns_exit(struct net *net)
 {
@@ -1024,9 +1032,11 @@ static int __init ipvlan_init_module(void)
 
 	ipvlan_init_secret();
 	register_netdevice_notifier(&ipvlan_notifier_block);
+#if IS_ENABLED(CONFIG_IPV6)
 	register_inet6addr_notifier(&ipvlan_addr6_notifier_block);
 	register_inet6addr_validator_notifier(
 	    &ipvlan_addr6_vtor_notifier_block);
+#endif
 	register_inetaddr_notifier(&ipvlan_addr4_notifier_block);
 	register_inetaddr_validator_notifier(&ipvlan_addr4_vtor_notifier_block);
 
@@ -1045,9 +1055,11 @@ static int __init ipvlan_init_module(void)
 	unregister_inetaddr_notifier(&ipvlan_addr4_notifier_block);
 	unregister_inetaddr_validator_notifier(
 	    &ipvlan_addr4_vtor_notifier_block);
+#if IS_ENABLED(CONFIG_IPV6)
 	unregister_inet6addr_notifier(&ipvlan_addr6_notifier_block);
 	unregister_inet6addr_validator_notifier(
 	    &ipvlan_addr6_vtor_notifier_block);
+#endif
 	unregister_netdevice_notifier(&ipvlan_notifier_block);
 	return err;
 }
@@ -1060,9 +1072,11 @@ static void __exit ipvlan_cleanup_module(void)
 	unregister_inetaddr_notifier(&ipvlan_addr4_notifier_block);
 	unregister_inetaddr_validator_notifier(
 	    &ipvlan_addr4_vtor_notifier_block);
+#if IS_ENABLED(CONFIG_IPV6)
 	unregister_inet6addr_notifier(&ipvlan_addr6_notifier_block);
 	unregister_inet6addr_validator_notifier(
 	    &ipvlan_addr6_vtor_notifier_block);
+#endif
 }
 
 module_init(ipvlan_init_module);
-- 
2.14.3

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

* [PATCH 2/3] ipvlan: drop netfilter dependency
  2018-02-14 18:13 [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Matteo Croce
  2018-02-14 18:13 ` [PATCH 1/3] ipvlan: drop ipv6 dependency Matteo Croce
@ 2018-02-14 18:13 ` Matteo Croce
  2018-02-14 18:13 ` [PATCH 3/3] ipvlan: selects master_l3 device instead of depending on it Matteo Croce
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Matteo Croce @ 2018-02-14 18:13 UTC (permalink / raw)
  To: netdev; +Cc: Mahesh Bandewar

IPVlan has an hard dependency on netfilter.
Refactor the ipvlan code to allow compiling it with netfilter disabled.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
 drivers/net/Kconfig              |  1 -
 drivers/net/ipvlan/ipvlan.h      |  2 ++
 drivers/net/ipvlan/ipvlan_core.c |  2 ++
 drivers/net/ipvlan/ipvlan_main.c | 31 ++++++++++++++++++++++---------
 4 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 3234c6618d75..64d3017ecd01 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -149,7 +149,6 @@ config MACVTAP
 config IPVLAN
     tristate "IP-VLAN support"
     depends on INET
-    depends on NETFILTER
     depends on NET_L3_MASTER_DEV
     ---help---
       This allows one to create virtual devices off of a main interface
diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h
index 5166575a164d..b7fa5a48a351 100644
--- a/drivers/net/ipvlan/ipvlan.h
+++ b/drivers/net/ipvlan/ipvlan.h
@@ -166,8 +166,10 @@ bool ipvlan_addr_busy(struct ipvl_port *port, void *iaddr, bool is_v6);
 void ipvlan_ht_addr_del(struct ipvl_addr *addr);
 struct sk_buff *ipvlan_l3_rcv(struct net_device *dev, struct sk_buff *skb,
 			      u16 proto);
+#ifdef CONFIG_NETFILTER
 unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb,
 			     const struct nf_hook_state *state);
+#endif
 void ipvlan_count_rx(const struct ipvl_dev *ipvlan,
 		     unsigned int len, bool success, bool mcast);
 int ipvlan_link_new(struct net *src_net, struct net_device *dev,
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index 653b00738616..5be846bc6d8c 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -821,6 +821,7 @@ struct sk_buff *ipvlan_l3_rcv(struct net_device *dev, struct sk_buff *skb,
 	return skb;
 }
 
+#ifdef CONFIG_NETFILTER
 unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb,
 			     const struct nf_hook_state *state)
 {
@@ -837,3 +838,4 @@ unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb,
 out:
 	return NF_ACCEPT;
 }
+#endif
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 67c91ceda979..2e311251c27c 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -15,6 +15,16 @@ struct ipvlan_netns {
 	unsigned int ipvl_nf_hook_refcnt;
 };
 
+static const struct l3mdev_ops ipvl_l3mdev_ops = {
+	.l3mdev_l3_rcv = ipvlan_l3_rcv,
+};
+
+static void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev)
+{
+	ipvlan->dev->mtu = dev->mtu;
+}
+
+#ifdef CONFIG_NETFILTER
 static const struct nf_hook_ops ipvl_nfops[] = {
 	{
 		.hook     = ipvlan_nf_input,
@@ -32,15 +42,6 @@ static const struct nf_hook_ops ipvl_nfops[] = {
 #endif
 };
 
-static const struct l3mdev_ops ipvl_l3mdev_ops = {
-	.l3mdev_l3_rcv = ipvlan_l3_rcv,
-};
-
-static void ipvlan_adjust_mtu(struct ipvl_dev *ipvlan, struct net_device *dev)
-{
-	ipvlan->dev->mtu = dev->mtu;
-}
-
 static int ipvlan_register_nf_hook(struct net *net)
 {
 	struct ipvlan_netns *vnet = net_generic(net, ipvlan_netid);
@@ -70,6 +71,16 @@ static void ipvlan_unregister_nf_hook(struct net *net)
 		nf_unregister_net_hooks(net, ipvl_nfops,
 					ARRAY_SIZE(ipvl_nfops));
 }
+#else
+static int ipvlan_register_nf_hook(struct net *net)
+{
+	return 0;
+}
+
+static void ipvlan_unregister_nf_hook(struct net *net)
+{
+}
+#endif
 
 static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)
 {
@@ -1015,8 +1026,10 @@ static void ipvlan_ns_exit(struct net *net)
 
 	if (WARN_ON_ONCE(vnet->ipvl_nf_hook_refcnt)) {
 		vnet->ipvl_nf_hook_refcnt = 0;
+#ifdef CONFIG_NETFILTER
 		nf_unregister_net_hooks(net, ipvl_nfops,
 					ARRAY_SIZE(ipvl_nfops));
+#endif
 	}
 }
 
-- 
2.14.3

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

* [PATCH 3/3] ipvlan: selects master_l3 device instead of depending on it
  2018-02-14 18:13 [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Matteo Croce
  2018-02-14 18:13 ` [PATCH 1/3] ipvlan: drop ipv6 dependency Matteo Croce
  2018-02-14 18:13 ` [PATCH 2/3] ipvlan: drop netfilter dependency Matteo Croce
@ 2018-02-14 18:13 ` Matteo Croce
  2018-02-14 23:01 ` [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Florian Westphal
  2018-02-15  1:11 ` David Miller
  4 siblings, 0 replies; 8+ messages in thread
From: Matteo Croce @ 2018-02-14 18:13 UTC (permalink / raw)
  To: netdev; +Cc: Mahesh Bandewar

The L3 Master device is just a glue between the core networking code and
device drivers, so it should be selected automatically rather than
requiring to be enabled explicitly.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
 drivers/net/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 64d3017ecd01..3dd8a6a6a336 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -149,7 +149,7 @@ config MACVTAP
 config IPVLAN
     tristate "IP-VLAN support"
     depends on INET
-    depends on NET_L3_MASTER_DEV
+    select NET_L3_MASTER_DEV
     ---help---
       This allows one to create virtual devices off of a main interface
       and packets will be delivered based on the dest L3 (IPv6/IPv4 addr)
-- 
2.14.3

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

* Re: [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter
  2018-02-14 18:13 [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Matteo Croce
                   ` (2 preceding siblings ...)
  2018-02-14 18:13 ` [PATCH 3/3] ipvlan: selects master_l3 device instead of depending on it Matteo Croce
@ 2018-02-14 23:01 ` Florian Westphal
  2018-02-15  1:11 ` David Miller
  4 siblings, 0 replies; 8+ messages in thread
From: Florian Westphal @ 2018-02-14 23:01 UTC (permalink / raw)
  To: Matteo Croce; +Cc: netdev, Mahesh Bandewar

Matteo Croce <mcroce@redhat.com> wrote:
> The IPVlan module currently depends on IPv6 and Netfilter.
> Refactor the code to allow building IPVlan module regardless of the value of
> CONFIG_IPV6 and CONFIG_NETFILTER.
> Also change the dependency to CONFIG_NET_L3_MASTER_DEV into a select,
> as compiling L3 Master device alone has no sense.

4fbae7d83c98c30efc implies that both netfilter and l3mdev are needed
for l3s mode, yet I see no option of that in changelog or a change that
rejects this mode.

Am I missing anything?

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

* Re: [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter
  2018-02-14 18:13 [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Matteo Croce
                   ` (3 preceding siblings ...)
  2018-02-14 23:01 ` [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Florian Westphal
@ 2018-02-15  1:11 ` David Miller
  2018-02-15 14:04   ` Matteo Croce
  4 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2018-02-15  1:11 UTC (permalink / raw)
  To: mcroce; +Cc: netdev, maheshb

From: Matteo Croce <mcroce@redhat.com>
Date: Wed, 14 Feb 2018 19:13:42 +0100

> The IPVlan module currently depends on IPv6 and Netfilter.
> Refactor the code to allow building IPVlan module regardless of the value of
> CONFIG_IPV6 and CONFIG_NETFILTER.
> Also change the dependency to CONFIG_NET_L3_MASTER_DEV into a select,
> as compiling L3 Master device alone has no sense.

As stated, the L3 master and netfilter are hard depenencies when using
ipvlan in some modes.

You can't just ifdef the driver like this, it changes fundamental
pieces of functionality.

I would say leave things as they are right now.

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

* Re: [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter
  2018-02-15  1:11 ` David Miller
@ 2018-02-15 14:04   ` Matteo Croce
  2018-02-16 20:42     ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Matteo Croce @ 2018-02-15 14:04 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Mahesh Bandewar

On Thu, Feb 15, 2018 at 2:11 AM, David Miller <davem@davemloft.net> wrote:
> From: Matteo Croce <mcroce@redhat.com>
> Date: Wed, 14 Feb 2018 19:13:42 +0100
>
>> The IPVlan module currently depends on IPv6 and Netfilter.
>> Refactor the code to allow building IPVlan module regardless of the value of
>> CONFIG_IPV6 and CONFIG_NETFILTER.
>> Also change the dependency to CONFIG_NET_L3_MASTER_DEV into a select,
>> as compiling L3 Master device alone has no sense.
>
> As stated, the L3 master and netfilter are hard depenencies when using
> ipvlan in some modes.
>
> You can't just ifdef the driver like this, it changes fundamental
> pieces of functionality.
>
> I would say leave things as they are right now.

Hi David,

yes, I noticed that L3 master and netfilter are really needed in l3s
mode, so let's drop patch 2/3.

What about the other two, removing IPv6 and change the Kconfig?
Other devices like VXLan, Geneve and VRF uses the same architecture to
allow conditional compilation of the IPv6 module,
I think that IPVlan should do the same.

Regards,
-- 
Matteo Croce
per aspera ad upstream

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

* Re: [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter
  2018-02-15 14:04   ` Matteo Croce
@ 2018-02-16 20:42     ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2018-02-16 20:42 UTC (permalink / raw)
  To: mcroce; +Cc: netdev, maheshb

From: Matteo Croce <mcroce@redhat.com>
Date: Thu, 15 Feb 2018 15:04:52 +0100

> What about the other two, removing IPv6 and change the Kconfig?
> Other devices like VXLan, Geneve and VRF uses the same architecture
> to allow conditional compilation of the IPv6 module, I think that
> IPVlan should do the same.

Ok, those parts should be reasonable, please respin.

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

end of thread, other threads:[~2018-02-16 20:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 18:13 [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Matteo Croce
2018-02-14 18:13 ` [PATCH 1/3] ipvlan: drop ipv6 dependency Matteo Croce
2018-02-14 18:13 ` [PATCH 2/3] ipvlan: drop netfilter dependency Matteo Croce
2018-02-14 18:13 ` [PATCH 3/3] ipvlan: selects master_l3 device instead of depending on it Matteo Croce
2018-02-14 23:01 ` [PATCH 0/3] Remove IPVlan module dependencies on IPv6 and Netfilter Florian Westphal
2018-02-15  1:11 ` David Miller
2018-02-15 14:04   ` Matteo Croce
2018-02-16 20:42     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.