patch-2.1.89 linux/include/linux/inetdevice.h

Next file: linux/include/linux/ipv6_route.h
Previous file: linux/include/linux/in_route.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.88/linux/include/linux/inetdevice.h linux/include/linux/inetdevice.h
@@ -1,20 +1,26 @@
 #ifndef _LINUX_INETDEVICE_H
 #define _LINUX_INETDEVICE_H
 
-/* IPv4 specific flags. They are initialized from global sysctl variables,
-   when IPv4 is initialized.
- */
-
-#define IFF_IP_FORWARD		1
-#define IFF_IP_PROXYARP		2
-#define IFF_IP_RXREDIRECTS	4
-#define IFF_IP_TXREDIRECTS	8
-#define IFF_IP_SHAREDMEDIA	0x10
-#define IFF_IP_MFORWARD		0x20
-#define IFF_IP_RPFILTER		0x40
-
 #ifdef __KERNEL__
 
+struct ipv4_devconf
+{
+	int	accept_redirects;
+	int	send_redirects;
+	int	secure_redirects;
+	int	shared_media;
+	int	accept_source_route;
+	int	rp_filter;
+	int	proxy_arp;
+	int	bootp_relay;
+	int	log_martians;
+	int	forwarding;
+	int	mc_forwarding;
+	void	*sysctl;
+};
+
+extern struct ipv4_devconf ipv4_devconf;
+
 struct in_device
 {
 	struct device		*dev;
@@ -23,16 +29,26 @@
 	unsigned long		mr_v1_seen;
 	unsigned		flags;
 	struct neigh_parms	*arp_parms;
+	struct ipv4_devconf	cnf;
 };
 
-
-#define IN_DEV_RPFILTER(in_dev)	(ipv4_config.rfc1812_filter && ((in_dev)->flags&IFF_IP_RPFILTER))
-#define IN_DEV_MFORWARD(in_dev)	(ipv4_config.multicast_route && ((in_dev)->flags&IFF_IP_MFORWARD))
-#define IN_DEV_PROXY_ARP(in_dev)	(ipv4_config.proxy_arp || (in_dev)->flags&IFF_IP_PROXYARP)
-#define IN_DEV_FORWARD(in_dev)		(IS_ROUTER || ((in_dev)->flags&IFF_IP_FORWARD))
-#define IN_DEV_SHARED_MEDIA(in_dev)	(ipv4_config.rfc1620_redirects || (in_dev)->flags&IFF_IP_SHAREDMEDIA)
-#define IN_DEV_RX_REDIRECTS(in_dev)	(ipv4_config.accept_redirects || (in_dev)->flags&IFF_IP_RXREDIRECTS)
-#define IN_DEV_TX_REDIRECTS(in_dev)	(/*ipv4_config.send_redirects ||*/ (in_dev)->flags&IFF_IP_TXREDIRECTS)
+#define IN_DEV_FORWARD(in_dev)		((in_dev)->cnf.forwarding)
+#define IN_DEV_MFORWARD(in_dev)		(ipv4_devconf.mc_forwarding && (in_dev)->cnf.mc_forwarding)
+#define IN_DEV_RPFILTER(in_dev)		(ipv4_devconf.rp_filter && (in_dev)->cnf.rp_filter)
+#define IN_DEV_SOURCE_ROUTE(in_dev)	(ipv4_devconf.accept_source_route && (in_dev)->cnf.accept_source_route)
+#define IN_DEV_BOOTP_RELAY(in_dev)	(ipv4_devconf.bootp_relay && (in_dev)->cnf.bootp_relay)
+
+#define IN_DEV_LOG_MARTIANS(in_dev)	(ipv4_devconf.log_martians || (in_dev)->cnf.log_martians)
+#define IN_DEV_PROXY_ARP(in_dev)	(ipv4_devconf.proxy_arp || (in_dev)->cnf.proxy_arp)
+#define IN_DEV_SHARED_MEDIA(in_dev)	(ipv4_devconf.shared_media || (in_dev)->cnf.shared_media)
+#define IN_DEV_TX_REDIRECTS(in_dev)	(ipv4_devconf.send_redirects || (in_dev)->cnf.send_redirects)
+#define IN_DEV_SEC_REDIRECTS(in_dev)	(ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects)
+
+#define IN_DEV_RX_REDIRECTS(in_dev) \
+	((IN_DEV_FORWARD(in_dev) && \
+	  (ipv4_devconf.accept_redirects && (in_dev)->cnf.accept_redirects)) \
+	 || (!IN_DEV_FORWARD(in_dev) && \
+	  (ipv4_devconf.accept_redirects || (in_dev)->cnf.accept_redirects)))
 
 struct in_ifaddr
 {
@@ -62,6 +78,7 @@
 extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask);
 extern int		inet_add_bootp_addr(struct device *dev);
 extern void		inet_del_bootp_addr(struct device *dev);
+extern void		inet_forward_change(void);
 
 extern __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa)
 {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov