* Re: Netlink connector
From: Evgeniy Polyakov @ 2005-07-25 19:28 UTC (permalink / raw)
To: Patrick McHardy
Cc: Andrew Morton, Harald Welte, netdev, netfilter-devel,
linux-kernel
In-Reply-To: <42E4F800.1010908@trash.net>
On Mon, Jul 25, 2005 at 04:32:32PM +0200, Patrick McHardy (kaber@trash.net) wrote:
> Evgeniy Polyakov wrote:
> >On Mon, Jul 25, 2005 at 02:02:10AM -0400, James Morris
> >(jmorris@redhat.com) wrote:
> >
> >>On Sun, 24 Jul 2005, David S. Miller wrote:
> >>
> >>>From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
> >>>Date: Sat, 23 Jul 2005 13:14:55 +0400
> >>>
> >>>
> >>>>Andrew has no objection against connector and it lives in -mm
> >>>
> >>>A patch sitting in -mm has zero significance.
> >
> >That is why I'm asking netdev@ people again...
>
> If I understand correctly it tries to workaround some netlink
> limitations (limited number of netlink families and multicast groups)
> by sending everything to userspace and demultiplexing it there.
> Same in the other direction, an additional layer on top of netlink
> does basically the same thing netlink already does. This looks like
> a step in the wrong direction to me, netlink should instead be fixed
> to support what is needed.
Not only it.
The main _first_ idea was to simplify userspace mesasge handling as much
as possible.
In first releases I called it ioctl-ng - any module that want ot
communicate with userspace in the way ioctl does,
requires skb allocation/freeing/handling.
Does RTC driver writer need to know what is the difference between
shared and cloned skb? Should kernel user of such message bus
have to know about skb at all?
With char device I only need to register my callback - with kernel
connector it is the same, but allows to use the whole power of netlink,
especially without nice ioctl features like different pointer size
in userspace and kernelspace.
And number of free netlink sockets is _very_ small, especially
if allocate new one for simple notifications, which can be easily done
using connector.
No need to allocate skb, no need to know who are those monsters in
header and so on.
And netlink can be extended to support it - netlink is a transport
protocol, it should not care about higher layer message handling,
connector instead will deliver message to the end user in a very
convenient form.
P.S. I've removed netdev@redhat.com - please do not add subscribers-only
private mail lists.
--
Evgeniy Polyakov
^ permalink raw reply
* Re: Re: drop counts
From: Jesse Brandeburg @ 2005-07-25 17:47 UTC (permalink / raw)
To: P; +Cc: netdev, e1000-devel
In-Reply-To: <42DFA4E9.5060602@draigBrady.com>
On Thu, 21 Jul 2005, P@draigBrady.com wrote:
> > dropped: rnbc does not mean dropped, see above. mpc means dropped.
> >
> > fifo: mpc means the fifo overflowed, and the packet was dropped (the
> > only time we drop).
> >
> > missed: this should also be mpc because it shows we missed the packet.
>
> Wow, thanks! So there we were reporting drops prior
> to 2.6.12 when there possibly were none!
yeah, that was kind of ugly.
> It's interesting that at about 1Mpps sustained for 10s,
> mpc was 548,888, while rnbc was 4,331,730 suggesting
> that the nic was trying to DMA to the buffer at a
> higher rate than the packet receive rate.
Not really that interesting because the NIC may have been trying multiple
times internally to DMA the data (possibly as each packet was received)
and failing each time.
> 2.6.11 stats were mapped like:
>
> packets = gprc
> dropped = rnbc
> fifo = mpc
> missed = mpc
>
> In 2.6.12 this changed to:
>
> packets = gprc
> dropped = mpc
> fifo = mpc
> missed = mpc
>
> > now, its debatable if we should be reporting the same stat 3 times, but
> > i still think it is correct, and its how our hardware maps stats and the
> > best we can overlay onto linux's definitions as we interpret them.
>
> I think there still is a problem. Notice that /proc/net/dev
> reports rx_dropped + rx_missed_errors for the drop column,
> and so will be double counting drops currently.
> Therefore I think we should be doing:
>
> packets = gprc
> dropped = 0
> fifo = rnbc
> missed = mpc
Double counting drops may be an issue, and I believe we should make that
change. but I don't think its the right thing to report rnbc in fifo
errors (there was actually no error).
> I'm putting rnbc in fifo as it's not accumulated into
> anything else in the kernel. Also it's good to have
> it reported as one can see when there is pressure on
> the e1000 driver buffer. This is useful for tuning its size
> to protect against drops and latency.
Whenever I want the RNBC numbers I simply look into ethtool -S eth0, and
that allows me to tune. I see no reason to "reuse" the fifo errors stat
with misleading data.
Once again, having clear guidelines on what these stats actually mean for
drivers and when they should use them for ethernet would be *really*
useful.
Jesse
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
^ permalink raw reply
* Re: [uml-devel] multicast on loopback: mcast networking at the cottage
From: stian @ 2005-07-25 17:20 UTC (permalink / raw)
To: Michael Richardson; +Cc: user-mode-linux-devel, netdev
In-Reply-To: <6048.1122248129@marajade.sandelman.ottawa.on.ca>
> I suspect that for people who want to do multicast between hosts on an
> actual wire won't want to have just a route to lo, they may want a route
> for 224.0.0.0/4 on all of their interfaces. Maybe that should be
> automatic?
>
> I think that applications that are multicast aware are supposed to
> figure out which interfaces that they want to bind to anyway, so they
> should not be confused by the multiple routes.
If I remember things right (I might be wrong here):
ipv6 does this automatically, so should ipv4 have done too if multicast is
supported on a device. Multicast aware programs should always bind to a
device, or broadcast on all devices for discovery.
This is not uml-specific, but vanilla kernel. Some distroes add
multicast-routing for ipv4 during init scripts.
Stian
^ permalink raw reply
* Re: Netlink connector
From: Eric Leblond @ 2005-07-25 14:43 UTC (permalink / raw)
To: Patrick McHardy
Cc: Evgeniy Polyakov, Andrew Morton, Harald Welte, netdev,
netfilter-devel, linux-kernel, netdev
In-Reply-To: <42E4F800.1010908@trash.net>
Le lundi 25 juillet 2005 à 16:32 +0200, Patrick McHardy a écrit :
> Evgeniy Polyakov wrote:
> > On Mon, Jul 25, 2005 at 02:02:10AM -0400, James Morris (jmorris@redhat.com) wrote:
> If I understand correctly it tries to workaround some netlink
> limitations (limited number of netlink families and multicast groups)
> by sending everything to userspace and demultiplexing it there.
> Same in the other direction, an additional layer on top of netlink
> does basically the same thing netlink already does. This looks like
> a step in the wrong direction to me, netlink should instead be fixed
> to support what is needed.
I totally agree with you, it could be great to fix netlink to support
multiple queue.
I like to be able to use projects like snort-inline or nufw together.
This will make Netfilter really stronger.
Furthermore, there's a repetition of filtering capabilities with such a
solution. Netfilter has to filter to send to netlink and this is the
same with the queue dispatcher. I think this introduce too much
complexity.
my 0.02$
BR,
--
Éric Leblond, eleblond@inl.fr
Téléphone : 01 44 89 46 40, Fax : 01 44 89 45 01
INL, http://www.inl.fr
^ permalink raw reply
* Re: Netlink connector
From: Patrick McHardy @ 2005-07-25 14:32 UTC (permalink / raw)
To: Evgeniy Polyakov
Cc: Andrew Morton, Harald Welte, netdev, netfilter-devel,
linux-kernel, netdev
In-Reply-To: <20050725070603.GA28023@2ka.mipt.ru>
Evgeniy Polyakov wrote:
> On Mon, Jul 25, 2005 at 02:02:10AM -0400, James Morris (jmorris@redhat.com) wrote:
>
>>On Sun, 24 Jul 2005, David S. Miller wrote:
>>
>>>From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
>>>Date: Sat, 23 Jul 2005 13:14:55 +0400
>>>
>>>
>>>>Andrew has no objection against connector and it lives in -mm
>>>
>>>A patch sitting in -mm has zero significance.
>
> That is why I'm asking netdev@ people again...
If I understand correctly it tries to workaround some netlink
limitations (limited number of netlink families and multicast groups)
by sending everything to userspace and demultiplexing it there.
Same in the other direction, an additional layer on top of netlink
does basically the same thing netlink already does. This looks like
a step in the wrong direction to me, netlink should instead be fixed
to support what is needed.
^ permalink raw reply
* Re: [Hipsec] [PATCH 2.6.12.2] XFRM: BEET IPsec mode for Linux
From: Diego Beltrami @ 2005-07-25 13:28 UTC (permalink / raw)
To: netdev
In-Reply-To: <1122295307.14873.37.camel@odysse>
Folks,
I'm sorry but the sent patch included in the email seems to be broken.
Please, use the URL
http://hipl.hiit.fi/beet/beet-patch-v1.0-2.6.12.2
Sincerely
> Hi folks,
>
> we have been working for three months to implement a new IPsec mode,
> the "BEET" mode, for Linux. Below is a link to the BEET specification
> and
> the abstract:
>
> http://www.ietf.org/internet-drafts/draft-nikander-esp-beet-mode-03.txt
>
> Abstract
>
> This document specifies a new mode, called Bound End-to-End Tunnel
> (BEET) mode, for IPsec ESP. The new mode augments the existing ESP
> tunnel and transport modes. For end-to-end tunnels, the new mode
> provides limited tunnel mode semantics without the regular tunnel
> mode overhead. The mode is intended to support new uses of ESP,
> including mobility and multi-address multi-homing.
>
> The BEET mode is required by the Host Identity Protocol (HIP), which
> provides authenticated Diffie-Hellman for end-hosts, as well as
> mobility and multihoming support. The BEET mode is also useful for
> other similar protocols being developed at the IETF.
>
> Ericsson has already developed a BEET patch for *BSD. Our patch
> provides the similar functionality, but using the XFRM architecture.
> The patch is included at the end of this email and also at the following
> URL:
> http://hipl.hiit.fi/beet/beet-patch-v1.0-2.6.12.2
>
> We have made some testing in order to assure the quality of the
> patch. All the tests passed, and below is a list of them:
>
> * Does not break transport and tunnel mode (with CONFIG_XFRM_BEET
> on/off)
> * All inner-outer combinations with varying test applications:
> ICMP, ICMPv6, FTP, SSH, nc, nc6
> * Works with fragmented packets
> * Interoperability with HIPL
> * Real machines, virtual machines (vmware)
> * Tested with long data streams
>
> The BEET development team:
>
> * Abhinav Pathak <abpathak@iitk.ac.in> (InfraHIP/HIIT)
> * Diego Beltrami <diego.beltrami@hiit.fi> (InfraHIP/HIIT)
> * Kristian Slavov <kristian.slavov@nomadiclab.com> (Ericsson)
> * Miika Komu <miika@iki.fi> (InfraHIP/HIIT)
> * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com> (Boeing)
>
> On the behalf of the BEET development team,
>
> Signed-off-by: Diego Beltrami <diego.beltrami@hiit.fi>
>
>
>
^ permalink raw reply
* [PATCH 2.6.12.2] XFRM: BEET IPsec mode for Linux
From: Diego Beltrami @ 2005-07-25 12:41 UTC (permalink / raw)
To: netdev
Cc: infrahip, gurtov, jeffrey.m.ahrenholz, kristian.slavov,
hipl-users, hipsec
Hi folks,
we have been working for three months to implement a new IPsec mode,
the "BEET" mode, for Linux. Below is a link to the BEET specification
and
the abstract:
http://www.ietf.org/internet-drafts/draft-nikander-esp-beet-mode-03.txt
Abstract
This document specifies a new mode, called Bound End-to-End Tunnel
(BEET) mode, for IPsec ESP. The new mode augments the existing ESP
tunnel and transport modes. For end-to-end tunnels, the new mode
provides limited tunnel mode semantics without the regular tunnel
mode overhead. The mode is intended to support new uses of ESP,
including mobility and multi-address multi-homing.
The BEET mode is required by the Host Identity Protocol (HIP), which
provides authenticated Diffie-Hellman for end-hosts, as well as
mobility and multihoming support. The BEET mode is also useful for
other similar protocols being developed at the IETF.
Ericsson has already developed a BEET patch for *BSD. Our patch
provides the similar functionality, but using the XFRM architecture.
The patch is included at the end of this email and also at the following
URL:
http://hipl.hiit.fi/beet/beet-patch-v1.0-2.6.12.2
We have made some testing in order to assure the quality of the
patch. All the tests passed, and below is a list of them:
* Does not break transport and tunnel mode (with CONFIG_XFRM_BEET
on/off)
* All inner-outer combinations with varying test applications:
ICMP, ICMPv6, FTP, SSH, nc, nc6
* Works with fragmented packets
* Interoperability with HIPL
* Real machines, virtual machines (vmware)
* Tested with long data streams
The BEET development team:
* Abhinav Pathak <abpathak@iitk.ac.in> (InfraHIP/HIIT)
* Diego Beltrami <diego.beltrami@hiit.fi> (InfraHIP/HIIT)
* Kristian Slavov <kristian.slavov@nomadiclab.com> (Ericsson)
* Miika Komu <miika@iki.fi> (InfraHIP/HIIT)
* Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com> (Boeing)
On the behalf of the BEET development team,
Signed-off-by: Diego Beltrami <diego.beltrami@hiit.fi>
diff -urN linux-2.6.12.2/Documentation/README.BEET
linux-beet-2.6.12.2/Documentation/README.BEET
--- linux-2.6.12.2/Documentation/README.BEET 1970-01-01
02:00:00.000000000 +0200
+++ linux-beet-2.6.12.2/Documentation/README.BEET 2005-07-25
14:39:36.000000000 +0300
@@ -0,0 +1,465 @@
+Linux BEET-mode ESP patch
+
+Authors: Miika Komu <miika@iki.fi>
+ Kristian Slavov <kristian.slavov@nomadiclab.com>
+ Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ Abhinav Pathak <abpathak@iitk.ac.in>
+ Diego Beltrami <diego.beltrami@hiit.fi>
+
+Changelog: May 25, 2005 this document created
+
+
+Description
+-----------
+This patch extends the native Linux 2.6 kernel IPsec to support
+Bound-End-to-End-Tunnel (BEET) mode for ESP:
+
+Abstract
+
+ This document specifies a new mode, called Bound End-to-End Tunnel
+ (BEET) mode, for IPsec ESP. The new mode augments the existing ESP
+ tunnel and transport modes. For end-to-end tunnels, the new mode
+ provides limited tunnel mode semantics without the regular tunnel
+ mode overhead. The mode is intended to support new uses of ESP,
+ including mobility and multi-address multi-homing.
+
+http://www.ietf.org/internet-drafts/draft-nikander-esp-beet-mode-03.txt
+
+BEET mode architecture
+----------------------
+
+Below are some control flow diagrams to illustrate how BEET works.
+
+Sending (inner IPv4, outer IPv4)(4-4)
+=====================================
+inet_sendmsg
+ raw_sendmsg
+ ip_route_output_flow
+ __ip_route_output_key
+ xfrm_lookup
+ flow_cache_lookup
+ xfrm_policy_lookup // lookup IPsec policy
+ xfrm_find_bundle // lookup IPsec SA
+ __xfrm_selector_match
+ xfrm_tmpl_resolve // only if bundle was not found!
+ xfrm_state_find
+ xfrm_bundle_create // create output (dst) chain if bundle was not
found
+ __xfrm4_bundle_create
+ ip_push_pending_frames
+ dst_output(skb) //this calls skb->dst->output();
+ xfrm4_output //This finally returns 4 (NET_XMIT_BYPASS) to
dst_output();
+ xfrm4_encap
+ esp_output
+ xfrm_beet_output //change the ip header to outer.
+ dst_output(skb)
+ ip_output
+ ip_finish_output Or ip_fragment //depending on size of packet
+ // Returns 0 to dst_output(); which makes dst_output to come
out of infinite loop.
+ dev_queue_xmit
+
+
+Receiving (inner IPv4, outer IPv4)(4-4)
+===========
+
+net_rx_action()
+e1000_clean() // dependent on network hardware
+e1000_clean_rx_irq()
+netif_receive_skb()
+ deliver_skb()
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
+ ip_rcv()
+ nf_hook()
+ ip_rcv_finish()
+ ip_route_input()
+ dst_input()->ip_forward() or ip_input()
+ ip_input // remove the IPv4 header
+ ip_input_finish
+ ret = ipprot->handler(&skb, &nhoff);
+ xfrm4_rcv()
+ xfrm4_rcv_encap()
+ xfrm4_parse_spi()
+ xfrm_state_lookup() // lookup IPsec SA
+ xfrm_beet_input(skb, x) //To change to inner IP header.
+ nexthdr = x->type->input(x, xfrm.decap, skb) // ==
esp_input
+ esp_input() // process ESP based on inner
address
+ returns 0 ;
+ /* beet handling in xfrm_rcv_spi */
+ netif_rx()
+ // ip_input_finish returns 0
+ // netif_receive_skb returns 0
+netif_receive_skb //Now we have an IPv4 packet. So the input flow is
for v4 packet.
+ deliver_skb()
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
+ ip_rcv()
+ nf_hook() //This calls ip_rcv_finish(skb)
+ ip_rcv_finish() //Here the skb->dst is NULL and so is filled for
the input side.
+ ip6_route_input()
+ dst_input()->ip_forward() or ip_input()
+ ip_input // remove the IPv4 header
+ ip_input_finish
+ ...
+ ...
+ ...
+
+
+Sending (inner IPv6, outer IPv4)(6-4)
+=====================================
+inet_sendmsg
+ rawv6_sendmsg
+ ip6_dst_lookup
+ ip6_route_output
+ xfrm_lookup
+ flow_cache_lookup
+ xfrm_policy_lookup // lookup IPsec policy
+ xfrm_find_bundle // lookup IPsec SA
+ __xfrm_selector_match
+ xfrm_tmpl_resolve // only if bundle was not found!
+ xfrm_state_find
+ xfrm_bundle_create // create output (dst) chain if bundle was not
found
+ __xfrm6_bundle_create
+ rawv6_push_pending_frames
+ ip6_push_pending_frames
+ dst_output(skb)
+ xfrm6_output
+ xfrm6_encap
+ esp6_output //esp calculation is done on inner addresses
!!
+ xfrm_beet_output //Change the ip header to outer IP Header
+ dst_output(skb)
+ ip_output
+ ip_finish_output Or ip_fragment //depending on size of packet
+ // Returns 0 to dst_output(); which makes dst_output to come
out of infinite loop.
+ dev_queue_xmit
+
+
+Receiving (inner IPv6, outer IPv4)(6-4)
+===========
+
+net_rx_action()
+e1000_clean() // dependent on network hardware
+e1000_clean_rx_irq()
+netif_receive_skb()
+ deliver_skb()
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
+ ip_rcv() // skb len = 140
+ nf_hook()
+ ip_rcv_finish()
+ ip_route_input()
+ dst_input()->ip_forward() or ip_input()
+ ip_input // remove the IPv6 header
+ ip_input_finish // calls recursively the ->handler = xfrm6_rcv
+ ret = ipprot->handler(&skb, &nhoff); // handler = xfrm6_rcv_spi
+ xfrm4_rcv()
+ xfrm4_rcv_encap()
+ xfrm4_parse_spi()
+ xfrm_state_lookup() // lookup IPsec SA
+ xfrm_beet_input(skb, x) //To change to inner IP header.
+ nexthdr = x->type->input(x, xfrm.decap, skb) // ==
esp6_input
+ esp6_input() // process ESP based on inner
address
+ returns 0 ;
+ /* beet handling in xfrm_rcv_spi */
+ netif_rx()
+ // ip6_input_finish returns 0
+ // netif_receive_skb returns 0
+netif_receive_skb
+ deliver_skb()
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
+ ip6_rcv() // skb len = 104
+ nf_hook_slow()
+ ip6_rcv_finish()
+ ip6_route_input()
+ dst_input()->ip6_forward() or ip6_input()
+ ip6_input // remove the IPv6 header
+ ip6_input_finish
+ xfrm6_policy_check()
+ ..
+ __xfrm_policy_check
+ ret = ipprot->handler(&skb, &nhoff); // handler = xfrm6_rcv_spi
+tcp_v6_rcv() // or icmpv6_rcv(), anyway, deliver to upper
layer
+
+
+Sending (inner IPv4, outer IPv6)(4-6)
+=====================================
+
+inet_sendmsg
+ raw_sendmsg
+ ip_route_output_flow
+ __ip_route_output_key
+ xfrm_lookup
+ flow_cache_lookup
+ xfrm_policy_lookup // lookup IPsec policy
+ xfrm_find_bundle // lookup IPsec SA
+ __xfrm_selector_match
+ xfrm_tmpl_resolve // only if bundle was not found!
+ xfrm_state_find
+ xfrm_bundle_create // create output (dst) chain if bundle was not
found
+ __xfrm4_bundle_create
+ ip_push_pending_frames
+ dst_output(skb) //this calls skb->dst->output();
+ xfrm4_output //This finally returns 4 (NET_XMIT_BYPASS) to
dst_output();
+ xfrm4_encap
+ esp_output
+ xfrm_beet_output
+ dst_output(skb)
+ ip6_output
+ ip6_output2
+ ip6_output_finish // Returns 0 to dst_output(); which makes
dst_output to come out of infinite loop.
+ dev_queue_xmit
+
+
+Receiving (inner IPv4, outer IPv6)(4-6)
+===========
+
+net_rx_action()
+e1000_clean() // dependent on network hardware
+e1000_clean_rx_irq()
+netif_receive_skb()
+ deliver_skb()
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
+ ipv6_rcv() // skb len = 140
+ nf_hook_slow()
+ ip6_rcv_finish()
+ ip6_route_input()
+ dst_input()->ip6_forward() or ip6_input()
+ ip6_input // remove the IPv6 header
+ ip6_input_finish // calls recursively the ->handler = xfrm6_rcv
+ ret = ipprot->handler(&skb, &nhoff); // handler = xfrm6_rcv_spi
+ xfrm6_rcv()
+ xfrm6_rcv_spi()
+ xfrm_parse_spi()
+ xfrm_state_lookup() // lookup IPsec SA
+ xfrm_beet_input(skb, x) //To change to inner IP header.
+ nexthdr = x->type->input(x, xfrm.decap, skb) // ==
esp_input
+ esp_input() // process ESP
+ returns iph->protocol ;
+ /* beet handling in xfrm_rcv_spi */
+ netif_rx()
+ // ip6_input_finish returns 0
+ // netif_receive_skb returns 0
+netif_receive_skb //Now we have an IPv4 packet. So the input flow is
for v4 packet.
+ deliver_skb()
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
+ ip_rcv()
+ nf_hook() //This calls ip_rcv_finish(skb)
+ ip_rcv_finish() //Here the skb->dst is NULL and so is filled for
the input side.
+ ip_route_input()
+ dst_input()->ip_forward() or ip_input()
+ ip_input // remove the IPv4 header
+ ip_input_finish
+ ...
+ ...
+ ...
+
+Sending (inner IPv6, outer IPv6)(6-6)
+=============
+
+(When sending the first packet!)
+
+inet_sendmsg
+ rawv6_sendmsg
+ ip6_dst_lookup
+ ip6_route_output
+ xfrm_lookup
+ flow_cache_lookup
+ xfrm_policy_lookup // lookup IPsec policy
+ xfrm_find_bundle // lookup IPsec SA
+ __xfrm_selector_match
+ xfrm_tmpl_resolve // only if bundle was not found!
+ xfrm_state_find
+ xfrm_bundle_create // create output (dst) chain if bundle was not
found
+ __xfrm6_bundle_create
+ rawv6_push_pending_frames
+ ip6_push_pending_frames
+ dst_output(skb)
+ xfrm6_output
+ xfrm6_encap
+ esp6_output
+ xfrm_beet_output
+ dst_output(skb)
+ ip6_output
+ ip6_output2
+ ip6_output_finish
+ dev_queue_xmit
+
+when are these called?
+ ip6_xmt()
+ dst_output()
+
+
+Receiving (inner IPv6, outer IPv6)(6-6)
+===========
+
+net_rx_action()
+e1000_clean() // dependent on network hardware
+e1000_clean_rx_irq()
+netif_receive_skb()
+ deliver_skb()
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
+ ipv6_rcv() // skb len = 140
+ nf_hook_slow()
+ ip6_rcv_finish()
+ ip6_route_input()
+ dst_input()->ip6_forward() or ip6_input()
+ ip6_input // remove the IPv6 header
+ ip6_input_finish // calls recursively the ->handler = xfrm6_rcv
+ ret = ipprot->handler(&skb, &nhoff); // handler = xfrm6_rcv_spi
+ xfrm6_rcv()
+ xfrm6_rcv_spi()
+ xfrm_parse_spi()
+ xfrm_state_lookup() // lookup IPsec SA
+ xfrm_beet_input(skb, x) //To change to inner IP header.
+ nexthdr = x->type->input(x, xfrm.decap, skb) // ==
esp6_input
+ esp6_input() // process ESP
+ returns 58 (ICMPv6) //returns the nexthdr in the ipv6
packet.
+ /* beet handling in xfrm_rcv_spi */
+ netif_rx()
+ // ip6_input_finish returns 0
+ // netif_receive_skb returns 0
+netif_receive_skb
+ deliver_skb()
+ ret = pt_prev->func(skb, skb->dev, pt_prev);
+ ipv6_rcv() // skb len = 104
+ nf_hook_slow()
+ ip6_rcv_finish()
+ ip6_route_input()
+ dst_input()->ip6_forward() or ip6_input()
+ ip6_input // remove the IPv6 header
+ ip6_input_finish
+ xfrm6_policy_check()
+ ..
+ __xfrm_policy_check
+ ret = ipprot->handler(&skb, &nhoff); // handler = xfrm6_rcv_spi
+tcp_v6_rcv() // or icmpv6_rcv(), anyway, deliver to upper
layer
+
+<this is Kristian's text from ARCHITECTURE, fold into above>
+output path
+ip6_datagram_connect()
+ ip6_dst_lookup() // success
+ xfrm_lookup() // lookup policy using inner IP, matching selectors in
SP and
+ flow information
+ xfrm_sk_policy_lookup() // success
+ flow_cache_lookup() // success
+ xfrm_find_bundle() // check for a bundle, if found use it, or
create new
+ xfrm_tmpl_resolve() // when creating new, search for SA for each
transform
+ // once valid SA found, use it to create bundle
and link
+ // to SP. modify skbuff's dst-pointer pointing
to next
+ // xfrmX_output(), after encaps/trans dst is
consulted
+ // to route the packet
+ xfrm_state_find() //
+ xfrm_selector_match() //
+ km_query() //
+
+
+<insert some diagram here describing everything>
+ app app
+ | |
+ inner inner
+ \ /
+ -<xfrm_proc> /
+ \ /
+ \--outer outer--/
+ \ /
+ \===<wire>===/
+
+
+Files Added
+--------------
+This is a list of the included files for the BEET patch
+
+net/xfrm/xfrm_beet.c
+- This file contains the functions xfrm_beet_input() and
xfrm_beet_output()
+ which deals with the incoming and the outgoing BEET packets,
respectively.
+ The purpose of these functions is to interchange the inner addresses
with
+ the outer addresses in the IP header (in case of outgoing packets)
and viceversa
+ (in case of incoming packets).
+ The file describes two functions:
+ 1. xfrm_beet_input
+ Used in receiving side, changes the ip header to inner ip header
+ 2. xfrm_beet_output
+ Used in sending side, changes the ip header to outer ip header
+
+Files changed
+-------------
+This is a list of changes made by the BEET patch.
+
+include/linux/ipsec.h
+ - IPSEC_MODE_BEET added
+ This is the new type of SA that may be created.
+ XXX note: are we overusing XFRM_MODE_BEET where IPSEC_MODE_BEET
should be
+ used instead?
+
+include/linux/xfrm.h
+ - enum XFRM_MODE_{TRANSPORT|TUNNEL|BEET} added
+ Mode needed to distinguish from tunnel mode in xfrm code.
+
+include/net/xfrm.h
+ - u16 beet_family added to struct xfrm_state
+ For the outgoing SA, this is the family of the outer address.
+ For the incoming SA, this is the family of the inner address.
+ - unsigned short family added to struct xfrm_tmpl
+ family is required because the family may differ from the one in the
selector
+ - possible change to xfrm_selector_match() (commented out)
+
+net/ipv4/xfrm4_input.c
+ - in xfrm4_rcv_encap() call is made to xfrm_beet_input(), to change
the
+ ip header to inner before going for esp test.
+ - in xfrm4_rcv_encap() check x->props.mode for XFRM_MODE_TUNNEL, _BEET
+ checks address family (x->props.beet_family), and makes final
adjustments
+ to packet before requeing it.
+
+net/ipv4/xfrm4_output.c
+ - xfrm4_encap(), note to fix the BEET case, like xfrm6_encap
+ - xfrm4_output(), added a call to xfrm_beet_output() to change the ip
header
+
+net/ipv4/esp4.c
+ - in esp_init_state(), check if x->props.mode == XFRM_MODE_TUNNEL,
+ then x->props.header_len += sizeof(struct ipv6hdr), not if
(x->props.mode)
+ - in esp_input(), while returning, if the outer family is AF_INET6,
then return
+ iph->protocol, else return 0.
+
+net/ipv6/esp6.c
+ - in esp6_init_state(), check if x->props.mode == XFRM_MODE_TUNNEL,
+ then x->props.header_len += sizeof(struct ipv6hdr), not if
(x->props.mode)
+ - in esp6_input(), while returning, if the outer family is AF_INET,
then
+ set next header field and return 0, else return ret.
+
+
+net/ipv6/xfrm6_input.c
+ - in xfrm6-rcv_spi(), call is made to xfrm_beet_input(), which changes
to
+ inner ip header before sending to esp decapsulation.
+ - in xfrm6_rcv_spi(), handle x->props.mode = XFRM_MODE_BEET
+ checks address family (x->props.beet_family), makes final
adjustments to
+ packet before requeing it.
+
+net/ipv6/xfrm6_output.c
+ - xfrm6_encap() add ipv4 header vars, check if
(x->props.mode==XFRM_MODE_BEET)
+ makes space for appropriate esp header and sends to espX_output
where X depends
+ on inner family of beet.
+ - xfrm6_output() change if(x->props.mode) to
(x->props.mode==XFRM_MODE_TUNNEL)
+ Also a call is made to xfrm_beet_output after esp calculations, to
change the
+ ip header to outer ip header.
+
+net/ipv6/xfrm6_policy.c
+ (on output...)
+ - in __xfrm6_bundle_create() added remotebeet, localbeet vars,
+ get the IPv6 headers from xfrm[i]->id.daddr (remote) and
+ xfrm[i]->props.saddr (local)
+ copy IPv4 or IPv6 addresses from remote/localbeet to
fl_tunnel.fl4/6_dst/src
+ then do xfrm_dst_lookup() passing in xfrm[i]->props.beet_family
+
+net/key/af_key.c
+ - commented-out code in pfkey_msg2xfrm_state():
+ check x->props.beet_family for x->props.family?
+
+ - parse_ipsecrequest() check if (t->mode==IPSEC_MODE_TUNNEL-1)
+ handle if (t->mode==IPSEC_MODE_BEET-1)
+ populate t->saddr.a4 or t->saddr.a6, t->family, etc
+ This supports adding a new type of beet mode SA.
+
+net/xfrm/Kconfig
+ - added XFRM_BEET config variable option and text
+ This allows you to compile BEET mode into your kernel.
+
+net/xfrm/xfrm_policy.c
+ - note from Miika - fns added just for testing, removed for BEET
+ ipv6_addr_is_hit(), hip_xfrm_handler_notify(),
hip_xfrm_handler_acquire(),
+ hip_xfrm_handler_policy_notify(), hip_register_xfrm_km_handler(),
etc
diff -urN linux-2.6.12.2/include/linux/ipsec.h
linux-beet-2.6.12.2/include/linux/ipsec.h
--- linux-2.6.12.2/include/linux/ipsec.h 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/include/linux/ipsec.h 2005-07-25
14:39:01.000000000 +0300
@@ -13,6 +13,9 @@
IPSEC_MODE_ANY = 0, /* We do not support this for SA */
IPSEC_MODE_TRANSPORT = 1,
IPSEC_MODE_TUNNEL = 2
+#ifdef CONFIG_XFRM_BEET
+ ,IPSEC_MODE_BEET = 3
+#endif
};
enum {
diff -urN linux-2.6.12.2/include/linux/xfrm.h
linux-beet-2.6.12.2/include/linux/xfrm.h
--- linux-2.6.12.2/include/linux/xfrm.h 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/include/linux/xfrm.h 2005-07-25
14:39:01.000000000 +0300
@@ -102,6 +102,15 @@
XFRM_SHARE_UNIQUE /* Use once */
};
+enum
+{
+ XFRM_MODE_TRANSPORT = 0,
+ XFRM_MODE_TUNNEL
+#ifdef CONFIG_XFRM_BEET
+ ,XFRM_MODE_BEET
+#endif
+};
+
/* Netlink configuration messages. */
enum {
XFRM_MSG_BASE = 0x10,
diff -urN linux-2.6.12.2/include/net/xfrm.h
linux-beet-2.6.12.2/include/net/xfrm.h
--- linux-2.6.12.2/include/net/xfrm.h 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/include/net/xfrm.h 2005-07-25 15:03:01.000000000
+0300
@@ -113,6 +113,14 @@
xfrm_address_t saddr;
int header_len;
int trailer_len;
+#ifdef CONFIG_XFRM_BEET
+ /* beet_family_out = family of outer addresses
+ * beet_family_in = family of inner addresses
+ */
+ u16 beet_family_in;
+ u16 beet_family_out;
+
+#endif
} props;
struct xfrm_lifetime_cfg lft;
@@ -241,6 +249,12 @@
/* Source address of tunnel. Ignored, if it is not a tunnel. */
xfrm_address_t saddr;
+/* family of the addresses. In BEET-mode the family may differ from
+ the one in selector */
+#ifdef CONFIG_XFRM_BEET
+ unsigned short family;
+#endif
+
__u32 reqid;
/* Mode: transport/tunnel */
@@ -835,6 +849,12 @@
extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr);
extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr);
extern int xfrm6_output(struct sk_buff *skb);
+#ifdef CONFIG_XFRM_BEET
+extern struct xfrm_state * xfrm_lookup_bydst(u8 mode, xfrm_address_t
*daddr, xfrm_address_t *saddr, unsigned short family);
+extern int xfrm_beet_output(struct sk_buff *skb);
+extern int xfrm_beet_input(struct sk_buff *skb, struct xfrm_state *x);
+
+#endif
#ifdef CONFIG_XFRM
extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type);
diff -urN linux-2.6.12.2/net/ipv4/esp4.c
linux-beet-2.6.12.2/net/ipv4/esp4.c
--- linux-2.6.12.2/net/ipv4/esp4.c 2005-06-30 02:00:53.000000000 +0300
+++ linux-beet-2.6.12.2/net/ipv4/esp4.c 2005-07-25 14:39:11.000000000
+0300
@@ -1,3 +1,13 @@
+/*
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
+ */
+
#include <linux/config.h>
#include <linux/module.h>
#include <net/ip.h>
@@ -23,7 +33,7 @@
struct iphdr *top_iph;
struct ip_esp_hdr *esph;
struct crypto_tfm *tfm;
- struct esp_data *esp;
+ struct esp_data *esp = x->data;
struct sk_buff *trailer;
int blksize;
int clen;
@@ -31,7 +41,15 @@
int nfrags;
/* Strip IP+ESP header. */
- __skb_pull(skb, skb->h.raw - skb->data);
+#ifdef CONFIG_XFRM_BEET
+ int hdr_len = skb->h.raw - skb->data + sizeof(*esph) +
esp->conf.ivlen;
+ if (x->props.mode == XFRM_MODE_BEET)
+ __skb_pull(skb, hdr_len);
+ else
+ __skb_pull(skb, skb->h.raw - skb->data);
+#else
+ __skb_pull(skb, skb->h.raw - skb->data);
+#endif
/* Now skb is pure payload to encrypt */
err = -ENOMEM;
@@ -39,7 +57,6 @@
/* Round to block size */
clen = skb->len;
- esp = x->data;
alen = esp->auth.icv_trunc_len;
tfm = esp->conf.tfm;
blksize = (crypto_tfm_alg_blocksize(tfm) + 3) & ~3;
@@ -59,7 +76,14 @@
*(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2;
pskb_put(skb, trailer, clen - skb->len);
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_BEET)
+ __skb_push(skb, hdr_len);
+ else
+ __skb_push(skb, skb->data - skb->nh.raw);
+#else
__skb_push(skb, skb->data - skb->nh.raw);
+#endif
top_iph = skb->nh.iph;
esph = (struct ip_esp_hdr *)(skb->nh.raw + top_iph->ihl*4);
top_iph->tot_len = htons(skb->len + alen);
@@ -238,7 +262,14 @@
skb->nh.iph->tot_len = htons(skb->len);
}
+#ifdef CONFIG_XFRM_BEET
+ if(x->props.mode == XFRM_MODE_BEET && x->props.beet_family_out ==
AF_INET6)
+ return iph->protocol ;
+ else
+ return 0;
+#else
return 0;
+#endif
out:
return -EINVAL;
@@ -428,7 +459,11 @@
if (crypto_cipher_setkey(esp->conf.tfm, esp->conf.key,
esp->conf.key_len))
goto error;
x->props.header_len = sizeof(struct ip_esp_hdr) + esp->conf.ivlen;
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_TUNNEL)
+#else
if (x->props.mode)
+#endif
x->props.header_len += sizeof(struct iphdr);
if (x->encap) {
struct xfrm_encap_tmpl *encap = x->encap;
diff -urN linux-2.6.12.2/net/ipv4/xfrm4_input.c
linux-beet-2.6.12.2/net/ipv4/xfrm4_input.c
--- linux-2.6.12.2/net/ipv4/xfrm4_input.c 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/net/ipv4/xfrm4_input.c 2005-07-25
14:39:11.000000000 +0300
@@ -7,6 +7,13 @@
* Derek Atkins <derek@ihtfp.com>
* Add Encapsulation support
*
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
*/
#include <linux/module.h>
@@ -78,6 +85,14 @@
goto drop_unlock;
xfrm_vec[xfrm_nr].decap.decap_type = encap_type;
+
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_BEET) {
+ /* Change the outer header with the inner data */
+ if (xfrm_beet_input(skb, x))
+ goto drop_unlock;
+ }
+#endif
if (x->type->input(x, &(xfrm_vec[xfrm_nr].decap), skb))
goto drop_unlock;
@@ -96,7 +111,11 @@
iph = skb->nh.iph;
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_TUNNEL) {
+#else
if (x->props.mode) {
+#endif
if (iph->protocol != IPPROTO_IPIP)
goto drop;
if (!pskb_may_pull(skb, sizeof(struct iphdr)))
@@ -115,9 +134,69 @@
decaps = 1;
break;
}
+#ifdef CONFIG_XFRM_BEET
+ else if (x->props.mode == XFRM_MODE_BEET) {
+ struct iphdr *iph = skb->nh.iph;
+ struct ipv6hdr *ip6h = skb->nh.ipv6h;
+ int size = 0;
+
+ if (skb_cloned(skb) &&
+ pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+ goto drop;
+
+ if (x->props.beet_family_in == AF_INET)
+ size = sizeof(struct iphdr);
+ else if (x->props.beet_family_in == AF_INET6)
+ size = sizeof(struct ipv6hdr);
+ else
+ BUG_ON(1);
+
+ skb_push(skb, size);
+
+ memmove(skb->data, skb->nh.raw, size);
+ skb->mac.raw = memmove(skb->data - skb->mac_len,
+ skb->mac.raw, skb->mac_len);
+ skb->nh.raw = skb->data;
- if ((err = xfrm_parse_spi(skb, skb->nh.iph->protocol, &spi, &seq)) <
0)
+ switch(x->props.beet_family_in) {
+ case AF_INET:
+
+ iph->tot_len = htons(skb->len);
+ iph->check = 0;
+ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+ skb->protocol = htons(ETH_P_IP);
+ dst_release(skb->dst);
+ skb->dst = NULL;
+ decaps = 1;
+
+ break;
+ case AF_INET6:
+ ip6h = skb->nh.ipv6h;
+
+ skb->nh.ipv6h->payload_len =
htons(ntohs(skb->nh.ipv6h->payload_len) + size);
+ skb->protocol = htons(ETH_P_IPV6);
+
+ dst_release(skb->dst);
+ skb->dst = NULL;
+ decaps = 1;
+ break;
+ default:
+ BUG_ON(1);
+ }
+ break;
+ }
+
+ if (x->props.mode == XFRM_MODE_BEET && x->props.beet_family_in ==
AF_INET6) {
+ if ((err = xfrm_parse_spi(skb, skb->nh.ipv6h->nexthdr, &spi, &seq))
< 0)
+ goto drop;
+ } else {
+ if ((err = xfrm_parse_spi(skb, skb->nh.iph->protocol, &spi, &seq)) <
0)
+ goto drop;
+ }
+#else
+ if ((err = xfrm_parse_spi(skb, skb->nh.iph->protocol, &spi,
&seq)) < 0)
goto drop;
+#endif
} while (!err);
/* Allocate new secpath or COW existing one. */
diff -urN linux-2.6.12.2/net/ipv4/xfrm4_output.c
linux-beet-2.6.12.2/net/ipv4/xfrm4_output.c
--- linux-2.6.12.2/net/ipv4/xfrm4_output.c 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/net/ipv4/xfrm4_output.c 2005-07-25
14:39:11.000000000 +0300
@@ -6,6 +6,14 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
+ *
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
*/
#include <linux/skbuff.h>
@@ -26,7 +34,8 @@
* check
*
* On exit, skb->h will be set to the start of the payload to be
processed
- * by x->type->output and skb->nh will be set to the top IP header.
+ * by x->type->output and skb->nh, as well as skb->data, will point to
+ * the top IP header.
*/
static void xfrm4_encap(struct sk_buff *skb)
{
@@ -35,15 +44,36 @@
struct iphdr *iph, *top_iph;
iph = skb->nh.iph;
- skb->h.ipiph = iph;
+#ifdef CONFIG_XFRM_BEET
+ /*
+ * This is because otherwise the BEET patch crashes in any case
with Inner=4
+ */
+ if (x->props.mode != XFRM_MODE_BEET)
+ skb->h.ipiph = iph;
+#else
+ skb->h.ipiph = iph;
+#endif
skb->nh.raw = skb_push(skb, x->props.header_len);
top_iph = skb->nh.iph;
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_TRANSPORT) {
+#else
if (!x->props.mode) {
+#endif
+
skb->h.raw += iph->ihl*4;
memmove(top_iph, iph, iph->ihl*4);
return;
+#ifdef CONFIG_XFRM_BEET
+ } else if (x->props.mode == XFRM_MODE_BEET) {
+
+ skb->h.raw = skb->data + sizeof(struct iphdr);
+ memmove(top_iph, iph, iph->ihl*4);
+ return;
+
+#endif /* CONFIG_XFRM_BEET */
}
top_iph->ihl = 5;
@@ -103,7 +133,11 @@
goto error_nolock;
}
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_TUNNEL) {
+#else
if (x->props.mode) {
+#endif
err = xfrm4_tunnel_check_size(skb);
if (err)
goto error_nolock;
@@ -120,6 +154,15 @@
if (err)
goto error;
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_BEET) {
+ /* Change the outer header */
+ err = xfrm_beet_output(skb);
+ if (err)
+ goto error;
+ }
+#endif
+
x->curlft.bytes += skb->len;
x->curlft.packets++;
diff -urN linux-2.6.12.2/net/ipv4/xfrm4_policy.c
linux-beet-2.6.12.2/net/ipv4/xfrm4_policy.c
--- linux-2.6.12.2/net/ipv4/xfrm4_policy.c 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/net/ipv4/xfrm4_policy.c 2005-07-25
15:03:01.000000000 +0300
@@ -6,6 +6,14 @@
* YOSHIFUJI Hideaki @USAGI
* Split up af-specific portion
*
+ *
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
*/
#include <asm/bug.h>
@@ -66,6 +74,12 @@
}
}
};
+#ifdef CONFIG_XFRM_BEET
+ union {
+ struct in6_addr *in6;
+ struct in_addr *in;
+ } remotebeet, localbeet;
+#endif
int i;
int err;
int header_len = 0;
@@ -78,6 +92,9 @@
struct dst_entry *dst1 = dst_alloc(&xfrm4_dst_ops);
struct xfrm_dst *xdst;
int tunnel = 0;
+#ifdef CONFIG_XFRM_BEET
+ unsigned short beet_family = 0;
+#endif
if (unlikely(dst1 == NULL)) {
err = -ENOBUFS;
@@ -98,11 +115,28 @@
dst1->next = dst_prev;
dst_prev = dst1;
+#ifdef CONFIG_XFRM_BEET
+ if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL) {
+#else
if (xfrm[i]->props.mode) {
+#endif
remote = xfrm[i]->id.daddr.a4;
local = xfrm[i]->props.saddr.a4;
tunnel = 1;
}
+#ifdef CONFIG_XFRM_BEET
+ else if (xfrm[i]->props.mode == XFRM_MODE_BEET) {
+
+ beet_family = xfrm[i]->props.beet_family_out;
+ if(beet_family == AF_INET6){
+ remotebeet.in6 = (struct in6_addr*)&xfrm[i]->id.daddr;
+ localbeet.in6 = (struct in6_addr*)&xfrm[i]->props.saddr;
+ } else if(beet_family == AF_INET){
+ remotebeet.in = (struct in_addr*)&xfrm[i]->id.daddr;
+ localbeet.in = (struct in_addr*)&xfrm[i]->props.saddr;
+ }
+ }
+#endif
header_len += xfrm[i]->props.header_len;
trailer_len += xfrm[i]->props.trailer_len;
@@ -113,6 +147,28 @@
&fl_tunnel, AF_INET);
if (err)
goto error;
+#ifdef CONFIG_XFRM_BEET
+ } else if (beet_family) {
+ switch(beet_family) {
+ case AF_INET:
+ fl_tunnel.fl4_dst = remotebeet.in->s_addr;
+ fl_tunnel.fl4_src = localbeet.in->s_addr;
+ break;
+ case AF_INET6:
+ ipv6_addr_copy(&fl_tunnel.fl6_dst, remotebeet.in6);
+ ipv6_addr_copy(&fl_tunnel.fl6_src, localbeet.in6);
+ break;
+ default:
+ BUG_ON(1);
+ }
+
+ err = xfrm_dst_lookup((struct xfrm_dst **) &rt,
+ &fl_tunnel, beet_family);
+ /* Without this, the BEET mode crashes
+ indeterministically -Abi */
+ rt->peer = NULL;
+ rt_bind_peer(rt,1);
+#endif
} else
dst_hold(&rt->u.dst);
}
diff -urN linux-2.6.12.2/net/ipv6/esp6.c
linux-beet-2.6.12.2/net/ipv6/esp6.c
--- linux-2.6.12.2/net/ipv6/esp6.c 2005-06-30 02:00:53.000000000 +0300
+++ linux-beet-2.6.12.2/net/ipv6/esp6.c 2005-07-25 14:39:11.000000000
+0300
@@ -22,6 +22,16 @@
* Kunihiro Ishiguro <kunihiro@ipinfusion.com>
*
* This file is derived from net/ipv4/esp.c
+ *
+ *
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
+ *
*/
#include <linux/config.h>
@@ -225,6 +235,13 @@
memcpy(skb->nh.raw, tmp_hdr, hdr_len);
skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct
ipv6hdr));
ret = nexthdr[1];
+#ifdef CONFIG_XFRM_BEET
+ if(x->props.mode == XFRM_MODE_BEET &&
+ x->props.beet_family_out == AF_INET) {
+ skb->nh.ipv6h->nexthdr = nexthdr[1];
+ ret = 0;//This is because xfrm4_encap expects 0 if every thing is
correct
+ }
+#endif
}
out:
@@ -365,7 +382,11 @@
if (crypto_cipher_setkey(esp->conf.tfm, esp->conf.key,
esp->conf.key_len))
goto error;
x->props.header_len = sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen;
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_TUNNEL)
+#else
if (x->props.mode)
+#endif
x->props.header_len += sizeof(struct ipv6hdr);
x->data = esp;
return 0;
diff -urN linux-2.6.12.2/net/ipv6/xfrm6_input.c
linux-beet-2.6.12.2/net/ipv6/xfrm6_input.c
--- linux-2.6.12.2/net/ipv6/xfrm6_input.c 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/net/ipv6/xfrm6_input.c 2005-07-25
14:39:11.000000000 +0300
@@ -64,6 +64,12 @@
if (xfrm_state_check_expire(x))
goto drop_unlock;
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_BEET) {
+ if (xfrm_beet_input(skb, x))
+ goto drop_unlock;
+ }
+#endif
nexthdr = x->type->input(x, &(xfrm_vec[xfrm_nr].decap), skb);
if (nexthdr <= 0)
goto drop_unlock;
@@ -80,7 +86,11 @@
xfrm_vec[xfrm_nr++].xvec = x;
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_TUNNEL) {
+#else
if (x->props.mode) { /* XXX */
+#endif
if (nexthdr != IPPROTO_IPV6)
goto drop;
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
@@ -97,6 +107,64 @@
skb->nh.raw = skb->data;
decaps = 1;
break;
+#ifdef CONFIG_XFRM_BEET
+ } else if (x->props.mode == XFRM_MODE_BEET) {
+ struct iphdr *iph = skb->nh.iph; // miika: this masks input arg
+ struct ipv6hdr *ip6h = skb->nh.ipv6h;
+ int size=0;
+ __u8 proto=0;
+ __u8 hops=0;
+ __u16 total = ntohs(ip6h->payload_len);
+
+ /* is the buffer a clone?
+ * then create identical copy of header of skb */
+ if (skb_cloned(skb) &&
+ pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+ goto drop;
+ if (x->props.beet_family_in == AF_INET) {
+ size = sizeof(struct iphdr);
+ proto = ip6h->nexthdr;
+ hops = ip6h->hop_limit;
+ } else if (x->props.beet_family_in == AF_INET6)
+ size = sizeof(struct ipv6hdr);
+ else
+ BUG_ON(1);
+ /* add data to the start of the buffer */
+ skb_push(skb, size);
+ /* move the raw header into new space */
+ memmove(skb->data, skb->nh.raw, size);
+ /* move MAC header */
+ skb->mac.raw = memmove(skb->data - skb->mac_len,
+ skb->mac.raw, skb->mac_len);
+ skb->nh.raw = skb->data;
+
+ switch(x->props.beet_family_in) {
+ case AF_INET:
+
+ iph = (struct iphdr *)skb->nh.raw;
+
+ skb->protocol = htons(ETH_P_IP);
+ iph->tot_len = htons(skb->len);
+ iph->frag_off = htons(IP_DF);
+ iph->check=0;
+ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+
+ dst_release(skb->dst);
+ skb->dst = NULL;
+
+ decaps = 1;
+ break;
+
+ case AF_INET6:
+ ip6h->payload_len = htons(total + size);
+ --ip6h->hop_limit;
+ decaps = 1;
+ break;
+ default:
+ BUG_ON(1);
+ }
+ break;
+#endif
}
if ((err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) < 0)
diff -urN linux-2.6.12.2/net/ipv6/xfrm6_output.c
linux-beet-2.6.12.2/net/ipv6/xfrm6_output.c
--- linux-2.6.12.2/net/ipv6/xfrm6_output.c 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/net/ipv6/xfrm6_output.c 2005-07-25
14:39:11.000000000 +0300
@@ -7,6 +7,14 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
+ *
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
*/
#include <linux/skbuff.h>
@@ -17,6 +25,10 @@
#include <net/ipv6.h>
#include <net/xfrm.h>
+#ifdef CONFIG_XFRM_BEET
+#include <net/ip.h>
+#endif
+
/* Add encapsulation header.
*
* In transport mode, the IP header and mutable extension headers will
be moved
@@ -42,7 +54,12 @@
skb_push(skb, x->props.header_len);
iph = skb->nh.ipv6h;
+
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_TRANSPORT) {
+#else
if (!x->props.mode) {
+#endif
u8 *prevhdr;
int hdr_len;
@@ -51,6 +68,16 @@
skb->h.raw = skb->data + hdr_len;
memmove(skb->data, iph, hdr_len);
return;
+
+#ifdef CONFIG_XFRM_BEET
+ } else if (x->props.mode == XFRM_MODE_BEET) {
+
+ memmove(skb->data, skb->nh.raw, sizeof(struct ipv6hdr));
+ skb->nh.raw = &((struct ipv6hdr *)skb->data)->nexthdr;
+ skb->h.ipv6h = ((struct ipv6hdr *)skb->data) + 1;
+ return;
+
+#endif /* CONFIG_XFRM_BEET */
}
skb->nh.raw = skb->data;
@@ -104,7 +131,11 @@
goto error_nolock;
}
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_TUNNEL) {
+#else
if (x->props.mode) {
+#endif
err = xfrm6_tunnel_check_size(skb);
if (err)
goto error_nolock;
@@ -121,6 +152,15 @@
if (err)
goto error;
+#ifdef CONFIG_XFRM_BEET
+ if (x->props.mode == XFRM_MODE_BEET) {
+ /* Change the outer header */
+ err = xfrm_beet_output(skb);
+ if (err)
+ goto error;
+ }
+#endif
+
x->curlft.bytes += skb->len;
x->curlft.packets++;
diff -urN linux-2.6.12.2/net/ipv6/xfrm6_policy.c
linux-beet-2.6.12.2/net/ipv6/xfrm6_policy.c
--- linux-2.6.12.2/net/ipv6/xfrm6_policy.c 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/net/ipv6/xfrm6_policy.c 2005-07-25
15:03:01.000000000 +0300
@@ -8,7 +8,14 @@
* IPv6 support
* YOSHIFUJI Hideaki
* Split up af-specific portion
- *
+ *
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
*/
#include <asm/bug.h>
@@ -84,6 +91,12 @@
}
}
};
+#ifdef CONFIG_XFRM_BEET
+ union {
+ struct in6_addr *in6;
+ struct in_addr *in;
+ } remotebeet, localbeet;
+#endif
int i;
int err = 0;
int header_len = 0;
@@ -96,6 +109,9 @@
struct dst_entry *dst1 = dst_alloc(&xfrm6_dst_ops);
struct xfrm_dst *xdst;
int tunnel = 0;
+#ifdef CONFIG_XFRM_BEET
+ unsigned short beet_family = 0;
+#endif
if (unlikely(dst1 == NULL)) {
err = -ENOBUFS;
@@ -118,11 +134,22 @@
dst1->next = dst_prev;
dst_prev = dst1;
+#ifdef CONFIG_XFRM_BEET
+ if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL) {
+#else
if (xfrm[i]->props.mode) {
+#endif
remote = (struct in6_addr*)&xfrm[i]->id.daddr;
local = (struct in6_addr*)&xfrm[i]->props.saddr;
tunnel = 1;
}
+#ifdef CONFIG_XFRM_BEET
+ else if (xfrm[i]->props.mode == XFRM_MODE_BEET) {
+ beet_family = xfrm[i]->props.beet_family_out;
+ remotebeet.in6 = (struct in6_addr*)&xfrm[i]->id.daddr;
+ localbeet.in6 = (struct in6_addr*)&xfrm[i]->props.saddr;
+ }
+#endif
header_len += xfrm[i]->props.header_len;
trailer_len += xfrm[i]->props.trailer_len;
@@ -133,6 +160,23 @@
&fl_tunnel, AF_INET6);
if (err)
goto error;
+#ifdef CONFIG_XFRM_BEET
+ } else if (beet_family) {
+ switch(beet_family) {
+ case AF_INET:
+ fl_tunnel.fl4_dst = remotebeet.in->s_addr;
+ fl_tunnel.fl4_src = localbeet.in->s_addr;
+ break;
+ case AF_INET6:
+ ipv6_addr_copy(&fl_tunnel.fl6_dst, remotebeet.in6);
+ ipv6_addr_copy(&fl_tunnel.fl6_src, localbeet.in6);
+ break;
+ default:
+ BUG_ON(1);
+ }
+ err = xfrm_dst_lookup((struct xfrm_dst **) &rt,
+ &fl_tunnel, beet_family);
+#endif
} else
dst_hold(&rt->u.dst);
}
diff -urN linux-2.6.12.2/net/key/af_key.c
linux-beet-2.6.12.2/net/key/af_key.c
--- linux-2.6.12.2/net/key/af_key.c 2005-06-30 02:00:53.000000000 +0300
+++ linux-beet-2.6.12.2/net/key/af_key.c 2005-07-25 14:39:12.000000000
+0300
@@ -12,6 +12,14 @@
* Kunihiro Ishiguro <kunihiro@ipinfusion.com>
* Kazunori MIYAZAWA / USAGI Project <miyazawa@linux-ipv6.org>
* Derek Atkins <derek@ihtfp.com>
+ *
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
*/
#include <linux/config.h>
@@ -28,6 +36,10 @@
#include <linux/init.h>
#include <net/xfrm.h>
+#ifdef CONFIG_XFRM_BEET
+#include <linux/xfrm.h>
+#endif
+
#include <net/sock.h>
#define _X2KEY(x) ((x) == XFRM_INF ? 0 : (x))
@@ -1584,7 +1596,11 @@
}
/* addresses present only in tunnel mode */
+#ifdef CONFIG_XFRM_BEET
+ if (t->mode == IPSEC_MODE_TUNNEL-1) {
+#else
if (t->mode) {
+#endif
switch (xp->family) {
case AF_INET:
sin = (void*)(rq+1);
@@ -1612,6 +1628,40 @@
return -EINVAL;
}
}
+#ifdef CONFIG_XFRM_BEET
+ else if (t->mode == IPSEC_MODE_BEET-1) {
+ struct sockaddr *sa;
+
+ sa = (struct sockaddr *)(rq+1);
+ switch(sa->sa_family) {
+ case AF_INET:
+ sin = (struct sockaddr_in *)sa;
+ t->saddr.a4 = sin->sin_addr.s_addr;
+ sin++;
+ if (sin->sin_family != AF_INET)
+ return -EINVAL;
+ t->id.daddr.a4 = sin->sin_addr.s_addr;
+ t->family = AF_INET;
+
+ break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+ case AF_INET6:
+ sin6 = (struct sockaddr_in6 *)sa;
+ memcpy(t->saddr.a6, &sin6->sin6_addr, sizeof(struct in6_addr));
+ sin6++;
+ if (sin6->sin6_family != AF_INET6)
+ return -EINVAL;
+ memcpy(t->id.daddr.a6, &sin6->sin6_addr, sizeof(struct in6_addr));
+ t->family = AF_INET6;
+
+ break;
+#endif /* CONFIG_IPV6 */
+ default:
+ return -EINVAL;
+ }
+ }
+#endif /* CONFIG_XFRM_BEET */
+
/* No way to set this via kame pfkey */
t->aalgos = t->ealgos = t->calgos = ~0;
xp->xfrm_nr++;
@@ -1935,6 +1985,78 @@
(err = parse_ipsecrequests(xp, pol)) < 0)
goto out;
+#ifdef CONFIG_XFRM_BEET
+ /* lookup the SA (xfrm_state) and copy the inner addresses from
+ * the policy (xfrm_policy) to the selector within the state
+ */
+ if (xp->xfrm_vec[0].mode == IPSEC_MODE_BEET-1) {
+ struct xfrm_state *x;
+ if (xp->family == AF_INET6) {
+ if ((x = xfrm_lookup_bydst(XFRM_MODE_BEET,
+ &xp->xfrm_vec[0].id.daddr,
+ &xp->xfrm_vec[0].saddr,
+ AF_INET6))) {
+ /* Inner = 6, Outer = 6 */
+ x->props.beet_family_out = AF_INET6;
+ x->props.beet_family_in = AF_INET6;
+ /* insert inner addresses into the selector */
+ memcpy( &x->sel.daddr, &xp->selector.daddr,
+ sizeof(xfrm_address_t));
+ memcpy( &x->sel.saddr, &xp->selector.saddr,
+ sizeof(xfrm_address_t));
+ x->type = xfrm_get_type(x->id.proto, x->props.beet_family_in);
+ }
+ else if ((x = xfrm_lookup_bydst(XFRM_MODE_BEET,
+ &xp->xfrm_vec[0].id.daddr,
+ &xp->xfrm_vec[0].saddr,
+ AF_INET))) {
+ /* Inner = 6, Outer = 4 */
+ x->props.beet_family_out = AF_INET;
+ x->props.beet_family_in = AF_INET6;
+ /* insert inner addresses into the selector */
+ memcpy( &x->sel.daddr, &xp->selector.daddr,
+ sizeof(xfrm_address_t));
+ memcpy( &x->sel.saddr, &xp->selector.saddr,
+ sizeof(xfrm_address_t));
+ x->type = xfrm_get_type(x->id.proto, x->props.beet_family_in);
+ }
+ } else if (xp->family == AF_INET) {
+ if ((x = xfrm_lookup_bydst(XFRM_MODE_BEET,
+ &xp->xfrm_vec[0].id.daddr,
+ &xp->xfrm_vec[0].saddr,
+ AF_INET)))
+ {
+ /* Inner = 4, Outer = 4 */
+ x->props.beet_family_out = AF_INET;
+ x->props.beet_family_in = AF_INET;
+ /* insert inner addresses into the selector */
+ memcpy( &x->sel.daddr, &xp->selector.daddr,
+ sizeof(xfrm_address_t));
+ memcpy( &x->sel.saddr, &xp->selector.saddr,
+ sizeof(xfrm_address_t));
+ x->type = xfrm_get_type(x->id.proto, x->props.beet_family_in);
+ }
+ else if ((x = xfrm_lookup_bydst(XFRM_MODE_BEET,
+ &xp->xfrm_vec[0].id.daddr,
+ &xp->xfrm_vec[0].saddr,
+ AF_INET6)))
+ {
+ /* Inner = 4, Outer = 6 */
+ x->props.beet_family_out = AF_INET6;
+ x->props.beet_family_in = AF_INET;
+ /* insert inner addresses into the selector */
+ memcpy( &x->sel.daddr, &xp->selector.daddr,
+ sizeof(xfrm_address_t));
+ memcpy( &x->sel.saddr, &xp->selector.saddr,
+ sizeof(xfrm_address_t));
+ x->type = xfrm_get_type(x->id.proto, x->props.beet_family_in);
+ }
+
+ } else {
+ BUG_ON(1);
+ }
+ }
+#endif
out_skb = pfkey_xfrm_policy2msg_prep(xp);
if (IS_ERR(out_skb)) {
err = PTR_ERR(out_skb);
diff -urN linux-2.6.12.2/net/xfrm/Kconfig
linux-beet-2.6.12.2/net/xfrm/Kconfig
--- linux-2.6.12.2/net/xfrm/Kconfig 2005-06-30 02:00:53.000000000 +0300
+++ linux-beet-2.6.12.2/net/xfrm/Kconfig 2005-07-25 15:04:36.000000000
+0300
@@ -10,3 +10,11 @@
If unsure, say Y.
+config XFRM_BEET
+ bool "IPsec BEET mode"
+ depends on XFRM
+ ---help---
+ IPsec BEET mode is combination of IPsec transport and tunnel
mode.
+ Currently, it is used only by HIP.
+
+ If unsure, say N.
diff -urN linux-2.6.12.2/net/xfrm/Kconfig~
linux-beet-2.6.12.2/net/xfrm/Kconfig~
--- linux-2.6.12.2/net/xfrm/Kconfig~ 1970-01-01 02:00:00.000000000 +0200
+++ linux-beet-2.6.12.2/net/xfrm/Kconfig~ 2005-07-25 14:39:13.000000000
+0300
@@ -0,0 +1,28 @@
+#
+# XFRM configuration
+#
+config XFRM_USER
+ tristate "IPsec user configuration interface"
+ depends on INET && XFRM
+ ---help---
+ Support for IPsec user configuration interface used
+ by native Linux tools.
+
+ If unsure, say Y.
+
+config XFRM_BEET
+ bool "IPsec BEET mode"
+ depends on XFRM
+ ---help---
+ IPsec BEET mode is combination of IPsec transport and tunnel
mode.
+ Currently, it is used only by HIP.
+
+ If unsure, say N.
+
+config XFRM_BEET_DEBUG
+ bool "IPsec BEET mode debugging"
+ depends on XFRM_BEET
+ ---help---
+ Enables BEET mode debugging via syslog.
+
+ If unsure, say N.
diff -urN linux-2.6.12.2/net/xfrm/Makefile
linux-beet-2.6.12.2/net/xfrm/Makefile
--- linux-2.6.12.2/net/xfrm/Makefile 2005-06-30 02:00:53.000000000 +0300
+++ linux-beet-2.6.12.2/net/xfrm/Makefile 2005-07-25 14:39:13.000000000
+0300
@@ -2,6 +2,6 @@
# Makefile for the XFRM subsystem.
#
-obj-$(CONFIG_XFRM) := xfrm_policy.o xfrm_state.o xfrm_input.o
xfrm_algo.o
+obj-$(CONFIG_XFRM) := xfrm_policy.o xfrm_state.o xfrm_input.o
xfrm_algo.o xfrm_beet.o
obj-$(CONFIG_XFRM_USER) += xfrm_user.o
diff -urN linux-2.6.12.2/net/xfrm/xfrm_beet.c
linux-beet-2.6.12.2/net/xfrm/xfrm_beet.c
--- linux-2.6.12.2/net/xfrm/xfrm_beet.c 1970-01-01 02:00:00.000000000
+0200
+++ linux-beet-2.6.12.2/net/xfrm/xfrm_beet.c 2005-07-25
15:03:01.000000000 +0300
@@ -0,0 +1,227 @@
+/*
+ * xfrm_beet.c: allows for receiving and transmitting packet in BEET
mode
+ *
+ * Authors:
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
+ */
+
+#include <linux/workqueue.h>
+#include <net/xfrm.h>
+#include <linux/pfkeyv2.h>
+#include <linux/ipsec.h>
+#include <linux/module.h>
+#include <asm/uaccess.h>
+#include <net/ip.h>
+
+#ifdef CONFIG_XFRM_BEET
+
+/* xfrm_beet_output: deals with the outgoing BEET packets.
+ * It changes the outer ip header and correctly set
+ * the header fields
+ *
+ * @skb: structure sk_buff which contains the packet to be transmitted
+ * skb->data points to the ip header
+*/
+int xfrm_beet_output(struct sk_buff *skb)
+{
+ int err = 0;
+ struct xfrm_state *x = skb->dst->xfrm;
+
+ if (x->props.beet_family_in == AF_INET && x->props.beet_family_out ==
AF_INET){
+ /* Inner = 4, Outer = 4 */
+ struct iphdr *iph = (struct iphdr*)skb->data;
+
+ iph->saddr = x->props.saddr.a4;
+ iph->daddr = x->id.daddr.a4;
+
+ skb->local_df = 1; //I am a bit unsure on how to implement this -Abi
+
+ iph->check = 0;
+ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+
+ } else if (x->props.beet_family_in == AF_INET &&
x->props.beet_family_out == AF_INET6){
+ /* Inner = 4, Outer = 6 */
+ struct iphdr *iph = (struct iphdr*)skb->data;
+ __u8 protocol, ttl;
+
+ protocol = iph->protocol;
+ ttl = iph->ttl;
+
+ if (skb_headroom(skb) < sizeof(struct ipv6hdr) - sizeof(struct
iphdr)){
+ if (pskb_expand_head(skb, sizeof(struct ipv6hdr) - sizeof(struct
iphdr),0, GFP_ATOMIC))
+ return -EINVAL; //Just returning from here.
+
+ skb->len += sizeof(struct ipv6hdr) - sizeof(struct iphdr);
+ skb->nh.raw = skb->h.raw - sizeof(struct ipv6hdr);
+ skb->data = skb->nh.raw;
+
+ } else {
+ skb_push(skb, sizeof(struct ipv6hdr) - sizeof(struct iphdr));
+ skb->nh.raw = skb->h.raw - sizeof(struct ipv6hdr);
+ skb->data = skb->nh.raw;
+ }
+
+ skb->protocol = htons(ETH_P_IPV6);
+
+ skb->nh.ipv6h = (struct ipv6hdr*)(skb->data);
+
+ skb->nh.ipv6h->version = 6;
+ skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct
ipv6hdr));
+ skb->nh.ipv6h->nexthdr = protocol;
+ skb->nh.ipv6h->hop_limit = ttl;
+ ipv6_addr_copy(&skb->nh.ipv6h->saddr,(struct in6_addr
*)&x->props.saddr);
+ ipv6_addr_copy(&skb->nh.ipv6h->daddr, (struct in6_addr
*)&x->id.daddr);
+
+ skb->nh.ipv6h->priority = 0;
+ skb->nh.ipv6h->flow_lbl[0] = 0;
+ skb->nh.ipv6h->flow_lbl[1] = 0;
+ skb->nh.ipv6h->flow_lbl[2] = 0;
+
+ } else if (x->props.beet_family_in == AF_INET6 &&
x->props.beet_family_out == AF_INET){
+ /* Inner = 6, Outer = 4 */
+ struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
+ int delta = sizeof(struct ipv6hdr) - sizeof(struct iphdr);
+ u8 hop, proto;
+ u16 payload;
+ struct iphdr *ip4;
+ hop = iph->hop_limit;
+ proto = iph->nexthdr;
+
+ payload = ntohs(iph->payload_len) + sizeof(struct iphdr);
+
+ skb_pull(skb, delta);
+
+ skb->protocol = htons(ETH_P_IP);
+ ip4 = (struct iphdr *)skb->data;
+
+ ip4->ihl = (sizeof(struct iphdr) >> 2);
+ ip4->version = 4;
+ ip4->tos = 0;
+ ip4->tot_len = htons(payload);
+ ip4->id = 0;
+ ip4->frag_off = htons(IP_DF);
+ ip4->ttl = hop;
+ ip4->protocol = proto;
+ ip4->check = 0;
+ ip4->saddr = x->props.saddr.a4;
+ ip4->daddr = x->id.daddr.a4;
+ ip4->check = ip_fast_csum((unsigned char *)ip4, ip4->ihl);
+ /* The esp6_output assumes that skb->data points to outer IP header,
+ * skb->nh points eventual new ext hdrs and skb->h points to the ESP
header
+ */
+ skb->nh.raw = skb->data; // there is no extension header
+
+ } else if (x->props.beet_family_in == AF_INET6 &&
x->props.beet_family_out == AF_INET6){
+ /* Inner = 6, Outer = 6 */
+ struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
+ ipv6_addr_copy(&iph->saddr, (struct in6_addr *)&x->props.saddr);
+ ipv6_addr_copy(&iph->daddr, (struct in6_addr *)&x->id.daddr);
+ }
+
+ return err;
+}
+EXPORT_SYMBOL(xfrm_beet_output);
+
+
+/* xfrm_beet_input: deals with the incoming BEET packets.
+ * It changes the outer ip header with the corresponding inner ip
header and addresses
+ *
+ * @skb: structure sk_buff. skb->nh.raw points to the outer ip address
+ * skb->data and skb->h.raw point to the ESP to be decapsulated
+ *
+ * @x : struct xfrm_state containing the state information
+ *
+*/
+int xfrm_beet_input(struct sk_buff *skb, struct xfrm_state *x)
+{
+ int err = 0;
+
+ if (x->props.beet_family_in == AF_INET && x->props.beet_family_out ==
AF_INET){
+ /* Inner = 4, Outer = 4 */
+ struct iphdr *iph = (struct iphdr *)skb->nh.iph;
+
+ iph->daddr = x->sel.daddr.a4;
+ iph->saddr = x->sel.saddr.a4;
+ iph->ttl--;
+ iph->tot_len = htons(skb->len);
+ iph->frag_off = htons(IP_DF);
+ iph->check = 0;
+ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+
+ } else if (x->props.beet_family_in == AF_INET &&
x->props.beet_family_out == AF_INET6){
+ /* Inner = 4, Outer = 6 */
+ struct iphdr *iph;
+ __u8 proto = skb->nh.ipv6h->nexthdr;
+ __u8 hops = skb->nh.ipv6h->hop_limit;
+
+
+ skb->h.raw = skb->nh.raw + sizeof(struct ipv6hdr) - sizeof(struct
iphdr);
+ memmove(skb->h.raw, skb->data, skb->len);
+ skb->data = skb->h.raw;
+
+
+ eth_hdr(skb)->h_proto=htons(ETH_P_IP);
+
+ iph = (struct iphdr *)skb->nh.raw;
+ memset(iph, 0, sizeof(struct iphdr));
+ iph->daddr = x->sel.daddr.a4;
+ iph->saddr = x->sel.saddr.a4;
+ iph->ttl = hops--;
+ iph->protocol = proto;
+ iph->tot_len = htons(skb->len);
+ iph->frag_off = htons(IP_DF);
+ iph->ihl = 5;
+ iph->version = 4;
+ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+
+ skb->protocol = htons(ETH_P_IP);
+
+ } else if (x->props.beet_family_in == AF_INET6 &&
x->props.beet_family_out == AF_INET){
+ /* Inner = 6, Outer = 4 */
+ struct ipv6hdr *ip6h;
+ int proto = skb->nh.iph->protocol;
+ int hops = skb->nh.iph->ttl;
+ int total = skb->len - sizeof(struct iphdr);
+
+ if (skb_tailroom(skb) < sizeof(struct ipv6hdr) - sizeof(struct
iphdr)){
+ if (pskb_expand_head(skb, 0, sizeof(struct ipv6hdr) - sizeof(struct
iphdr), GFP_ATOMIC))
+ return -EINVAL; //Just returning from here.
+ }
+
+ skb->h.raw = skb->nh.raw + sizeof(struct ipv6hdr);
+ memmove(skb->h.raw, skb->data, skb->len);
+ skb->data = skb->h.raw;
+ skb->tail += sizeof(struct ipv6hdr) - sizeof(struct iphdr);
+
+ eth_hdr(skb)->h_proto=htons(ETH_P_IPV6);
+ ip6h = skb->nh.ipv6h;
+
+ memset(ip6h, 0, sizeof(struct ipv6hdr));
+ ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *)&x->sel.saddr.a6);
+ ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *)&x->sel.daddr.a6);
+ ip6h->payload_len = htons(total);
+ ip6h->hop_limit = hops-1;
+ ip6h->version = 6;
+ ip6h->nexthdr = proto;
+
+ skb->protocol = htons(ETH_P_IPV6);
+
+ } else if (x->props.beet_family_in == AF_INET6 &&
x->props.beet_family_out == AF_INET6){
+ /* Inner = 6, Outer = 6 */
+ struct ipv6hdr *ip6h = (struct ipv6hdr *)skb->nh.raw;
+ ipv6_addr_copy(&ip6h->daddr,
+ (struct in6_addr *) &x->sel.daddr.a6);
+ ipv6_addr_copy(&ip6h->saddr,
+ (struct in6_addr *) &x->sel.saddr.a6);
+ }
+
+ return err;
+}
+EXPORT_SYMBOL(xfrm_beet_input);
+
+#endif /* CONFIG_XFRM_BEET */
diff -urN linux-2.6.12.2/net/xfrm/xfrm_policy.c
linux-beet-2.6.12.2/net/xfrm/xfrm_policy.c
--- linux-2.6.12.2/net/xfrm/xfrm_policy.c 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/net/xfrm/xfrm_policy.c 2005-07-25
14:39:13.000000000 +0300
@@ -11,6 +11,13 @@
* Split up af-specific portion
* Derek Atkins <derek@ihtfp.com> Add the post_input processor
*
+ * Changes: BEET support
+ * Abhinav Pathak <abpathak@iitk.ac.in>
+ * Diego Beltrami <diego.beltrami@hiit.fi>
+ * Kristian Slavov <kristian.slavov@nomadiclab.com>
+ * Miika Komu <miika@iki.fi>
+ * Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
+ *
*/
#include <asm/bug.h>
@@ -643,6 +650,10 @@
struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];
if (tmpl->mode) {
+#ifdef CONFIG_XFRM_BEET
+ if(tmpl->mode == XFRM_MODE_BEET)
+ family = tmpl->family;
+#endif
remote = &tmpl->id.daddr;
local = &tmpl->saddr;
}
diff -urN linux-2.6.12.2/net/xfrm/xfrm_state.c
linux-beet-2.6.12.2/net/xfrm/xfrm_state.c
--- linux-2.6.12.2/net/xfrm/xfrm_state.c 2005-06-30 02:00:53.000000000
+0300
+++ linux-beet-2.6.12.2/net/xfrm/xfrm_state.c 2005-07-25
14:39:13.000000000 +0300
@@ -1036,3 +1036,31 @@
INIT_WORK(&xfrm_state_gc_work, xfrm_state_gc_task, NULL);
}
+#ifdef CONFIG_XFRM_BEET
+
+struct xfrm_state *
+xfrm_lookup_bydst(u8 mode, xfrm_address_t *daddr, xfrm_address_t
*saddr, unsigned short family)
+{
+ struct xfrm_state *x;
+ unsigned h = xfrm_dst_hash(daddr, family);
+
+ list_for_each_entry(x, xfrm_state_bydst+h, bydst){
+
+ if (x->props.family == AF_INET6 &&
+ ipv6_addr_equal((struct in6_addr *)daddr, (struct in6_addr
*)x->id.daddr.a6) &&
+ mode == x->props.mode &&
+ ipv6_addr_equal((struct in6_addr *)saddr, (struct in6_addr
*)x->props.saddr.a6)) {
+ return(x);
+ }
+
+ if (x->props.family == AF_INET &&
+ daddr->a4 == x->id.daddr.a4 &&
+ mode == x->props.mode &&
+ saddr->a4 == x->props.saddr.a4)
+ return(x);
+
+ }
+ return(NULL);
+}
+
+#endif //CONFIG_XFRM_BEET
^ permalink raw reply
* Re: Netlink connector
From: Evgeniy Polyakov @ 2005-07-25 7:06 UTC (permalink / raw)
To: James Morris
Cc: Andrew Morton, Harald Welte, netdev, netfilter-devel,
linux-kernel, netdev
In-Reply-To: <Lynx.SEL.4.62.0507250154000.21934@thoron.boston.redhat.com>
On Mon, Jul 25, 2005 at 02:02:10AM -0400, James Morris (jmorris@redhat.com) wrote:
> On Sun, 24 Jul 2005, David S. Miller wrote:
> >From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
> >Date: Sat, 23 Jul 2005 13:14:55 +0400
> >
> >>Andrew has no objection against connector and it lives in -mm
> >
> >A patch sitting in -mm has zero significance.
That is why I'm asking netdev@ people again...
> The significance I think is that Andrew is trying to gently encourage some
> further progress in the area.
>
> I recall some netconf discussion about TIPC over Netlink, or more likely a
> variation thereof, which may be a better way forward.
>
> It's cool stuff http://tipc.sourceforge.net/
I read it quite long ago - I'm sure you do not want to use that monster
for event bus.
It was designed and implemented for heavy intermachine communications,
and it is quite hard to setup for userspace <-> kernelspace message bus.
>
> - James
> --
> James Morris
> <jmorris@redhat.com>
--
Evgeniy Polyakov
^ permalink raw reply
* Re: [PATCH] reduce netfilte sk_buff enlargement
From: David S. Miller @ 2005-07-25 2:18 UTC (permalink / raw)
To: marcel; +Cc: laforge, netdev, netfilter-devel, wensong
In-Reply-To: <1122082580.5878.3.camel@notepaq>
From: Marcel Holtmann <marcel@holtmann.org>
Date: Sat, 23 Jul 2005 03:36:20 +0200
> If you are serious with the shrinking of the sk_buff, I can send you
> the final patch along with my pending patches for 2.6.13.
Please do. The pkt_type change would get queued for 2.6.14,
and please only send real bug fixes when targetting for 2.6.13.
Thanks.
^ permalink raw reply
* multicast on loopback: mcast networking at the cottage
From: Michael Richardson @ 2005-07-24 23:35 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: netdev
-----BEGIN PGP SIGNED MESSAGE-----
I got frustrated at the cottage just now while testing code using
multiple user mode linux boxes, because I hit the annoying:
Configuring network interfaces: mcast_open: IP_ADD_MEMBERSHIP failed, error = 19
There appears not to be a multicast-capable network interface on the host.
eth0 should be configured in order to use the multicast transport.
SIOCSIFFLAGS: Invalid argument
mcast_open: IP_ADD_MEMBERSHIP failed, error = 19
I would just use a script that switched me to daemon networking, but I
thought I'd look into this more.
I was always going on the assumption that this was because
drivers/net/loopback.c was missing a set_multicast_list call.
Presence of that function is checked in net/core/dev.c. I wrote one (it
doesn't need to do anything...) for fun, rebooted, and noticed that it
didn't help.
What did help was:
route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
and it worked even on a stock kernel (2.6.11.8 is what I have).
[thus there is no patch attached here...]
Thinking back, BSD and Solaris do this whenever an interface that has
IFF_MULTICAST set is configured up. Normally configuring "eth0" and
giving it a default route works --- the check for a route to the
multicast address gives you a valid interface, and all is well.
I suspect that for people who want to do multicast between hosts on an
actual wire won't want to have just a route to lo, they may want a route
for 224.0.0.0/4 on all of their interfaces. Maybe that should be automatic?
I think that applications that are multicast aware are supposed to
figure out which interfaces that they want to bind to anyway, so they
should not be confused by the multiple routes.
- --
] Michael Richardson Xelerance Corporation, Ottawa, ON | firewalls [
] mcr @ xelerance.com Now doing IPsec training, see |net architect[
] http://www.sandelman.ca/mcr/ www.xelerance.com/training/ |device driver[
] I'm a dad: http://www.sandelman.ca/lrmr/ [
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Finger me for keys
iQCVAwUBQuQlvIqHRg3pndX9AQGi7QP9FajMsWOj2AZUyPrDtj+T02z5T+Zc1oej
8qobkO624XYhgKlRW/FiBTRNrYOS+MclM2pqeKxOSF7frzt2azZUfOLb0OdNiv1B
d8MBTA4MgPTLVeSapXrMA0JImy8KtquRWsn2ApumW/Odsor9OQjqhlYVsYqCMnTD
xyFcpSMvArc=
=jRE9
-----END PGP SIGNATURE-----
^ permalink raw reply
* Re: [stable] Re: [05/11] SMP fix for 6pack driver
From: Adrian Bunk @ 2005-07-24 16:08 UTC (permalink / raw)
To: Ralf Baechle
Cc: Greg KH, Francois Romieu, Greg KH, torvalds, akpm,
Theodore Ts'o, Zwane Mwaikambo, netdev, Justin Forbes,
linux-kernel, Randy.Dunlap, Chuck Wolber, jgarzik, stable, alan
In-Reply-To: <20050717210939.GA11884@linux-mips.org>
On Sun, Jul 17, 2005 at 05:09:39PM -0400, Ralf Baechle wrote:
> On Fri, Jul 15, 2005 at 09:35:56PM +0200, Adrian Bunk wrote:
>
> > I do agree with Francois regarding this issue:
> >
> > AFAIR, there has been not one 2.6 kernel where this driver was available
> > for SMP kernels.
>
> Eh... That after all is the raison d'etre for this patch :)
>
> > It's therefore untested which problems might arise with
> > this driver on SMP systems. I'm not arguing against including this
> > driver in 2.6.13, but 2.6.12.3 isn't the right place.
>
> Nonsense. Most development activity for this stuff happens not on the
> internet and you won't be able to follow it unless you're a licensed ham.
> I've been circulating things patch since a while and nobody has been unhappy.
So why was it important to get it into 2.6.12.3?
I must have missed the announcement that the original -stable goals have
been declared obsolete.
> > What surprises me most is that you accepted this patch is neither in
> > 2.6.13-rc3 nor in 2.6.13-rc3-mm1. There seems to be either an
> > (IMHO unfortunate) change in your policy of what patches to accept,
> > or there's a serious problem in your patch review process.
>
> I've sent it to jgarzik so it's somewhere on it's long way there.
>
> Ralf
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply
* Re: [PATCH RFC]: PHY Abstraction Layer III
From: Kumar Gala @ 2005-07-24 14:20 UTC (permalink / raw)
To: Francois Romieu; +Cc: netdev, Embedded PPC Linux list
In-Reply-To: <20050723215913.GA777@electric-eye.fr.zoreil.com>
Because the patch is all new code. drivers/net/phy/phy.c doesn't
exist in any kernel tree. The patch is adding it.
- kumar
On Jul 23, 2005, at 4:59 PM, Francois Romieu wrote:
> Andy Fleming <afleming@freescale.com> :
>
>> Here's the latest version of the patch, done against a cogito
>> linux-2.6 branch.
>>
>
> The patch includes a diff against drivers/net/phy/phy.c which does not
> seem to exist in my -rc3-git4 local tree. Where can it be found ?
>
> --
> Ueimor
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH 2.6.13rc3] IPv6: Check interface bindings on IPv6 raw socket reception
From: Patrick McHardy @ 2005-07-24 5:39 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Andrew McDonald, netdev, yoshfuji, davem, linux-kernel
In-Reply-To: <42E2DFAE.8070101@trash.net>
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
Patrick McHardy wrote:
> Andrew McDonald wrote:
>
>> Take account of whether a socket is bound to a particular device when
>> selecting an IPv6 raw socket to receive a packet. Also perform this
>> check when receiving IPv6 packets with router alert options.
>
> I guess this one makes sense on top.
>
> [IPV4/6]: Check if packet was actually delivered to a raw socket to decide whether to send an ICMP unreachable
The Last patch didn't handle ICMP socket filters correctly, here is a
better one.
If a raw socket is bound to a single device the packet might not be
delivered even though there is a socket in the protocol hash. Send
back an ICMP protocol unreachable in this case.
[-- Attachment #2: x.diff --]
[-- Type: text/x-patch, Size: 4427 bytes --]
[IPV4/6]: Check if packet was actually delivered to a raw socket to decide whether to send an ICMP unreachable
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit eb82d02518ac3a400663163995097749d91c7c4c
tree 1719713411b5e656ab5926ee633c39c0edfb1108
parent 36245c9aaddbed7e50d9600c8d1889ebee48a90f
author Patrick McHardy <kaber@trash.net> Sun, 24 Jul 2005 06:54:32 +0200
committer Patrick McHardy <kaber@trash.net> Sun, 24 Jul 2005 06:54:32 +0200
include/net/raw.h | 2 +-
include/net/rawv6.h | 2 +-
net/ipv4/ip_input.c | 4 ++--
net/ipv4/raw.c | 5 ++++-
net/ipv6/ip6_input.c | 4 ++--
net/ipv6/raw.c | 5 ++++-
6 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/include/net/raw.h b/include/net/raw.h
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -37,6 +37,6 @@ extern struct sock *__raw_v4_lookup(stru
unsigned long raddr, unsigned long laddr,
int dif);
-extern void raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
+extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
#endif /* _RAW_H */
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -7,7 +7,7 @@
extern struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE];
extern rwlock_t raw_v6_lock;
-extern void ipv6_raw_deliver(struct sk_buff *skb, int nexthdr);
+extern int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr);
extern struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num,
struct in6_addr *loc_addr, struct in6_addr *rmt_addr,
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -225,8 +225,8 @@ static inline int ip_local_deliver_finis
/* If there maybe a raw socket we must check - if not we
* don't care less
*/
- if (raw_sk)
- raw_v4_input(skb, skb->nh.iph, hash);
+ if (raw_sk && !raw_v4_input(skb, skb->nh.iph, hash))
+ raw_sk = NULL;
if ((ipprot = rcu_dereference(inet_protos[hash])) != NULL) {
int ret;
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -150,10 +150,11 @@ static __inline__ int icmp_filter(struct
* RFC 1122: SHOULD pass TOS value up to the transport layer.
* -> It does. And not only TOS, but all IP header.
*/
-void raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash)
+int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash)
{
struct sock *sk;
struct hlist_head *head;
+ int delivered = 0;
read_lock(&raw_v4_lock);
head = &raw_v4_htable[hash];
@@ -164,6 +165,7 @@ void raw_v4_input(struct sk_buff *skb, s
skb->dev->ifindex);
while (sk) {
+ delivered = 1;
if (iph->protocol != IPPROTO_ICMP || !icmp_filter(sk, skb)) {
struct sk_buff *clone = skb_clone(skb, GFP_ATOMIC);
@@ -177,6 +179,7 @@ void raw_v4_input(struct sk_buff *skb, s
}
out:
read_unlock(&raw_v4_lock);
+ return delivered;
}
void raw_err (struct sock *sk, struct sk_buff *skb, u32 info)
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -166,8 +166,8 @@ resubmit:
nexthdr = skb->nh.raw[nhoff];
raw_sk = sk_head(&raw_v6_htable[nexthdr & (MAX_INET_PROTOS - 1)]);
- if (raw_sk)
- ipv6_raw_deliver(skb, nexthdr);
+ if (raw_sk && !ipv6_raw_deliver(skb, nexthdr))
+ raw_sk = NULL;
hash = nexthdr & (MAX_INET_PROTOS - 1);
if ((ipprot = rcu_dereference(inet6_protos[hash])) != NULL) {
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -141,11 +141,12 @@ static __inline__ int icmpv6_filter(stru
*
* Caller owns SKB so we must make clones.
*/
-void ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
+int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
{
struct in6_addr *saddr;
struct in6_addr *daddr;
struct sock *sk;
+ int delivered = 0;
__u8 hash;
saddr = &skb->nh.ipv6h->saddr;
@@ -167,6 +168,7 @@ void ipv6_raw_deliver(struct sk_buff *sk
sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr, skb->dev->ifindex);
while (sk) {
+ delivered = 1;
if (nexthdr != IPPROTO_ICMPV6 || !icmpv6_filter(sk, skb)) {
struct sk_buff *clone = skb_clone(skb, GFP_ATOMIC);
@@ -179,6 +181,7 @@ void ipv6_raw_deliver(struct sk_buff *sk
}
out:
read_unlock(&raw_v6_lock);
+ return delivered;
}
/* This cleans up af_inet6 a bit. -DaveM */
^ permalink raw reply
* You netdev@oss.sgi.com are not member (cgreek ML)
From: cgreek-admin @ 2005-07-24 4:39 UTC (permalink / raw)
To: netdev
In-Reply-To: <200507240437.j6O4bweX027054@kitt.m17n.org>
You are not a member of this mailing list <cgreek@m17n.org>.
If you know the general guide of this list, please send mail with
the mail body
guide
to the address
cgreek-ctl@m17n.org
where guide is equal to GUIDE for case insensitive.
^ permalink raw reply
* Re: [PATCH 2.6.13rc3] IPv6: Check interface bindings on IPv6 raw socket reception
From: Patrick McHardy @ 2005-07-24 0:24 UTC (permalink / raw)
To: Andrew McDonald; +Cc: netdev, yoshfuji, davem, linux-kernel
In-Reply-To: <20050723180442.GB6731@mcdonald.org.uk>
[-- Attachment #1: Type: text/plain, Size: 267 bytes --]
Andrew McDonald wrote:
> Take account of whether a socket is bound to a particular device when
> selecting an IPv6 raw socket to receive a packet. Also perform this
> check when receiving IPv6 packets with router alert options.
I guess this one makes sense on top.
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 4505 bytes --]
[IPV4/6]: Check if packet was actually delivered to a raw socket to decide whether to send an ICMP unreachable
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 0fc074eed6ad201d76392dcabbc156784570ea64
tree 913c87ad866f4abb23e9788c0170b81b564cfe7a
parent 36245c9aaddbed7e50d9600c8d1889ebee48a90f
author Patrick McHardy <kaber@trash.net> Sun, 24 Jul 2005 02:23:25 +0200
committer Patrick McHardy <kaber@trash.net> Sun, 24 Jul 2005 02:23:25 +0200
include/net/raw.h | 2 +-
include/net/rawv6.h | 2 +-
net/ipv4/ip_input.c | 4 ++--
net/ipv4/raw.c | 8 ++++++--
net/ipv6/ip6_input.c | 4 ++--
net/ipv6/raw.c | 8 ++++++--
6 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/include/net/raw.h b/include/net/raw.h
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -37,6 +37,6 @@ extern struct sock *__raw_v4_lookup(stru
unsigned long raddr, unsigned long laddr,
int dif);
-extern void raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
+extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
#endif /* _RAW_H */
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -7,7 +7,7 @@
extern struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE];
extern rwlock_t raw_v6_lock;
-extern void ipv6_raw_deliver(struct sk_buff *skb, int nexthdr);
+extern int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr);
extern struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num,
struct in6_addr *loc_addr, struct in6_addr *rmt_addr,
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -225,8 +225,8 @@ static inline int ip_local_deliver_finis
/* If there maybe a raw socket we must check - if not we
* don't care less
*/
- if (raw_sk)
- raw_v4_input(skb, skb->nh.iph, hash);
+ if (raw_sk && !raw_v4_input(skb, skb->nh.iph, hash))
+ raw_sk = NULL;
if ((ipprot = rcu_dereference(inet_protos[hash])) != NULL) {
int ret;
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -150,10 +150,11 @@ static __inline__ int icmp_filter(struct
* RFC 1122: SHOULD pass TOS value up to the transport layer.
* -> It does. And not only TOS, but all IP header.
*/
-void raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash)
+int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash)
{
struct sock *sk;
struct hlist_head *head;
+ int delivered = 0;
read_lock(&raw_v4_lock);
head = &raw_v4_htable[hash];
@@ -168,8 +169,10 @@ void raw_v4_input(struct sk_buff *skb, s
struct sk_buff *clone = skb_clone(skb, GFP_ATOMIC);
/* Not releasing hash table! */
- if (clone)
+ if (clone) {
raw_rcv(sk, clone);
+ delivered = 1;
+ }
}
sk = __raw_v4_lookup(sk_next(sk), iph->protocol,
iph->saddr, iph->daddr,
@@ -177,6 +180,7 @@ void raw_v4_input(struct sk_buff *skb, s
}
out:
read_unlock(&raw_v4_lock);
+ return delivered;
}
void raw_err (struct sock *sk, struct sk_buff *skb, u32 info)
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -166,8 +166,8 @@ resubmit:
nexthdr = skb->nh.raw[nhoff];
raw_sk = sk_head(&raw_v6_htable[nexthdr & (MAX_INET_PROTOS - 1)]);
- if (raw_sk)
- ipv6_raw_deliver(skb, nexthdr);
+ if (raw_sk && !ipv6_raw_deliver(skb, nexthdr))
+ raw_sk = NULL;
hash = nexthdr & (MAX_INET_PROTOS - 1);
if ((ipprot = rcu_dereference(inet6_protos[hash])) != NULL) {
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -141,11 +141,12 @@ static __inline__ int icmpv6_filter(stru
*
* Caller owns SKB so we must make clones.
*/
-void ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
+int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
{
struct in6_addr *saddr;
struct in6_addr *daddr;
struct sock *sk;
+ int delivered = 0;
__u8 hash;
saddr = &skb->nh.ipv6h->saddr;
@@ -171,14 +172,17 @@ void ipv6_raw_deliver(struct sk_buff *sk
struct sk_buff *clone = skb_clone(skb, GFP_ATOMIC);
/* Not releasing hash table! */
- if (clone)
+ if (clone) {
rawv6_rcv(sk, clone);
+ delivered = 1;
+ }
}
sk = __raw_v6_lookup(sk_next(sk), nexthdr, daddr, saddr,
skb->dev->ifindex);
}
out:
read_unlock(&raw_v6_lock);
+ return delivered;
}
/* This cleans up af_inet6 a bit. -DaveM */
^ permalink raw reply
* [2.6 patch] net/ipv4/: possible cleanups
From: Adrian Bunk @ 2005-07-23 22:05 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-kernel
This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global function:
- xfrm4_state.c: xfrm4_state_fini
- remove the following unneeded EXPORT_SYMBOL's:
- ip_output.c: ip_finish_output
- ip_output.c: sysctl_ip_default_ttl
- fib_frontend.c: ip_dev_find
- inetpeer.c: inet_peer_idlock
- ip_options.c: ip_options_compile
- ip_options.c: ip_options_undo
- net/core/request_sock.c: sysctl_max_syn_backlog
Signed-off-by: Adrian Bunk <bunk@stusta.de>
---
This patch was already sent on:
- 26 Jun 2005
include/net/ip.h | 2 --
include/net/route.h | 4 ----
include/net/xfrm.h | 1 -
net/core/request_sock.c | 1 -
net/ipv4/fib_frontend.c | 1 -
net/ipv4/inetpeer.c | 2 --
net/ipv4/ip_options.c | 3 ---
net/ipv4/ip_output.c | 7 +------
net/ipv4/multipath_drr.c | 2 +-
net/ipv4/route.c | 4 +++-
net/ipv4/xfrm4_state.c | 2 ++
11 files changed, 7 insertions(+), 22 deletions(-)
--- linux-2.6.12-rc3-mm2-full/include/net/ip.h.old 2005-05-05 02:35:00.000000000 +0200
+++ linux-2.6.12-rc3-mm2-full/include/net/ip.h 2005-05-05 02:35:07.000000000 +0200
@@ -140,8 +140,6 @@
void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
unsigned int len);
-extern int ip_finish_output(struct sk_buff *skb);
-
struct ipv4_config
{
int log_martians;
--- linux-2.6.12-rc3-mm2-full/net/ipv4/multipath_drr.c.old 2005-05-05 02:37:58.000000000 +0200
+++ linux-2.6.12-rc3-mm2-full/net/ipv4/multipath_drr.c 2005-05-05 02:38:06.000000000 +0200
@@ -107,7 +107,7 @@
return NOTIFY_DONE;
}
-struct notifier_block drr_dev_notifier = {
+static struct notifier_block drr_dev_notifier = {
.notifier_call = drr_dev_event,
};
--- linux-2.6.12-rc3-mm3-full/net/ipv4/ip_output.c.old 2005-05-05 21:43:22.000000000 +0200
+++ linux-2.6.12-rc3-mm3-full/net/ipv4/ip_output.c 2005-05-05 21:44:36.000000000 +0200
@@ -216,7 +216,7 @@
return -EINVAL;
}
-int ip_finish_output(struct sk_buff *skb)
+static int ip_finish_output(struct sk_buff *skb)
{
struct net_device *dev = skb->dst->dev;
@@ -1351,12 +1351,7 @@
#endif
}
-EXPORT_SYMBOL(ip_finish_output);
EXPORT_SYMBOL(ip_fragment);
EXPORT_SYMBOL(ip_generic_getfrag);
EXPORT_SYMBOL(ip_queue_xmit);
EXPORT_SYMBOL(ip_send_check);
-
-#ifdef CONFIG_SYSCTL
-EXPORT_SYMBOL(sysctl_ip_default_ttl);
-#endif
--- linux-2.6.12-rc3-mm3-full/net/ipv4/route.c.old 2005-05-05 21:21:21.000000000 +0200
+++ linux-2.6.12-rc3-mm3-full/net/ipv4/route.c 2005-05-05 21:22:14.000000000 +0200
@@ -209,7 +209,9 @@
static int rt_hash_log;
static unsigned int rt_hash_rnd;
-struct rt_cache_stat *rt_cache_stat;
+static struct rt_cache_stat *rt_cache_stat;
+#define RT_CACHE_STAT_INC(field) \
+ (per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++)
static int rt_intern_hash(unsigned hash, struct rtable *rth,
struct rtable **res);
--- linux-2.6.12-rc3-mm3-full/include/net/xfrm.h.old 2005-05-05 21:26:56.000000000 +0200
+++ linux-2.6.12-rc3-mm3-full/include/net/xfrm.h 2005-05-05 21:27:01.000000000 +0200
@@ -799,7 +799,6 @@
extern void xfrm6_fini(void);
extern void xfrm_state_init(void);
extern void xfrm4_state_init(void);
-extern void xfrm4_state_fini(void);
extern void xfrm6_state_init(void);
extern void xfrm6_state_fini(void);
--- linux-2.6.12-rc3-mm3-full/net/ipv4/xfrm4_state.c.old 2005-05-05 21:27:09.000000000 +0200
+++ linux-2.6.12-rc3-mm3-full/net/ipv4/xfrm4_state.c 2005-05-05 21:27:24.000000000 +0200
@@ -119,8 +119,10 @@
xfrm_state_register_afinfo(&xfrm4_state_afinfo);
}
+#if 0
void __exit xfrm4_state_fini(void)
{
xfrm_state_unregister_afinfo(&xfrm4_state_afinfo);
}
+#endif /* 0 */
--- linux-2.6.12-rc3-mm3-full/net/ipv4/fib_frontend.c.old 2005-05-05 21:38:28.000000000 +0200
+++ linux-2.6.12-rc3-mm3-full/net/ipv4/fib_frontend.c 2005-05-05 21:38:40.000000000 +0200
@@ -607,5 +607,4 @@
}
EXPORT_SYMBOL(inet_addr_type);
-EXPORT_SYMBOL(ip_dev_find);
EXPORT_SYMBOL(ip_rt_ioctl);
--- linux-2.6.12-rc3-mm3-full/net/ipv4/inetpeer.c.old 2005-05-05 21:41:06.000000000 +0200
+++ linux-2.6.12-rc3-mm3-full/net/ipv4/inetpeer.c 2005-05-05 21:41:14.000000000 +0200
@@ -456,5 +456,3 @@
peer_total / inet_peer_threshold * HZ;
add_timer(&peer_periodic_timer);
}
-
-EXPORT_SYMBOL(inet_peer_idlock);
--- linux-2.6.12-rc3-mm3-full/net/ipv4/ip_options.c.old 2005-05-05 21:42:02.000000000 +0200
+++ linux-2.6.12-rc3-mm3-full/net/ipv4/ip_options.c 2005-05-05 21:42:33.000000000 +0200
@@ -620,6 +620,3 @@
}
return 0;
}
-
-EXPORT_SYMBOL(ip_options_compile);
-EXPORT_SYMBOL(ip_options_undo);
--- linux-2.6.12-mm1-full/include/net/route.h.old 2005-06-26 12:54:26.000000000 +0200
+++ linux-2.6.12-mm1-full/include/net/route.h 2005-06-26 12:55:00.000000000 +0200
@@ -105,10 +105,6 @@
unsigned int out_hlist_search;
};
-extern struct rt_cache_stat *rt_cache_stat;
-#define RT_CACHE_STAT_INC(field) \
- (per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++)
-
extern struct ip_rt_acct *ip_rt_acct;
struct in_device;
--- linux-2.6.12-mm1-full/net/core/request_sock.c.old 2005-06-26 12:52:03.000000000 +0200
+++ linux-2.6.12-mm1-full/net/core/request_sock.c 2005-06-26 12:52:12.000000000 +0200
@@ -32,7 +32,6 @@
* Further increasing requires to change hash table size.
*/
int sysctl_max_syn_backlog = 256;
-EXPORT_SYMBOL(sysctl_max_syn_backlog);
int reqsk_queue_alloc(struct request_sock_queue *queue,
const int nr_table_entries)
^ permalink raw reply
* Re: [PATCH RFC]: PHY Abstraction Layer III
From: Francois Romieu @ 2005-07-23 21:59 UTC (permalink / raw)
To: Andy Fleming; +Cc: netdev, Embedded PPC Linux list
In-Reply-To: <23F9076F-9FBB-43C8-83CD-F630E694203D@freescale.com>
Andy Fleming <afleming@freescale.com> :
> Here's the latest version of the patch, done against a cogito
> linux-2.6 branch.
The patch includes a diff against drivers/net/phy/phy.c which does not
seem to exist in my -rc3-git4 local tree. Where can it be found ?
--
Ueimor
^ permalink raw reply
* ちょこっと耳ヨリ情報★
From: れいこさんですよ。 @ 2005-07-23 20:02 UTC (permalink / raw)
To: netdev
こんちわw
今日はブログの宣伝にまいりましたよ♪
他ではなかなかみれないおもしろ動画を集めてます☆★
最近はちょっとH系に片寄ってるかな?
お暇だったらぜひ見に来てくらさい♪♪
でわ!!
http://kakusanai.com/hd/?15620190458024546
^ permalink raw reply
* [PATCH 2.6.13rc3] IPv6: Check interface bindings on IPv6 raw socket reception
From: Andrew McDonald @ 2005-07-23 18:04 UTC (permalink / raw)
To: netdev; +Cc: yoshfuji, davem, linux-kernel
Take account of whether a socket is bound to a particular device when
selecting an IPv6 raw socket to receive a packet. Also perform this
check when receiving IPv6 packets with router alert options.
Signed-off-by: Andrew McDonald <andrew@mcdonald.org.uk>
diff -uprN linux-2.6.13-rc3.orig/include/net/rawv6.h linux-2.6.13-rc3/include/net/rawv6.h
--- linux-2.6.13-rc3.orig/include/net/rawv6.h 2004-10-18 22:53:52.000000000 +0100
+++ linux-2.6.13-rc3/include/net/rawv6.h 2005-07-23 13:18:46.000000000 +0100
@@ -10,7 +10,8 @@ extern rwlock_t raw_v6_lock;
extern void ipv6_raw_deliver(struct sk_buff *skb, int nexthdr);
extern struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num,
- struct in6_addr *loc_addr, struct in6_addr *rmt_addr);
+ struct in6_addr *loc_addr, struct in6_addr *rmt_addr,
+ int dif);
extern int rawv6_rcv(struct sock *sk,
struct sk_buff *skb);
diff -uprN linux-2.6.13-rc3.orig/net/ipv6/icmp.c linux-2.6.13-rc3/net/ipv6/icmp.c
--- linux-2.6.13-rc3.orig/net/ipv6/icmp.c 2005-07-23 10:28:47.000000000 +0100
+++ linux-2.6.13-rc3/net/ipv6/icmp.c 2005-07-23 13:23:03.000000000 +0100
@@ -551,7 +551,8 @@ static void icmpv6_notify(struct sk_buff
read_lock(&raw_v6_lock);
if ((sk = sk_head(&raw_v6_htable[hash])) != NULL) {
- while((sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr))) {
+ while((sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr,
+ skb->dev->ifindex))) {
rawv6_err(sk, skb, NULL, type, code, inner_offset, info);
sk = sk_next(sk);
}
diff -uprN linux-2.6.13-rc3.orig/net/ipv6/ip6_output.c linux-2.6.13-rc3/net/ipv6/ip6_output.c
--- linux-2.6.13-rc3.orig/net/ipv6/ip6_output.c 2005-07-23 10:29:40.000000000 +0100
+++ linux-2.6.13-rc3/net/ipv6/ip6_output.c 2005-07-23 12:37:34.000000000 +0100
@@ -321,7 +321,9 @@ static int ip6_call_ra_chain(struct sk_b
read_lock(&ip6_ra_lock);
for (ra = ip6_ra_chain; ra; ra = ra->next) {
struct sock *sk = ra->sk;
- if (sk && ra->sel == sel) {
+ if (sk && ra->sel == sel &&
+ (!sk->sk_bound_dev_if ||
+ sk->sk_bound_dev_if == skb->dev->ifindex)) {
if (last) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
if (skb2)
diff -uprN linux-2.6.13-rc3.orig/net/ipv6/raw.c linux-2.6.13-rc3/net/ipv6/raw.c
--- linux-2.6.13-rc3.orig/net/ipv6/raw.c 2005-07-23 10:29:40.000000000 +0100
+++ linux-2.6.13-rc3/net/ipv6/raw.c 2005-07-23 17:07:58.000000000 +0100
@@ -81,7 +81,8 @@ static void raw_v6_unhash(struct sock *s
/* Grumble... icmp and ip_input want to get at this... */
struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num,
- struct in6_addr *loc_addr, struct in6_addr *rmt_addr)
+ struct in6_addr *loc_addr, struct in6_addr *rmt_addr,
+ int dif)
{
struct hlist_node *node;
int is_multicast = ipv6_addr_is_multicast(loc_addr);
@@ -94,6 +95,9 @@ struct sock *__raw_v6_lookup(struct sock
!ipv6_addr_equal(&np->daddr, rmt_addr))
continue;
+ if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)
+ continue;
+
if (!ipv6_addr_any(&np->rcv_saddr)) {
if (ipv6_addr_equal(&np->rcv_saddr, loc_addr))
goto found;
@@ -160,7 +164,7 @@ void ipv6_raw_deliver(struct sk_buff *sk
if (sk == NULL)
goto out;
- sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr);
+ sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr, skb->dev->ifindex);
while (sk) {
if (nexthdr != IPPROTO_ICMPV6 || !icmpv6_filter(sk, skb)) {
@@ -170,7 +174,8 @@ void ipv6_raw_deliver(struct sk_buff *sk
if (clone)
rawv6_rcv(sk, clone);
}
- sk = __raw_v6_lookup(sk_next(sk), nexthdr, daddr, saddr);
+ sk = __raw_v6_lookup(sk_next(sk), nexthdr, daddr, saddr,
+ skb->dev->ifindex);
}
out:
read_unlock(&raw_v6_lock);
^ permalink raw reply
* Re: [2.6 patch] drivers/net/hamradio/: cleanups
From: Adrian Bunk @ 2005-07-23 17:08 UTC (permalink / raw)
To: Jeff Garzik; +Cc: randy_dunlap, akpm, linux-kernel, netdev
In-Reply-To: <42BF337D.1050904@pobox.com>
On Sun, Jun 26, 2005 at 07:00:13PM -0400, Jeff Garzik wrote:
> randy_dunlap wrote:
> >On Sun, 26 Jun 2005 18:26:49 -0400 Jeff Garzik wrote:
> >
> >| Adrian Bunk wrote:
> >| > This patch contains the following cleanups:
> >| > - dmascc.c: remove the unused global function dmascc_setup
> >|
> >| Better to use it, then remove it.
> >
> > than ??
>
> Yes. Use it via __setup() or similar.
Hi Jeff,
I still haven't gotten any answer from you regarding the following
question:
Can you give me a hint how it should be used?
Why doesn't dmascc_init together with the MODULE_PARM(io,...) work in
the non-modular case?
> Jeff
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply
* Re: [PATCH] reduce netfilte sk_buff enlargement
From: Marcel Holtmann @ 2005-07-23 1:36 UTC (permalink / raw)
To: David S. Miller; +Cc: laforge, netdev, netfilter-devel, wensong
In-Reply-To: <20050722.155411.32722751.davem@davemloft.net>
Hi David,
> > I found the problem. The hci_usb is using the cb[] by itself and so
> > overwriting the pkt_type value. The attached patch works for me with the
> > hci_usb driver. However I haven't converted all other drivers and
> > checked them. This won't happen until I am back home, because I don't
> > have any of these devices with me around. However it looks like this
> > seems to work without any problems.
>
> Great. I'll wait until you get back and code up an updated
> patch that takes care of all of the drivers.
actually the patch is ready by now and hci_usb and hci_vhci are tested.
The tests for the other drivers have to wait at least until first week
of August. However since it seems to work even with 2.6.13-rc3, I don't
see any reason to wait with the inclusion. If you are serious with the
shrinking of the sk_buff, I can send you the final patch along with my
pending patches for 2.6.13.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] reduce netfilte sk_buff enlargement
From: David S. Miller @ 2005-07-22 22:54 UTC (permalink / raw)
To: marcel; +Cc: laforge, netdev, netfilter-devel, wensong
In-Reply-To: <1121991994.5892.15.camel@notepaq>
From: Marcel Holtmann <marcel@holtmann.org>
Date: Fri, 22 Jul 2005 02:26:34 +0200
> I found the problem. The hci_usb is using the cb[] by itself and so
> overwriting the pkt_type value. The attached patch works for me with the
> hci_usb driver. However I haven't converted all other drivers and
> checked them. This won't happen until I am back home, because I don't
> have any of these devices with me around. However it looks like this
> seems to work without any problems.
Great. I'll wait until you get back and code up an updated
patch that takes care of all of the drivers.
Thanks.
^ permalink raw reply
* Re: slow tcp acks on loopback device
From: Steve French @ 2005-07-22 21:42 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, samba-technical, linux-cifs-client
In-Reply-To: <20050722.130816.91445335.davem@davemloft.net>
> TCP_NODELAY does not control ACK generation, instead it modifies
> the Nagle algorithm behavior when sending data packets.
Looks like RHEL4 had an odd default smb.conf on the server side - the
RedHat smb.conf seems to set SO_RCVBUF and SO_SNDBUF to 8K (reducing
them from their default). This seems very odd since common TCP frame
sizes for this protocol (SMB/CIFS) will be just over 16K (the negotiated
SMB buffer size) as well as even large frames, 60K, for large read/write
requests which Windows sends. Removing the SO_SNDBUF, SO_RCVBUF options
(as in the smb.conf for other distros), increased performance a lot.
The Samba Howto recommends against setting them so small as well.
The alternative solution configuring the client end - altering ack
behavior to allow the client to do quick(er) acks probably would have
helped too, but of course has sideeffects (more acks) and it was not
obvious to me how to do that safely from a kernel vfs module.
^ permalink raw reply
* [2.6 patch] drivers/net/ne.c: fix warning with -Wundef
From: Adrian Bunk @ 2005-07-22 21:42 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linux-kernel
This patch fixes the following warning with -Wundef:
<-- snip -->
...
CC drivers/net/ne.o
drivers/net/ne.c:134:7: warning: "CONFIG_PLAT_OAKS32R" is not defined
...
<-- snip -->
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.13-rc3-mm1-full/drivers/net/ne.c.old 2005-07-22 18:24:32.000000000 +0200
+++ linux-2.6.13-rc3-mm1-full/drivers/net/ne.c 2005-07-22 18:24:50.000000000 +0200
@@ -131,7 +131,7 @@
#ifdef CONFIG_PLAT_MAPPI
# define DCR_VAL 0x4b
-#elif CONFIG_PLAT_OAKS32R
+#elif defined(CONFIG_PLAT_OAKS32R)
# define DCR_VAL 0x48
#else
# define DCR_VAL 0x49
^ permalink raw reply
* [-mm patch] include/net/ieee80211.h must #include <linux/wireless.h>
From: Adrian Bunk @ 2005-07-22 21:39 UTC (permalink / raw)
To: jgarzik, jkmaline, hostap; +Cc: netdev, linux-kernel
-Wundef found an (although perhaps harmless) bug:
<-- snip -->
...
CC net/ieee80211/ieee80211_crypt.o
In file included from net/ieee80211/ieee80211_crypt.c:21:
include/net/ieee80211.h:26:5: warning: "WIRELESS_EXT" is not defined
CC net/ieee80211/ieee80211_crypt_wep.o
In file included from net/ieee80211/ieee80211_crypt_wep.c:20:
include/net/ieee80211.h:26:5: warning: "WIRELESS_EXT" is not defined
CC net/ieee80211/ieee80211_crypt_ccmp.o
CC net/ieee80211/ieee80211_crypt_tkip.o
In file included from net/ieee80211/ieee80211_crypt_tkip.c:23:
include/net/ieee80211.h:26:5: warning: "WIRELESS_EXT" is not defined
...
<-- snip -->
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.13-rc3-mm1-full/include/net/ieee80211.h.old 2005-07-22 18:37:57.000000000 +0200
+++ linux-2.6.13-rc3-mm1-full/include/net/ieee80211.h 2005-07-22 18:38:10.000000000 +0200
@@ -22,6 +22,7 @@
#define IEEE80211_H
#include <linux/if_ether.h> /* ETH_ALEN */
#include <linux/kernel.h> /* ARRAY_SIZE */
+#include <linux/wireless.h>
#if WIRELESS_EXT < 17
#define IW_QUAL_QUAL_INVALID 0x10
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox