netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Nambiar, Amritha" <amritha.nambiar@intel.com>
Cc: David Ahern <dsahern@gmail.com>,
	netdev@vger.kernel.org, jakub.kicinski@netronome.com,
	sridhar.samudrala@intel.com, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us
Subject: Re: [iproute2-next PATCH v4] tc: flower: Classify packets based port ranges
Date: Mon, 26 Nov 2018 20:02:54 -0800	[thread overview]
Message-ID: <20181126200254.0a213bbd@xeon-e3> (raw)
In-Reply-To: <5ff60af4-ddc9-848a-234d-6ca43f22af18@intel.com>

On Mon, 26 Nov 2018 17:56:10 -0800
"Nambiar, Amritha" <amritha.nambiar@intel.com> wrote:

> On 11/26/2018 4:43 PM, David Ahern wrote:
> > On 11/26/18 5:23 PM, Nambiar, Amritha wrote:  
> >>> Can tc flower use something similar to ip ru with single port or port
> >>> range handled like this?
> >>>
> >>>     },{
> >>>         "priority": 32764,
> >>>         "src": "172.16.1.0",
> >>>         "srclen": 24,
> >>>         "ipproto": "tcp",
> >>>         "sport": 1100,
> >>>         "table": "main"
> >>>     },{
> >>>         "priority": 32765,
> >>>         "src": "172.16.1.0",
> >>>         "srclen": 24,
> >>>         "ipproto": "tcp",
> >>>         "sport_start": 1000,
> >>>         "sport_end": 1010,
> >>>         "table": "main"
> >>>     },{
> >>>
> >>>  
> >>
> >> Does it have to be separate fields "sport_start" and "sport_end"?
> >> Removing the space and 'range' keyword will make the output format
> >> consistent with the input format and print as "sport <number>" for
> >> single port and "sport <start>-<end>" for range.
> >> Example:
> >>
> >> ... flower ip_proto tcp src_port 12 skip_hw action will print as:
> >>   ip_proto tcp
> >>   src_port 12
> >>   skip_hw
> >>   not_in_hw
> >>         action
> >>
> >> ... flower ip_proto tcp src_port 100-200 skip_hw action :
> >>   ip_proto tcp
> >>   src_port 100-200
> >>   skip_hw
> >>   not_in_hw
> >>         action  
> > 
> > non-json output needs to match what the user gives on the command line.
> > 
> > My comment was about consistency with json output when possible. I am
> > not a json expert by any means. Other commands have a single key value
> > pair, so I suspect the json here needs to follow suit (ie., not
> > "src_port": "1000-1010" but separate start and end entries).
> >   
> I'm not quite familiar with json. Maybe, Jiri can give feedback here.

JSON support strings and numeric and objects.
The more common JSON way of expressing this would be either as object for sport

{
       "priority": 32765,
       "src": "172.16.1.0",
        "srclen": 24,
       "ipproto": "tcp",
	"sport" : {
		"start" : 1000,
		"end" : 1010
	},
	"table: "main"
}

or as an array:
{
       "priority": 32765,
       "src": "172.16.1.0",
        "srclen": 24,
       "ipproto": "tcp",
	"sport" : [ 1000, 1010 ],
	"table: "main"
}

My point is don't build some semantic meaning directly into the tag part of the syntax.

  reply	other threads:[~2018-11-27 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21  6:17 [iproute2-next PATCH v4] tc: flower: Classify packets based port ranges Amritha Nambiar
2018-11-21 21:42 ` David Ahern
2018-11-27  0:23   ` Nambiar, Amritha
2018-11-27  0:43     ` David Ahern
2018-11-27  1:56       ` Nambiar, Amritha
2018-11-27  4:02         ` Stephen Hemminger [this message]
2018-11-27 21:47           ` Nambiar, Amritha

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=20181126200254.0a213bbd@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=amritha.nambiar@intel.com \
    --cc=dsahern@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=sridhar.samudrala@intel.com \
    --cc=xiyou.wangcong@gmail.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 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).