patch-2.0.32 linux/net/ipv4/rarp.c
Next file: linux/net/ipv4/tcp_input.c
Previous file: linux/net/ipv4/ip_masq_quake.c
Back to the patch index
Back to the overall index
- Lines: 61
- Date:
Wed Nov 12 20:36:41 1997
- Orig file:
v2.0.31/linux/net/ipv4/rarp.c
- Orig date:
Tue Aug 12 11:30:35 1997
diff -u --recursive --new-file v2.0.31/linux/net/ipv4/rarp.c linux/net/ipv4/rarp.c
@@ -175,6 +175,8 @@
NULL,
0
};
+
+static int rarp_pkt_inited=0;
static void rarp_init_pkt (void)
{
@@ -182,8 +184,19 @@
rarp_packet_type.type=htons(ETH_P_RARP);
dev_add_pack(&rarp_packet_type);
register_netdevice_notifier(&rarp_dev_notifier);
+ rarp_pkt_inited=1;
+}
+
+static void rarp_end_pkt(void)
+{
+ if(!rarp_pkt_inited)
+ return;
+ dev_remove_pack(&rarp_packet_type);
+ unregister_netdevice_notifier(&rarp_dev_notifier);
+ rarp_pkt_inited=0;
}
+
/*
* Receive an arp request by the device layer. Maybe it should be
* rewritten to use the incoming packet for the reply. The current
@@ -574,12 +587,14 @@
void
rarp_init(void)
{
+#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_RARP, 4, "rarp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rarp_get_info
});
+#endif
rarp_ioctl_hook = rarp_ioctl;
}
@@ -594,7 +609,9 @@
void cleanup_module(void)
{
struct rarp_table *rt, *rt_next;
+#ifdef CONFIG_PROC_FS
proc_net_unregister(PROC_NET_RARP);
+#endif
rarp_ioctl_hook = NULL;
cli();
/* Destroy the RARP-table */
@@ -606,5 +623,6 @@
rt_next = rt->next;
rarp_release_entry(rt);
}
+ rarp_end_pkt();
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov