Patch for 2.1.42 to make DLCI module

rjc@snoopy.virtual.net.au
Sat, 31 May 1997 14:32:16 +1000 (EST)


Here's a patch I've written to allow dlci to be compiled as a module and
insmodded into a kernel. It would previously give an error that it couldn't
find symbol "dlci_ioctl_hook".
I have tested this by inserting it into a running kernel and then rmmodding
it again. I have not yet got any frame hardware to test this module properly,
but it definately works better than before and I'm pretty sure I haven't broken
anything.

One thing I'm not sure about is the code in the makefile which sets the
af_inet.o file to have a symbol table. Is having a symbol table when it's
not really needed a very bad thing? If not should I set it to be always in
IPV4X_OBJS and skip all the ifeq code in the makefile?

Russell Coker

diff -r -c5 linux/net/ipv4/Makefile linux-patch/net/ipv4/Makefile
*** linux/net/ipv4/Makefile Fri Mar 21 13:17:13 1997
--- linux-patch/net/ipv4/Makefile Sat May 31 14:12:16 1997
***************
*** 10,25 ****
O_TARGET := ipv4.o
IPV4_OBJS := utils.o route.o proc.o timer.o protocol.o packet.o \
ip_input.o ip_fragment.o ip_forward.o ip_options.o \
ip_output.o ip_sockglue.o \
tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o\
! raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o ip_fw.o \
sysctl_net_ipv4.o fib.o ip_nat_dumb.o
IPV4X_OBJS :=

MOD_LIST_NAME := IPV4_MODULES
M_OBJS :=

ifeq ($(CONFIG_IP_MROUTE),y)
IPV4_OBJS += ipmr.o
endif

--- 10,35 ----
O_TARGET := ipv4.o
IPV4_OBJS := utils.o route.o proc.o timer.o protocol.o packet.o \
ip_input.o ip_fragment.o ip_forward.o ip_options.o \
ip_output.o ip_sockglue.o \
tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o\
! raw.o udp.o arp.o icmp.o devinet.o igmp.o ip_fw.o \
sysctl_net_ipv4.o fib.o ip_nat_dumb.o
IPV4X_OBJS :=

MOD_LIST_NAME := IPV4_MODULES
M_OBJS :=
+
+ ifeq ($(CONFIG_DLCI),y)
+ IPV4X_OBJS += af_inet.o
+ else
+ ifeq ($(CONFIG_DLCI),m)
+ IPV4X_OBJS += af_inet.o
+ else
+ IPV4_OBJS += af_inet.o
+ endif
+ endif

ifeq ($(CONFIG_IP_MROUTE),y)
IPV4_OBJS += ipmr.o
endif

diff -r -c5 linux/net/ipv4/af_inet.c linux-patch/net/ipv4/af_inet.c
*** linux/net/ipv4/af_inet.c Tue May 13 03:35:44 1997
--- linux-patch/net/ipv4/af_inet.c Sat May 31 14:12:05 1997
***************
*** 58,67 ****
--- 58,70 ----
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/

#include <linux/config.h>
+ #ifdef CONFIG_DLCI_MODULE
+ #include <linux/module.h>
+ #endif
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/kernel.h>
***************
*** 126,135 ****
--- 129,139 ----
extern int dlci_ioctl(unsigned int, void*);
#endif

#ifdef CONFIG_DLCI_MODULE
int (*dlci_ioctl_hook)(unsigned int, void *) = NULL;
+ EXPORT_SYMBOL(dlci_ioctl_hook);
#endif

int (*rarp_ioctl_hook)(unsigned int,void*) = NULL;

/*