From 5953db80accf29c11aae789c055988e710492a5b Mon Sep 17 00:00:00 2001
From: =?iso-8859-15?q?Beno=EEt=20Ganne?= <benoit.ganne@gmail.com>
Date: Sun, 30 Sep 2007 19:54:47 +0200
Subject: [PATCH 3/3] Kbuild update to allow to build IPv4 as a module

This patch update Kconfigs and Makefiles needed to compile IPv4 as a
module, taking care of the dependencies.
---
 drivers/net/wireless/Kconfig |    2 +-
 fs/gfs2/Kconfig              |    2 +-
 net/Kconfig                  |    2 +-
 net/Makefile                 |    4 +-
 net/atm/Kconfig              |    2 +-
 net/bridge/Kconfig           |    1 +
 net/dccp/Kconfig             |    2 +-
 net/ipv4/Kconfig             |   91 ++++++++++++++++++++++++++++++------------
 net/ipv4/Makefile            |   35 ++++++++++------
 net/ipv4/ipvs/Kconfig        |    2 +-
 net/ipv4/netfilter/Kconfig   |    2 +-
 net/ipv6/Kconfig             |    1 +
 net/netfilter/Kconfig        |    2 +-
 net/sctp/Kconfig             |    1 +
 net/tipc/Kconfig             |    2 +-
 15 files changed, 101 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index fa2399c..160f0c7 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -16,7 +16,7 @@ config WLAN_PRE80211
 
 config STRIP
 	tristate "STRIP (Metricom starmode radio IP)"
-	depends on INET && WLAN_PRE80211
+	depends on INET && IPV4 && WLAN_PRE80211
 	select WIRELESS_EXT
 	---help---
 	  Say Y if you have a Metricom radio and intend to use Starmode Radio
diff --git a/fs/gfs2/Kconfig b/fs/gfs2/Kconfig
index de8e64c..bf52caf 100644
--- a/fs/gfs2/Kconfig
+++ b/fs/gfs2/Kconfig
@@ -34,7 +34,7 @@ config GFS2_FS_LOCKING_NOLOCK
 
 config GFS2_FS_LOCKING_DLM
 	tristate "GFS2 DLM locking module"
-	depends on GFS2_FS && SYSFS && NET && INET && (IPV6 || IPV6=n)
+	depends on GFS2_FS && SYSFS && NET && INET && (IPV4 || IPV4=n) && (IPV6 || IPV6=n)
 	select IP_SCTP if DLM_SCTP
 	select CONFIGFS_FS
 	select DLM
diff --git a/net/Kconfig b/net/Kconfig
index f3de729..f0d8a8d 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -192,7 +192,7 @@ config NET_PKTGEN
 
 config NET_TCPPROBE
 	tristate "TCP connection probing"
-	depends on INET && EXPERIMENTAL && PROC_FS && KPROBES
+	depends on INET && IPV4 && EXPERIMENTAL && PROC_FS && KPROBES
 	---help---
 	This module allows for capturing the changes to TCP connection
 	state in response to incoming packets. It is used for debugging
diff --git a/net/Makefile b/net/Makefile
index 34e5b2d..623cfb9 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -16,7 +16,9 @@ obj-$(CONFIG_NET)		+= $(tmp-y)
 obj-$(CONFIG_LLC)		+= llc/
 obj-$(CONFIG_NET)		+= ethernet/ 802/ sched/ netlink/
 obj-$(CONFIG_NETFILTER)		+= netfilter/
-obj-$(CONFIG_INET)		+= ipv4/
+ifneq ($(CONFIG_IPV4),)
+obj-y				+= ipv4/
+endif
 obj-$(CONFIG_XFRM)		+= xfrm/
 obj-$(CONFIG_UNIX)		+= unix/
 ifneq ($(CONFIG_IPV6),)
diff --git a/net/atm/Kconfig b/net/atm/Kconfig
index 21ff276..35fc3a5 100644
--- a/net/atm/Kconfig
+++ b/net/atm/Kconfig
@@ -21,7 +21,7 @@ config ATM
 
 config ATM_CLIP
 	tristate "Classical IP over ATM (EXPERIMENTAL)"
