Bug 239 - ipsec-secgw fails to initialize when librte_ipsec is enabled
Summary: ipsec-secgw fails to initialize when librte_ipsec is enabled
Status: CONFIRMED
Alias: None
Product: DPDK
Classification: Unclassified
Component: examples (show other bugs)
Version: unspecified
Hardware: All Linux
: Normal normal
Target Milestone: ---
Assignee: Lukasz Bartosik
URL:
Depends on:
Blocks:
 
Reported: 2019-04-05 10:46 CEST by Lukasz Bartosik
Modified: 2020-09-17 09:31 CEST (History)
2 users (show)



Attachments
ipsec_secgw_failure_log.txt (9.83 KB, text/plain)
2019-04-05 10:46 CEST, Lukasz Bartosik
Details
ipsec-secgw.patch (4.26 KB, application/mbox)
2019-04-07 18:46 CEST, Lukasz Bartosik
Details

Description Lukasz Bartosik 2019-04-05 10:46:41 CEST
Created attachment 33 [details]
ipsec_secgw_failure_log.txt

repo http://dpdk.org/git/next/dpdk-next-crypto
branch master
commit 3331ddc doc: update ipsec lib for supported algos

Ipsec-secgw example fails to initialize when librte_ipsec is enabled and when default configuration of ep0.cfg is used.

It complains that two SP rules use the same SPI

./ipsec-secgw --log-level=8 -c 0xff -- -P -p 0x3 -u 0x1 --config "(1,0,0),(0,0,0)" -f ../ep0.cfg -l

IPSEC: get_spi_proto: SPI 110 used simultaeously by IPv4(2) and IPv6 (2) SP rules
EAL: Error - exiting with code: 1
  Cause: failed to init inbound SAs

Ipsec-secgw initializes successfully when used without librte_ipsec.
Full log is attached.
Comment 1 Konstantin Ananyev 2019-04-05 15:39:17 CEST
Yep indeed, with '-l' flag ipsec-secgw doesn't allow SA which match both IPv4 and IPv6 headers.
I think 2 possibilities to fix it:
1. just update config file in examples to change spi for affected entries
(quick fix, though probably not the best one).
2. make changes into ipsec-secgw to split SA table into 2 -
based on internal IP header version: one for IPv4, another for IPv6.
Comment 2 Lukasz Bartosik 2019-04-07 18:46:02 CEST
Created attachment 34 [details]
ipsec-secgw.patch
Comment 3 Lukasz Bartosik 2019-04-07 18:50:25 CEST
Hi Konstantin,

1. Do you think that ep0.cfg configuration is not valid because if it is allowed by RFC to use the same SA by two different SPs then in my opinion ipsec-secgw should not alter this behaviour.

I also attach my local changes which I made to be able to proceed with ep0.cfg.
Does it make sense to you ?

Thanks,
Lukasz
Comment 4 Konstantin Ananyev 2019-04-08 13:32:36 CEST
Hi Lukasz,

> it is allowed by RFC to use the same SA by two different SPs
AFAIK there is no no place in RFCs (at least I couldn't find it)
that either directly prohibits it or says that each compliant implementation
have to support such configuration.
From other side looking at SPD selector fields that should be PFP-allowable and/or inherited bt SAD entries, I don't see how support such config (multiple SPD rules refer the same SA) can be done in a generic and perfomant way.
About the ipsec-secgw app and related patch - I think we can allow both ipv4 and ipv6 SPD rule to reference the same SPI, but I think in that case there should be 2 different SAs created with the same SPI (one for IPv4, antoehr for IPv6). For that we need to split common SA table in ipsec-secgw into 2: one for IPv4, another for IPv6.
Comment 5 Lukasz Bartosik 2019-04-09 17:55:56 CEST
Hi Konstantin,

> About the ipsec-secgw app and related patch - I think we can allow both ipv4
> and ipv6 SPD rule to reference the same SPI, but I think in that case there
> should be 2 different SAs created with the same SPI (one for IPv4, antoehr
> for IPv6). For that we need to split common SA table in ipsec-secgw into 2:
> one for IPv4, another for IPv6.

Would you please elaborate why you think there is a need to split SA table 
in two tables (for IPv4 and IPv6) ? Is this a need based on a new features yet to come ? I ask because currently ipsec-secgw supports only manual configuration of SPs & SAs and I'm not seeing advantages of such a split.

Thanks,
Lukasz
Comment 6 Konstantin Ananyev 2019-04-10 18:58:31 CEST
Hi Lukasz,

>Is this a need based on a new features yet to come ? 

Mainly yes, if (/when) we'll have the proper SAD, I think it would be the most
natural way to implement it.
Comment 7 Konstantin Ananyev 2019-04-10 19:00:48 CEST
Again current librte_ipsec expects such division already - same SA not supposed to handle both IPv4 and IPv6 packets.
Comment 8 Ajit Khaparde 2020-09-16 23:45:01 CEST
Lukasz, Do you agree with Konstantin's assessment? Do you have any further concerns? Thanks
Comment 9 Lukasz Bartosik 2020-09-17 09:31:27 CEST
Hi Ajit,

I'm ok with the assessment. I don't have any concerns.

Thanks,
Lukasz

Note You need to log in before you can comment on or make changes to this bug.