DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Fixed : ip_pipeline firewall port range filtering
@ 2017-03-19 16:11 Shyam Shrivastav
  2017-03-20  9:34 ` Singh, Jasvinder
  0 siblings, 1 reply; 3+ messages in thread
From: Shyam Shrivastav @ 2017-03-19 16:11 UTC (permalink / raw)
  To: dev; +Cc: Shyam Shrivastav

Found the issue,was debugging acl library while issue was with firewall acl
definition/registration, simple fix makes udp/tcp src/dest based port
filtering work with ip_pipeline firewall. Below is git diff, will submit
patch if members suggest . I am very new here ..

Also I was going through low level acl compilation/classify code, taking
time to understand,if some dev/code doc is there please pass it on.


[root@localhost pipeline]# git diff pipeline_firewall_be.c
diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
b/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
index b61f303..2980492 100644
--- a/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
+++ b/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
@@ -161,7 +161,7 @@ struct firewall_table_entry {
                .type = RTE_ACL_FIELD_TYPE_RANGE,
                .size = sizeof(uint16_t),
                .field_index = 4,
-               .input_index = 4,
+               .input_index = 3,
                .offset = sizeof(struct ether_hdr) +
                        sizeof(struct ipv4_hdr) +
                        offsetof(struct tcp_hdr, dst_port),
@@ -221,7 +221,7 @@ struct firewall_table_entry {
                .type = RTE_ACL_FIELD_TYPE_RANGE,
                .size = sizeof(uint16_t),
                .field_index = 4,
-               .input_index = 4,
+               .input_index = 3,
                .offset = sizeof(struct ether_hdr) +
                        SIZEOF_VLAN_HDR +
                        sizeof(struct ipv4_hdr) +
@@ -282,7 +282,7 @@ struct firewall_table_entry {
                .type = RTE_ACL_FIELD_TYPE_RANGE,
                .size = sizeof(uint16_t),
                .field_index = 4,
-               .input_index = 4,
+               .input_index = 3,
                .offset = sizeof(struct ether_hdr) +
                        SIZEOF_QINQ_HEADER +
                        sizeof(struct ipv4_hdr) +






On Sat, Mar 18, 2017 at 9:58 PM, Shyam Shrivastav <
shrivastav.shyam@gmail.com> wrote:

> I took older versions dpdk-stable-16.07.2 & dpdk-16.04(almost one year
> old), went  through code changes in relevant libraries librte_table(acl
> part only) and librte_acl, looks like no changes to acl compilation and
> matching part since then. Has anyone got specific port filtering working
> with ACLs? Looks like I have to go through ACL compilation/clasify code
> which looks quite difficult :(
>
>
> On Fri, Mar 17, 2017 at 12:31 PM, Shyam Shrivastav <
> shrivastav.shyam@gmail.com> wrote:
>
>> Hi
>>
>> I am trying to just allow tcp dest port 80 packets using ip_pipeline
>> firewall, configured as under
>> ------------------------------------------------------------
>> ------------------------------------------------------------------------
>> pipeline> p 1 firewall add priority 1 ipv4 0.0.0.0 0 0.0.0.0 0 0 65535 80
>> 80 6 0xF port 0
>> pipeline> p 1 firewall ls
>> Prio = 1 (SA = 0.0.0.0/0, DA = 0.0.0.0/0, SP = 0-65535, DP = 80-80,
>> Proto = 6 / 0xf) => Port = 0 (entry ptr = 0x7fddf9f0ff08)
>> Default rule: DROP
>> ------------------------------------------------------------
>> -----------------------------------------------------------------------
>>
>> but it is not working and all tcp packets are getting dropped. If I
>> configure dest port range to be wildcard(0-65535) then tcp packets are
>> allowed
>>
>> ------------------------------------------------------------
>> -----------------------------------------------------------------------
>> pipeline> p 1 firewall add priority 1 ipv4 0.0.0.0 0 0.0.0.0 0 0 65535 0
>> 65535 6 0xF port 0
>> Prio = 1 (SA = 0.0.0.0/0, DA = 0.0.0.0/0, SP = 0-65535, DP = 0-65535,
>> Proto = 6 / 0xf) => Port = 0 (entry ptr = 0x7fddf9f0ff08)
>> pipeline> p 1 firewall ls
>> Prio = 1 (SA = 0.0.0.0/0, DA = 0.0.0.0/0, SP = 0-65535, DP = 0-65535,
>> Proto = 6 / 0xf) => Port = 0 (entry ptr = 0x7fddf9f0ff08)
>> Default rule: DROP
>>
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> --------------
>>
>> Anyone here got specific port filtering work with ip_pipeline firewall?
>> I am debugging this, meanwhile any help/guidance would be greatly
>> appreciated.
>>
>> Thanks and rgds
>>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] Fixed : ip_pipeline firewall port range filtering
  2017-03-19 16:11 [dpdk-dev] Fixed : ip_pipeline firewall port range filtering Shyam Shrivastav
@ 2017-03-20  9:34 ` Singh, Jasvinder
  2017-03-20  9:53   ` Shyam Shrivastav
  0 siblings, 1 reply; 3+ messages in thread
From: Singh, Jasvinder @ 2017-03-20  9:34 UTC (permalink / raw)
  To: Shyam Shrivastav, dev

Hi Shayam,


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shyam Shrivastav
> Sent: Sunday, March 19, 2017 4:11 PM
> To: dev@dpdk.org
> Cc: Shyam Shrivastav <shrivastav.shyam@gmail.com>
> Subject: [dpdk-dev] Fixed : ip_pipeline firewall port range filtering
> 
> Found the issue,was debugging acl library while issue was with firewall acl
> definition/registration, simple fix makes udp/tcp src/dest based port filtering
> work with ip_pipeline firewall. Below is git diff, will submit patch if members
> suggest . I am very new here ..
> 
> Also I was going through low level acl compilation/classify code, taking time
> to understand,if some dev/code doc is there please pass it on.
> 
> 
> [root@localhost pipeline]# git diff pipeline_firewall_be.c diff --git
> a/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
> b/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
> index b61f303..2980492 100644
> --- a/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
> +++ b/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
> @@ -161,7 +161,7 @@ struct firewall_table_entry {
>                 .type = RTE_ACL_FIELD_TYPE_RANGE,
>                 .size = sizeof(uint16_t),
>                 .field_index = 4,
> -               .input_index = 4,
> +               .input_index = 3,
>                 .offset = sizeof(struct ether_hdr) +
>                         sizeof(struct ipv4_hdr) +
>                         offsetof(struct tcp_hdr, dst_port), @@ -221,7 +221,7 @@ struct
> firewall_table_entry {
>                 .type = RTE_ACL_FIELD_TYPE_RANGE,
>                 .size = sizeof(uint16_t),
>                 .field_index = 4,
> -               .input_index = 4,
> +               .input_index = 3,
>                 .offset = sizeof(struct ether_hdr) +
>                         SIZEOF_VLAN_HDR +
>                         sizeof(struct ipv4_hdr) + @@ -282,7 +282,7 @@ struct
> firewall_table_entry {
>                 .type = RTE_ACL_FIELD_TYPE_RANGE,
>                 .size = sizeof(uint16_t),
>                 .field_index = 4,
> -               .input_index = 4,
> +               .input_index = 3,
>                 .offset = sizeof(struct ether_hdr) +
>                         SIZEOF_QINQ_HEADER +
>                         sizeof(struct ipv4_hdr) +


Looks like a bug as all the fields except the first one has to be grouped into sets of 4 consecutive bytes. Therefore, src & dst ports fields should be grouped under input_index =3, Reference -http://dpdk.org/doc/guides/prog_guide/packet_classif_access_ctrl.html

Please send  a patch on this fix on dpdk.org. Guidelines to send patch on dpdk.org are available at http://dpdk.org/doc/guides/contributing/patches.html#sending-patches

Thanks,
Jasvinder

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] Fixed : ip_pipeline firewall port range filtering
  2017-03-20  9:34 ` Singh, Jasvinder