-	depends on ATM && INET
+	depends on ATM && INET && IPV4
 	help
 	  Classical IP over ATM for PVCs and SVCs, supporting InARP and
 	  ATMARP. If you want to communication with other IP hosts on your ATM
diff --git a/net/bridge/Kconfig b/net/bridge/Kconfig
index 12265af..fc41558 100644
--- a/net/bridge/Kconfig
+++ b/net/bridge/Kconfig
@@ -4,6 +4,7 @@
 
 config BRIDGE
 	tristate "802.1d Ethernet Bridging"
+        depends on IPV4
 	select LLC
 	---help---
 	  If you say Y here, then your Linux box will be able to act as an
diff --git a/net/dccp/Kconfig b/net/dccp/Kconfig
index 0549e47..1ae7379 100644
--- a/net/dccp/Kconfig
+++ b/net/dccp/Kconfig
@@ -1,6 +1,6 @@
 menuconfig IP_DCCP
 	tristate "The DCCP Protocol (EXPERIMENTAL)"
-	depends on INET && EXPERIMENTAL
+	depends on INET && IPV4 && EXPERIMENTAL
 	---help---
 	  Datagram Congestion Control Protocol (RFC 4340)
 
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 010fbb2..58cc73d 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -1,8 +1,22 @@
 #
 # IP configuration
 #
+
+#   IPv4 as module will cause a CRASH if you try to unload it
+config IPV4
+	tristate "The IPv4 protocol"
+	default y
+	---help---
+	  This is support for the IP version 4.
+
+	  If unsure, say Y here.
+
+	  To compile this protocol support as a module, choose M here: the 
+	  module will be called ipv4.
+
 config IP_MULTICAST
 	bool "IP: multicasting"
+	depends on IPV4
 	help
 	  This is code for addressing several networked computers at once,
 	  enlarging your kernel by about 2 KB. You need multicasting if you
@@ -16,6 +30,7 @@ config IP_MULTICAST
 
 config IP_ADVANCED_ROUTER
 	bool "IP: advanced router"
+	depends on IPV4
 	---help---
 	  If you intend to run your Linux box mostly as a router, i.e. as a
 	  computer that forwards and redistributes network packets, say Y; you
@@ -65,7 +80,7 @@ config IP_FIB_TRIE
 	bool "FIB_TRIE"
 	---help---
 	Use new experimental LC-trie as FIB lookup algorithm. 
-        This improves lookup performance if you have a large
+	This improves lookup performance if you have a large
 	number of routes.
 
 	LC-trie is a longest matching prefix lookup algorithm which
@@ -74,11 +89,11 @@ config IP_FIB_TRIE
 	
 	LC-trie is described in:
 	
- 	IP-address lookup using LC-tries. Stefan Nilsson and Gunnar Karlsson
- 	IEEE Journal on Selected Areas in Communications, 17(6):1083-1092, June 1999
+	IP-address lookup using LC-tries. Stefan Nilsson and Gunnar Karlsson
+	IEEE Journal on Selected Areas in Communications, 17(6):1083-1092, June 1999
 	An experimental study of compression methods for dynamic tries
- 	Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002.
- 	http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/
+	Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002.
+	http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/
        
 endchoice
 
@@ -128,13 +143,13 @@ config IP_ROUTE_MULTIPATH_CACHED
 
 config IP_ROUTE_MULTIPATH_RR
 	tristate "MULTIPATH: round robin algorithm"
-	depends on IP_ROUTE_MULTIPATH_CACHED
+	depends on IPV4 && IP_ROUTE_MULTIPATH_CACHED
 	help
 	  Multipath routes are chosen according to Round Robin
 
 config IP_ROUTE_MULTIPATH_RANDOM
 	tristate "MULTIPATH: random algorithm"
-	depends on IP_ROUTE_MULTIPATH_CACHED
+	depends on IPV4 && IP_ROUTE_MULTIPATH_CACHED
 	help
 	  Multipath routes are chosen in a random fashion. Actually,
 	  there is no weight for a route. The advantage of this policy
@@ -143,7 +158,7 @@ config IP_ROUTE_MULTIPATH_RANDOM
 
 config IP_ROUTE_MULTIPATH_WRANDOM
 	tristate "MULTIPATH: weighted random algorithm"
-	depends on IP_ROUTE_MULTIPATH_CACHED
+	depends on IPV4 && IP_ROUTE_MULTIPATH_CACHED
 	help
 	  Multipath routes are chosen in a weighted random fashion. 
 	  The per route weights are the weights visible via ip route 2. As the
@@ -152,7 +167,7 @@ config IP_ROUTE_MULTIPATH_WRANDOM
 
 config IP_ROUTE_MULTIPATH_DRR
 	tristate "MULTIPATH: interface round robin algorithm"
-	depends on IP_ROUTE_MULTIPATH_CACHED
+	depends on IPV4 && IP_ROUTE_MULTIPATH_CACHED
 	help
 	  Connections are distributed in a round robin fashion over the
 	  available interfaces. This policy makes sense if the connections 
@@ -169,8 +184,11 @@ config IP_ROUTE_VERBOSE
 	  handled by the klogd daemon which is responsible for kernel messages
 	  ("man klogd").
 
+if IPV4=y
+
 config IP_PNP
 	bool "IP: kernel level autoconfiguration"
+	depends on IPV4
 	help
 	  This enables automatic configuration of IP addresses of devices and
 	  of the routing table during kernel boot, based on either information
@@ -226,9 +244,13 @@ config IP_PNP_RARP
 	  details.
 
 # not yet ready..
-#   bool '    IP: ARP support' CONFIG_IP_PNP_ARP		
+#   bool '    IP: ARP support' CONFIG_IP_PNP_ARP
+
+endif # IPV4=y
+
 config NET_IPIP
 	tristate "IP: tunneling"
+	depends on IPV4
 	select INET_TUNNEL
 	---help---
 	  Tunneling means encapsulating data of one protocol type within
@@ -246,6 +268,7 @@ config NET_IPIP
 
 config NET_IPGRE
 	tristate "IP: GRE tunnels over IP"
+	depends on IPV4
 	help
 	  Tunneling means encapsulating data of one protocol type within
 	  another protocol and sending it over a channel that understands the
@@ -303,7 +326,7 @@ config IP_PIMSM_V2
 
 config ARPD
 	bool "IP: ARP daemon support (EXPERIMENTAL)"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	---help---
 	  Normally, the kernel maintains an internal cache which maps IP
 	  addresses to hardware addresses on the local network, so that
@@ -328,6 +351,7 @@ config ARPD
 
 config SYN_COOKIES
 	bool "IP: TCP syncookie support (disabled per default)"
+	depends on IPV4
 	---help---
 	  Normal TCP/IP networking is open to an attack known as "SYN
 	  flooding". This denial-of-service attack prevents legitimate remote
@@ -364,6 +388,7 @@ config SYN_COOKIES
 
 config INET_AH
 	tristate "IP: AH transformation"
+	depends on IPV4
 	select XFRM
 	select CRYPTO
 	select CRYPTO_HMAC
@@ -376,6 +401,7 @@ config INET_AH
 
 config INET_ESP
 	tristate "IP: ESP transformation"
+	depends on IPV4
 	select XFRM
 	select CRYPTO
 	select CRYPTO_HMAC
@@ -390,6 +416,7 @@ config INET_ESP
 
 config INET_IPCOMP
 	tristate "IP: IPComp transformation"
+	depends on IPV4
 	select XFRM
 	select INET_XFRM_TUNNEL
 	select CRYPTO
@@ -402,15 +429,18 @@ config INET_IPCOMP
 
 config INET_XFRM_TUNNEL
 	tristate
+	depends on IPV4
 	select INET_TUNNEL
 	default n
 
 config INET_TUNNEL
 	tristate
+	depends on IPV4
 	default n
 
 config INET_XFRM_MODE_TRANSPORT
 	tristate "IP: IPsec transport mode"
+	depends on IPV4
 	default y
 	select XFRM
 	---help---
@@ -420,6 +450,7 @@ config INET_XFRM_MODE_TRANSPORT
 
 config INET_XFRM_MODE_TUNNEL
 	tristate "IP: IPsec tunnel mode"
