I have been working on a project to add Multi Protocol
Label Switching (MPLS) to the Linux kernel for the last 2
years. Being that MPLS is usless without some IPv4 interaction
I was forced to modify the IPv4 stack to "play well with others".
Through all of this work I had to make what seem to be minor
changes, but make a big difference when considering their
interaction with other protocols (think layer 2.5).
Please consider these changes for integrating into
the 2.5 kernel.
Thanks,
Jim
--
James R. Leu
----------------------------- snip ------------------------
diff -uNr --exclude=CVS mainstream-2.4/include/net/ip.h
mpls-linux-1.1/include/net/ip.h
--- mainstream-2.4/include/net/ip.h Tue May 29 12:40:52 2001
+++ mpls-linux-1.1/include/net/ip.h Sun Jan 6 20:33:34 2002
@@ -162,9 +162,9 @@
static inline int ip_send(struct sk_buff *skb)
{
if (skb->len > skb->dst->pmtu)
- return ip_fragment(skb, ip_finish_output);
+ return ip_fragment(skb,skb->dst->output);
else
- return ip_finish_output(skb);
+ return skb->dst->output(skb);
}
/* The function in 2.2 was invalid, producing wrong result for
diff -uNr --exclude=CVS mainstream-2.4/net/core/neighbour.c
mpls-linux-1.1/net/core/neighbour.c
--- mainstream-2.4/net/core/neighbour.c Wed Jan 9 18:01:10 2002
+++ mpls-linux-1.1/net/core/neighbour.c Wed Jan 9 18:38:20 2002
@@ -963,7 +963,7 @@
if (dev->hard_header_cache && dst->hh == NULL) {
write_lock_bh(&neigh->lock);
if (dst->hh == NULL)
- neigh_hh_init(neigh, dst, dst->ops->protocol);
+ neigh_hh_init(neigh, dst, skb->protocol);
err = dev->hard_header(skb, dev, ntohs(skb->protocol),
neigh->ha, NULL, skb->len);
write_unlock_bh(&neigh->lock);
} else {
diff -uNr --exclude=CVS mainstream-2.4/net/ipv4/ip_output.c
mpls-linux-1.1/net/ipv4/ip_output.c
--- mainstream-2.4/net/ipv4/ip_output.c Tue Oct 30 20:52:01 2001
+++ mpls-linux-1.1/net/ipv4/ip_output.c Tue Oct 30 21:30:48 2001
@@ -113,6 +113,7 @@
static inline int
output_maybe_reroute(struct sk_buff *skb)
{
+ skb->protocol = __constant_htons(ETH_P_IP);
return skb->dst->output(skb);
}
diff -uNr --exclude=CVS mainstream-2.4/net/ipv4/route.c
mpls-linux-1.1/net/ipv4/route.c
--- mainstream-2.4/net/ipv4/route.c Wed Jan 9 18:01:10 2002
+++ mpls-linux-1.1/net/ipv4/route.c Wed Jan 9 19:05:50 2002
@@ -1480,7 +1480,7 @@
rth->rt_spec_dst= spec_dst;
rth->u.dst.input = ip_forward;
- rth->u.dst.output = ip_output;
+ rth->u.dst.output = ip_finish_output;
rt_set_nexthop(rth, &res, itag);
|