From: Stephen Hemminger <shemminger@linux-foundation.org>
To: "Timo Teräs" <timo.teras@iki.fi>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] iproute2: support xfrm upper protocol gre key
Date: Tue, 23 Nov 2010 10:13:02 -0800 [thread overview]
Message-ID: <20101123101302.54a9e4be@nehalam> (raw)
In-Reply-To: <4CEBEF7C.2060806@iki.fi>
On Tue, 23 Nov 2010 18:44:44 +0200
Timo Teräs <timo.teras@iki.fi> wrote:
> On 11/23/2010 06:24 PM, Stephen Hemminger wrote:
> > On Tue, 23 Nov 2010 17:02:39 +0200
> > Timo Teräs <timo.teras@iki.fi> wrote:
> >
> >> + case IPPROTO_GRE:
> >> + if (sel->sport_mask || sel->dport_mask) {
> >> + struct in_addr key;
> >> + key.s_addr = htonl((ntohs(sel->sport) << 16) + ntohs(sel->dport));
> >> + inet_ntop(AF_INET, &key, abuf, sizeof(abuf));
> >> + fprintf(fp, "key %s ", abuf);
> >> + }
> >
> > The GRE key is not really an IPv4 address. Why should the utilities
> > use IPv4 address manipulation to format/scan it. It makes more sense
> > to me to just use u32 an do the necessary ntohl.
>
> This is pretty much how iptunnel.c does it, so I copied the code. Would
> you prefer to format it as single u32 number? Or use something else for
> formatting it similar to IPv4?
>
> In either case, we should change iptunnel.c to match ipxfrm.c. It'll be
> easier if both parts handling the gre key treat it equivalently.
>
> I think Cisco does indeed treat it as u32 number in the configurations.
> So I'm okay updating this patch, and fixing iptunnel.c side too. We
> might still want to keep the parsing of ipv4 format to keep backwards
> compatibility.
My preference would be to take both dotted quad and a single
number.
--
next prev parent reply other threads:[~2010-11-23 18:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 15:02 [PATCH] iproute2: support xfrm upper protocol gre key Timo Teräs
2010-11-23 16:24 ` Stephen Hemminger
2010-11-23 16:44 ` Timo Teräs
2010-11-23 18:13 ` Stephen Hemminger [this message]
2010-11-23 18:38 ` Timo Teräs
2010-11-23 18:54 ` Stephen Hemminger
2010-11-24 8:18 ` [PATCH 1/2] iproute2: treat gre key as number Timo Teräs
2010-11-24 8:18 ` [PATCH 2/2] iproute2: support xfrm upper protocol gre key Timo Teräs
2010-11-30 17:55 ` Stephen Hemminger
2010-11-23 22:26 ` [PATCH] " Ben Hutchings
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=20101123101302.54a9e4be@nehalam \
--to=shemminger@linux-foundation.org \
--cc=netdev@vger.kernel.org \
--cc=timo.teras@iki.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).