netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 08:24:04 -0800	[thread overview]
Message-ID: <20101123082404.5b8ad019@nehalam> (raw)
In-Reply-To: <1290524559-22086-1-git-send-email-timo.teras@iki.fi>

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.


-- 

  reply	other threads:[~2010-11-23 16:24 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 [this message]
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       ` [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=20101123082404.5b8ad019@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).