From: Ben Hutchings <bhutchings@solarflare.com>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: "Timo Teräs" <timo.teras@iki.fi>, netdev@vger.kernel.org
Subject: Re: [PATCH] iproute2: support xfrm upper protocol gre key
Date: Tue, 23 Nov 2010 22:26:47 +0000 [thread overview]
Message-ID: <1290551207.3013.9.camel@localhost> (raw)
In-Reply-To: <20101123101302.54a9e4be@nehalam>
On Tue, 2010-11-23 at 10:13 -0800, Stephen Hemminger wrote:
> 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.
inet_aton() covers that.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
prev parent reply other threads:[~2010-11-23 22:26 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
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 ` Ben Hutchings [this message]
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=1290551207.3013.9.camel@localhost \
--to=bhutchings@solarflare.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.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).