patch-2.4.21 linux-2.4.21/net/ipv4/af_inet.c
Next file: linux-2.4.21/net/ipv4/devinet.c
Previous file: linux-2.4.21/net/econet/af_econet.c
Back to the patch index
Back to the overall index
- Lines: 62
- Date:
2003-06-13 07:51:39.000000000 -0700
- Orig file:
linux-2.4.20/net/ipv4/af_inet.c
- Orig date:
2002-08-02 17:39:46.000000000 -0700
diff -urN linux-2.4.20/net/ipv4/af_inet.c linux-2.4.21/net/ipv4/af_inet.c
@@ -1038,6 +1038,7 @@
struct list_head *lh;
struct inet_protosw *answer;
int protocol = p->protocol;
+ struct list_head *last_perm;
br_write_lock_bh(BR_NETPROTO_LOCK);
@@ -1046,24 +1047,29 @@
/* If we are trying to override a permanent protocol, bail. */
answer = NULL;
+ last_perm = &inetsw[p->type];
list_for_each(lh, &inetsw[p->type]) {
answer = list_entry(lh, struct inet_protosw, list);
/* Check only the non-wild match. */
- if (protocol == answer->protocol &&
- (INET_PROTOSW_PERMANENT & answer->flags))
- break;
+ if (INET_PROTOSW_PERMANENT & answer->flags) {
+ if (protocol == answer->protocol)
+ break;
+ last_perm = lh;
+ }
answer = NULL;
}
if (answer)
goto out_permanent;
- /* Add to the BEGINNING so that we override any existing
- * entry. This means that when we remove this entry, the
+ /* Add the new entry after the last permanent entry if any, so that
+ * the new entry does not override a permanent entry when matched with
+ * a wild-card protocol. But it is allowed to override any existing
+ * non-permanent entry. This means that when we remove this entry, the
* system automatically returns to the old behavior.
*/
- list_add(&p->list, &inetsw[p->type]);
+ list_add(&p->list, last_perm);
out:
br_write_unlock_bh(BR_NETPROTO_LOCK);
return;
@@ -1094,6 +1100,7 @@
}
}
+extern void ipfrag_init(void);
/*
* Called by socket.c on kernel startup.
@@ -1190,6 +1197,9 @@
proc_net_create ("tcp", 0, tcp_get_info);
proc_net_create ("udp", 0, udp_get_info);
#endif /* CONFIG_PROC_FS */
+
+ ipfrag_init();
+
return 0;
}
module_init(inet_init);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)