All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: David Miller <davem@davemloft.net>
Cc: pabeni@redhat.com, netdev@vger.kernel.org, edumazet@google.com,
	kuznet@ms2.inr.ac.ru
Subject: Re: [RFC PATCH] IP: do not modify ingress packet IP option in ip_options_echo()
Date: Fri, 28 Jul 2017 16:47:42 -0400	[thread overview]
Message-ID: <87a83othjl.fsf@stressinduktion.org> (raw)
In-Reply-To: <20170724.141253.769254590231937263.davem@davemloft.net> (David Miller's message of "Mon, 24 Jul 2017 14:12:53 -0700 (PDT)")

Hello,

David Miller <davem@davemloft.net> writes:

> From: Paolo Abeni <pabeni@redhat.com>
> Date: Fri, 21 Jul 2017 15:55:18 +0200
>
>> diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
>> index 93157f2..fdda973 100644
>> --- a/net/ipv4/ip_options.c
>> +++ b/net/ipv4/ip_options.c
>> @@ -174,9 +174,6 @@ int __ip_options_echo(struct ip_options *dopt, struct sk_buff *skb,
>>  				doffset -= 4;
>>  		}
>>  		if (doffset > 3) {
>> -			__be32 daddr = fib_compute_spec_dst(skb);
>> -
>> -			memcpy(&start[doffset-1], &daddr, 4);
>>  			dopt->faddr = faddr;
>
> This transformation is required, but in the destination not the source.

We put a lot of effort trying to figure out why this code is needed,
what intend it has and couldn't still figure out why things are how they
are.

Above, I think you are referring to the update in the options header
that directs the packet to the final hosts, such closing the loop and
allowing the packet to reach its final destination.

This update to the header happens in another function, later in the
stack in ip_options_build:

|	if (opt->srr)
|		memcpy(iph+opt->srr+iph[opt->srr+1]-4, &daddr, 4);

Here we correctly copy the destination address into the last option
field.

> The red flag is that we are indexing 'start' with 'doffset' instead of
> 'soffset'.

As Paolo pointed out, we should not put our own source address into the
options array.

Do you have any idea why this code was added in the first place? I read
through 2.0.33 code and even in context of this version, I couldn't
figure that out.

Because it seems the code and update is dead anyways (besides
incorrectly updating the ICMP reflected payload) I don't see any problem
with removing this code. Do you?

Thanks,
Hannes

  parent reply	other threads:[~2017-07-28 20:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-21 13:55 [RFC PATCH] IP: do not modify ingress packet IP option in ip_options_echo() Paolo Abeni
2017-07-24 21:12 ` David Miller
2017-07-25 15:26   ` Paolo Abeni
2017-07-28 20:47   ` Hannes Frederic Sowa [this message]
2017-08-07  3:49     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a83othjl.fsf@stressinduktion.org \
    --to=hannes@stressinduktion.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.