+	depends on IPV4
 	default y
 	select XFRM
 	---help---
@@ -429,6 +460,7 @@ config INET_XFRM_MODE_TUNNEL
 
 config INET_XFRM_MODE_BEET
 	tristate "IP: IPsec BEET mode"
+	depends on IPV4
 	default y
 	select XFRM
 	---help---
@@ -438,6 +470,7 @@ config INET_XFRM_MODE_BEET
 
 config INET_DIAG
 	tristate "INET: socket monitoring interface"
+	depends on IPV4
 	default y
 	---help---
 	  Support for INET (TCP, DCCP, etc) socket monitoring interface used by
@@ -452,6 +485,7 @@ config INET_TCP_DIAG
 
 menuconfig TCP_CONG_ADVANCED
 	bool "TCP: advanced congestion control"
+	depends on IPV4
 	---help---
 	  Support for selection of various TCP congestion control
 	  modules.
@@ -465,6 +499,7 @@ if TCP_CONG_ADVANCED
 
 config TCP_CONG_BIC
 	tristate "Binary Increase Congestion (BIC) control"
+	depends on IPV4
 	default m
 	---help---
 	BIC-TCP is a sender-side only change that ensures a linear RTT
@@ -479,6 +514,7 @@ config TCP_CONG_BIC
 
 config TCP_CONG_CUBIC
 	tristate "CUBIC TCP"
+	depends on IPV4
 	default y
 	---help---
 	This is version 2.0 of BIC-TCP which uses a cubic growth function
@@ -487,6 +523,7 @@ config TCP_CONG_CUBIC
 
 config TCP_CONG_WESTWOOD
 	tristate "TCP Westwood+"
+	depends on IPV4
 	default m
 	---help---
 	TCP Westwood+ is a sender-side only modification of the TCP Reno
@@ -500,8 +537,9 @@ config TCP_CONG_WESTWOOD
 	wired networks and throughput over wireless links.
 
 config TCP_CONG_HTCP
-        tristate "H-TCP"
-        default m
+	tristate "H-TCP"
+	depends on IPV4
+	default m
 	---help---
 	H-TCP is a send-side only modifications of the TCP Reno
 	protocol stack that optimizes the performance of TCP
@@ -512,18 +550,18 @@ config TCP_CONG_HTCP
 
 config TCP_CONG_HSTCP
 	tristate "High Speed TCP"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	default n
 	---help---
 	Sally Floyd's High Speed TCP (RFC 3649) congestion control.
 	A modification to TCP's congestion control mechanism for use
 	with large congestion windows. A table indicates how much to
 	increase the congestion window by when an ACK is received.
- 	For more detail	see http://www.icir.org/floyd/hstcp.html
+	For more detail	see http://www.icir.org/floyd/hstcp.html
 
 config TCP_CONG_HYBLA
 	tristate "TCP-Hybla congestion control algorithm"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	default n
 	---help---
 	TCP-Hybla is a sender-side only change that eliminates penalization of
@@ -533,7 +571,7 @@ config TCP_CONG_HYBLA
 
 config TCP_CONG_VEGAS
 	tristate "TCP Vegas"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	default n
 	---help---
 	TCP Vegas is a sender-side only change to TCP that anticipates
@@ -544,7 +582,7 @@ config TCP_CONG_VEGAS
 
 config TCP_CONG_SCALABLE
 	tristate "Scalable TCP"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	default n
 	---help---
 	Scalable TCP is a sender-side only change to TCP which uses a
@@ -554,7 +592,7 @@ config TCP_CONG_SCALABLE
 
 config TCP_CONG_LP
 	tristate "TCP Low Priority"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	default n
 	---help---
 	TCP Low Priority (TCP-LP), a distributed algorithm whose goal is
@@ -564,7 +602,7 @@ config TCP_CONG_LP
 
 config TCP_CONG_VENO
 	tristate "TCP Veno"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	default n
 	---help---
 	TCP Veno is a sender-side only enhancement of TCP to obtain better
@@ -576,7 +614,7 @@ config TCP_CONG_VENO
 
 config TCP_CONG_YEAH
 	tristate "YeAH TCP"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	select TCP_CONG_VEGAS
 	default n
 	---help---
@@ -591,7 +629,7 @@ config TCP_CONG_YEAH
 
 config TCP_CONG_ILLINOIS
 	tristate "TCP Illinois"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	default n
 	---help---
 	TCP-Illinois is a sender-side modificatio of TCP Reno for
@@ -633,22 +671,23 @@ endif
 
 config TCP_CONG_CUBIC
 	tristate
-	depends on !TCP_CONG_ADVANCED
-	default y
+	depends on IPV4 && !TCP_CONG_ADVANCED
+	default y if IPV4=y
+        default m
 
 config DEFAULT_TCP_CONG
 	string
+	default "reno" if (IPV4=m || DEFAULT_RENO)
 	default "bic" if DEFAULT_BIC
 	default "cubic" if DEFAULT_CUBIC
 	default "htcp" if DEFAULT_HTCP
 	default "vegas" if DEFAULT_VEGAS
 	default "westwood" if DEFAULT_WESTWOOD
-	default "reno" if DEFAULT_RENO
 	default "cubic"
 
 config TCP_MD5SIG
 	bool "TCP: MD5 Signature Option support (RFC2385) (EXPERIMENTAL)"
-	depends on EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	select CRYPTO
 	select CRYPTO_MD5
 	---help---
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index c02aee0..5416d6b 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -2,7 +2,11 @@
 # Makefile for the Linux TCP/IP (INET) layer.
 #
 
-obj-y     := route.o inetpeer.o protocol.o \
+obj-y += ip_modglue.o
+
+obj-$(CONFIG_IPV4) += ipv4.o
+
+ipv4-objs := route.o inetpeer.o protocol.o \
 	     ip_input.o ip_fragment.o ip_forward.o ip_options.o \
 	     ip_output.o ip_sockglue.o inet_hashtables.o \
 	     inet_timewait_sock.o inet_connection_sock.o \
@@ -13,14 +17,23 @@ obj-y     := route.o inetpeer.o protocol.o \
 	     sysctl_net_ipv4.o fib_frontend.o fib_semantics.o \
 	     random.o
 
-obj-$(CONFIG_IP_FIB_HASH) += fib_hash.o
-obj-$(CONFIG_IP_FIB_TRIE) += fib_trie.o
-obj-$(CONFIG_PROC_FS) += proc.o
-obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
-obj-$(CONFIG_IP_MROUTE) += ipmr.o
+ipv4-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
+		      xfrm4_output.o
+ipv4-$(CONFIG_IP_FIB_HASH) += fib_hash.o
+ipv4-$(CONFIG_IP_FIB_TRIE) += fib_trie.o
+ipv4-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
+ipv4-$(CONFIG_PROC_FS) += proc.o
+ipv4-$(CONFIG_IP_MROUTE) += ipmr.o
+ipv4-$(CONFIG_IP_PNP) += ipconfig.o
+ipv4-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o
+ipv4-$(CONFIG_NETLABEL) += cipso_ipv4.o
+ipv4-$(CONFIG_SYN_COOKIES) += syncookies.o
+ipv4-$(CONFIG_NETFILTER) += netfilter.o
+
+ipv4-objs += $(ipv4-y)
+
 obj-$(CONFIG_NET_IPIP) += ipip.o
 obj-$(CONFIG_NET_IPGRE) += ip_gre.o
-obj-$(CONFIG_SYN_COOKIES) += syncookies.o
 obj-$(CONFIG_INET_AH) += ah4.o
 obj-$(CONFIG_INET_ESP) += esp4.o
 obj-$(CONFIG_INET_IPCOMP) += ipcomp.o
@@ -29,15 +42,13 @@ obj-$(CONFIG_INET_XFRM_MODE_BEET) += xfrm4_mode_beet.o
 obj-$(CONFIG_INET_TUNNEL) += tunnel4.o
 obj-$(CONFIG_INET_XFRM_MODE_TRANSPORT) += xfrm4_mode_transport.o
 obj-$(CONFIG_INET_XFRM_MODE_TUNNEL) += xfrm4_mode_tunnel.o
