<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/ipv4/ip_options.c, branch v3.2.41</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/net/ipv4/ip_options.c?h=v3.2.41</id>
<link rel='self' href='https://git.amat.us/linux/atom/net/ipv4/ip_options.c?h=v3.2.41'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-03-01T00:31:02Z</updated>
<entry>
<title>ipv4: Fix wrong order of ip_rt_get_source() and update iph-&gt;daddr.</title>
<updated>2012-03-01T00:31:02Z</updated>
<author>
<name>Li Wei</name>
<email>lw@cn.fujitsu.com</email>
</author>
<published>2012-02-09T21:15:25Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=763fe579c154a7bcff5f40788b3b32ada3a1f8db'/>
<id>urn:sha1:763fe579c154a7bcff5f40788b3b32ada3a1f8db</id>
<content type='text'>
[ Upstream commit 5dc7883f2a7c25f8df40d7479687153558cd531b ]

This patch fix a bug which introduced by commit ac8a4810 (ipv4: Save
nexthop address of LSRR/SSRR option to IPCB.).In that patch, we saved
the nexthop of SRR in ip_option-&gt;nexthop and update iph-&gt;daddr until
we get to ip_forward_options(), but we need to update it before
ip_rt_get_source(), otherwise we may get a wrong src.

Signed-off-by: Li Wei &lt;lw@cn.fujitsu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ipv4: Save nexthop address of LSRR/SSRR option to IPCB.</title>
<updated>2011-11-24T00:19:32Z</updated>
<author>
<name>Li Wei</name>
<email>lw@cn.fujitsu.com</email>
</author>
<published>2011-11-22T23:33:10Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ac8a48106be49c422575ddc7531b776f8eb49610'/>
<id>urn:sha1:ac8a48106be49c422575ddc7531b776f8eb49610</id>
<content type='text'>
We can not update iph-&gt;daddr in ip_options_rcv_srr(), It is too early.
When some exception ocurred later (eg. in ip_forward() when goto
sr_failed) we need the ip header be identical to the original one as
ICMP need it.

Add a field 'nexthop' in struct ip_options to save nexthop of LSRR
or SSRR option.

Signed-off-by: Li Wei &lt;lw@cn.fujitsu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv4: fix for ip_options_rcv_srr() daddr update.</title>
<updated>2011-11-09T20:59:00Z</updated>
<author>
<name>Li Wei</name>
<email>lw@cn.fujitsu.com</email>
</author>
<published>2011-11-08T21:39:28Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b12f62efb8ec0b9523bdb6c2d412c07193086de9'/>
<id>urn:sha1:b12f62efb8ec0b9523bdb6c2d412c07193086de9</id>
<content type='text'>
When opt-&gt;srr_is_hit is set skb_rtable(skb) has been updated for
'nexthop' and iph-&gt;daddr should always equals to skb_rtable-&gt;rt_dst
holds, We need update iph-&gt;daddr either.

Signed-off-by: Li Wei &lt;lw@cn.fujitsu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ip_options_compile: properly handle unaligned pointer</title>
<updated>2011-05-31T22:11:02Z</updated>
<author>
<name>Chris Metcalf</name>
<email>cmetcalf@tilera.com</email>
</author>
<published>2011-05-29T10:55:44Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=48bdf072c3f1f8f739f76d19c74f4c79605cac46'/>
<id>urn:sha1:48bdf072c3f1f8f739f76d19c74f4c79605cac46</id>
<content type='text'>
The current code takes an unaligned pointer and does htonl() on it to
make it big-endian, then does a memcpy().  The problem is that the
compiler decides that since the pointer is to a __be32, it is legal
to optimize the copy into a processor word store.  However, on an
architecture that does not handled unaligned writes in kernel space,
this produces an unaligned exception fault.

The solution is to track the pointer as a "char *" (which removes a bunch
of unpleasant casts in any case), and then just use put_unaligned_be32()
to write the value to memory.