@ 2017-03-20  9:53   ` Shyam Shrivastav
  0 siblings, 0 replies; 3+ messages in thread
From: Shyam Shrivastav @ 2017-03-20  9:53 UTC (permalink / raw)
  To: Singh, Jasvinder; +Cc: dev

Hi Singh
Yes its a bug,input_indx for 2 byte src/dst fields need to point to same
field,I should have examined this layer more minutely before going into
tabl/acl library code. Also looks like no one used/tested tcp/udp port
filtering part of ip_pipeline firewall yet as it will never work without
this fix.
I will submit the patch this week,meanwhile wanted to publish the info if
someone else stuck on this.

Regards, shyam

On Mon, Mar 20, 2017 at 3:04 PM, Singh, Jasvinder <jasvinder.singh@intel.com
> wrote:

> Hi Shayam,
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shyam Shrivastav
> > Sent: Sunday, March 19, 2017 4:11 PM
> > To: dev@dpdk.org
> > Cc: Shyam Shrivastav <shrivastav.shyam@gmail.com>
> > Subject: [dpdk-dev] Fixed : ip_pipeline firewall port range filtering
> >
> > Found the issue,was debugging acl library while issue was with firewall
> acl
> > definition/registration, simple fix makes udp/tcp src/dest based port
> filtering
> > work with ip_pipeline firewall. Below is git diff, will submit patch if
> members
> > suggest . I am very new here ..
> >
> > Also I was going through low level acl compilation/classify code, taking
> time
> > to understand,if some dev/code doc is there please pass it on.
> >
> >
> > [root@localhost pipeline]# git diff pipeline_firewall_be.c diff --git
> > a/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
> > b/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
> > index b61f303..2980492 100644
> > --- a/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
> > +++ b/examples/ip_pipeline/pipeline/pipeline_firewall_be.c
> > @@ -161,7 +161,7 @@ struct firewall_table_entry {
> >                 .type = RTE_ACL_FIELD_TYPE_RANGE,
> >                 .size = sizeof(uint16_t),
> >                 .field_index = 4,
> > -               .input_index = 4,
> > +               .input_index = 3,
> >                 .offset = sizeof(struct ether_hdr) +
> >                         sizeof(struct ipv4_hdr) +
> >                         offsetof(struct tcp_hdr, dst_port), @@ -221,7
> +221,7 @@ struct
> > firewall_table_entry {
> >                 .type = RTE_ACL_FIELD_TYPE_RANGE,
> >                 .size = sizeof(uint16_t),
> >                 .field_index = 4,
> > -               .input_index = 4,
> > +               .input_index = 3,
> >                 .offset = sizeof(struct ether_hdr) +
> >                         SIZEOF_VLAN_HDR +
> >                         sizeof(struct ipv4_hdr) + @@ -282,7 +282,7 @@
> struct
> > firewall_table_entry {
> >                 .type = RTE_ACL_FIELD_TYPE_RANGE,
> >                 .size = sizeof(uint16_t),
> >                 .field_index = 4,
> > -               .input_index = 4,
> > +               .input_index = 3,
> >                 .offset = sizeof(struct ether_hdr) +
> >                         SIZEOF_QINQ_HEADER +
> >                         sizeof(struct ipv4_hdr) +
>
>
> Looks like a bug as all the fields except the first one has to be grouped
> into sets of 4 consecutive bytes. Therefore, src & dst ports fields should
> be grouped under input_index =3, Reference -http://dpdk.org/doc/guides/
> prog_guide/packet_classif_access_ctrl.html
>
> Please send  a patch on this fix on dpdk.org. Guidelines to send patch on
> dpdk.org are available at http://dpdk.org/doc/guides/
> contributing/patches.html#sending-patches
>
> Thanks,
> Jasvinder
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-20  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-19 16:11 [dpdk-dev] Fixed : ip_pipeline firewall port range filtering Shyam Shrivastav
2017-03-20  9:34 ` Singh, Jasvinder
2017-03-20  9:53   ` Shyam Shrivastav

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).