-obj-$(CONFIG_IP_PNP) += ipconfig.o
 obj-$(CONFIG_IP_ROUTE_MULTIPATH_RR) += multipath_rr.o
 obj-$(CONFIG_IP_ROUTE_MULTIPATH_RANDOM) += multipath_random.o
 obj-$(CONFIG_IP_ROUTE_MULTIPATH_WRANDOM) += multipath_wrandom.o
 obj-$(CONFIG_IP_ROUTE_MULTIPATH_DRR) += multipath_drr.o
-obj-$(CONFIG_NETFILTER)	+= netfilter.o netfilter/
+obj-$(CONFIG_NETFILTER)	+= netfilter/
 obj-$(CONFIG_IP_VS) += ipvs/
 obj-$(CONFIG_INET_DIAG) += inet_diag.o 
-obj-$(CONFIG_IP_ROUTE_MULTIPATH_CACHED) += multipath.o
 obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o
 obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o
 obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o
@@ -52,7 +63,3 @@ obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o
 obj-$(CONFIG_TCP_CONG_LP) += tcp_lp.o
 obj-$(CONFIG_TCP_CONG_YEAH) += tcp_yeah.o
 obj-$(CONFIG_TCP_CONG_ILLINOIS) += tcp_illinois.o
-obj-$(CONFIG_NETLABEL) += cipso_ipv4.o
-
-obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
-		      xfrm4_output.o
diff --git a/net/ipv4/ipvs/Kconfig b/net/ipv4/ipvs/Kconfig
index 09d0c3f..52ef992 100644
--- a/net/ipv4/ipvs/Kconfig
+++ b/net/ipv4/ipvs/Kconfig
@@ -3,7 +3,7 @@
 #
 menuconfig IP_VS
 	tristate "IP virtual server support (EXPERIMENTAL)"
-	depends on NETFILTER
+	depends on IPV4 && NETFILTER
 	---help---
 	  IP Virtual Server support will let you build a high-performance
 	  virtual server based on cluster of two or more real servers. This
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 46509fa..4607874 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -3,7 +3,7 @@
 #
 
 menu "IP: Netfilter Configuration"
-	depends on INET && NETFILTER
+	depends on INET && IPV4 && NETFILTER
 
 config NF_CONNTRACK_IPV4
 	tristate "IPv4 connection tracking support (required for NAT)"
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 8e5d54f..d099d3a 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -5,6 +5,7 @@
 #   IPv6 as module will cause a CRASH if you try to unload it
 config IPV6
 	tristate "The IPv6 protocol"
+        depends on IPV4
 	default m
 	---help---
 	  This is complemental support for the IP version 6.
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index a567dae..715cfd9 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -133,7 +133,7 @@ config NF_CONNTRACK_FTP
 
 config NF_CONNTRACK_H323
 	tristate "H.323 protocol support (EXPERIMENTAL)"
-	depends on EXPERIMENTAL && NF_CONNTRACK && (IPV6 || IPV6=n)
+	depends on EXPERIMENTAL && NF_CONNTRACK && INET && (IPV4 || IPV4=n) && (IPV6 || IPV6=n)
 	help
 	  H.323 is a VoIP signalling protocol from ITU-T. As one of the most
 	  important VoIP protocols, it is widely used by voice hardware and
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index 8210f54..36a4a83 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -5,6 +5,7 @@
 menuconfig IP_SCTP
 	tristate "The SCTP Protocol (EXPERIMENTAL)"
 	depends on INET && EXPERIMENTAL
+	depends on IPV4 || IPV4=n
 	depends on IPV6 || IPV6=n
 	select CRYPTO if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5
 	select CRYPTO_HMAC if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index 3b30d11..4374b30 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -4,7 +4,7 @@
 
 menuconfig TIPC
 	tristate "The TIPC Protocol (EXPERIMENTAL)"
-	depends on INET && EXPERIMENTAL
+	depends on IPV4 && EXPERIMENTAL
 	---help---
 	  The Transparent Inter Process Communication (TIPC) protocol is
 	  specially designed for intra cluster communication. This protocol
-- 
1.5.2.5