Signed-off-by: Chris Metcalf &lt;cmetcalf@tilera.com&gt;
Signed-off-by: David S. Miller &lt;davem@zippy.davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv4: Remove rt-&gt;rt_dst reference from ip_forward_options().</title>
<updated>2011-05-13T21:31:02Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2011-05-13T21:31:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7be799a70ba3dd90a59e8d2c72bbe06020005b3f'/>
<id>urn:sha1:7be799a70ba3dd90a59e8d2c72bbe06020005b3f</id>
<content type='text'>
At this point iph-&gt;daddr equals what rt-&gt;rt_dst would hold.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv4: Remove route key identity dependencies in ip_rt_get_source().</title>
<updated>2011-05-13T21:29:41Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2011-05-13T21:29:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8e36360ae876995e92d3a7538dda70548e64e685'/>
<id>urn:sha1:8e36360ae876995e92d3a7538dda70548e64e685</id>
<content type='text'>
Pass in the sk_buff so that we can fetch the necessary keys from
the packet header when working with input routes.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv4: Kill spurious write to iph-&gt;daddr in ip_forward_options().</title>
<updated>2011-05-13T21:15:50Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2011-05-13T21:15:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0374d9ceb02eb12fcd65be9dd5df9c911ef93424'/>
<id>urn:sha1:0374d9ceb02eb12fcd65be9dd5df9c911ef93424</id>
<content type='text'>
This code block executes when opt-&gt;srr_is_hit is set.  It will be
set only by ip_options_rcv_srr().

ip_options_rcv_srr() walks until it hits a matching nexthop in the SRR
option addresses, and when it matches one 1) looks up the route for
that nexthop and 2) on route lookup success it writes that nexthop
value into iph-&gt;daddr.

ip_forward_options() runs later, and again walks the SRR option
addresses looking for the option matching the destination of the route
stored in skb_rtable().  This route will be the same exact one looked
up for the nexthop by ip_options_rcv_srr().

Therefore "rt-&gt;rt_dst == iph-&gt;daddr" must be true.

All it really needs to do is record the route's source address in the
matching SRR option adddress.  It need not write iph-&gt;daddr again,
since that has already been done by ip_options_rcv_srr() as detailed
above.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv4: Simplify iph-&gt;daddr overwrite in ip_options_rcv_srr().</title>
<updated>2011-05-12T23:30:58Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2011-05-12T23:30:58Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c30883bdff0b3544900a5c4aba18b8985436878f'/>
<id>urn:sha1:c30883bdff0b3544900a5c4aba18b8985436878f</id>
<content type='text'>
We already copy the 4-byte nexthop from the options block into
local variable "nexthop" for the route lookup.

Re-use that variable instead of memcpy()'ing again when assigning
to iph-&gt;daddr after the route lookup succeeds.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ipv4: Kill spurious opt-&gt;srr check in ip_options_rcv_srr().</title>
<updated>2011-05-12T23:26:57Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2011-05-12T23:26:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=10949550bd1e50cc91c0f5085f7080a44b0871fe'/>
<id>urn:sha1:10949550bd1e50cc91c0f5085f7080a44b0871fe</id>
<content type='text'>
All call sites conditionalize the call to ip_options_rcv_srr()
with a check of opt-&gt;srr, so no need to check it again there.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>inet: add RCU protection to inet-&gt;opt</title>
<updated>2011-04-28T20:16:35Z</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2011-04-21T09:45:37Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f6d8bd051c391c1c0458a30b2a7abcd939329259'/>
<id>urn:sha1:f6d8bd051c391c1c0458a30b2a7abcd939329259</id>
<content type='text'>
We lack proper synchronization to manipulate inet-&gt;opt ip_options

Problem is ip_make_skb() calls ip_setup_cork() and
ip_setup_cork() possibly makes a copy of ipc-&gt;opt (struct ip_options),
without any protection against another thread manipulating inet-&gt;opt.

Another thread can change inet-&gt;opt pointer and free old one under us.

Use RCU to protect inet-&gt;opt (changed to inet-&gt;inet_opt).

Instead of handling atomic refcounts, just copy ip_options when
necessary, to avoid cache line dirtying.

We cant insert an rcu_head in struct ip_options since its included in
skb-&gt;cb[], so this patch is large because I had to introduce a new
ip_options_rcu structure.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
