[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZitcE8dJnwLi5bYx@Antony2201.local>
Date: Fri, 26 Apr 2024 09:47:31 +0200
From: Antony Antony <antony@...nome.org>
To: Sabrina Dubroca <sd@...asysnail.net>
Cc: Antony Antony <antony.antony@...unet.com>,
Steffen Klassert <steffen.klassert@...unet.com>,
Herbert Xu <herbert@...dor.apana.org.au>, netdev@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
devel@...ux-ipsec.org, Leon Romanovsky <leon@...nel.org>,
Eyal Birger <eyal.birger@...il.com>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>
Subject: Re: [PATCH ipsec-next v12 1/4] xfrm: Add Direction to the SA in or
out
On Wed, Apr 24, 2024 at 11:38:08AM +0200, Sabrina Dubroca via Devel wrote:
> 2024-04-23, 14:49:17 +0200, Antony Antony wrote:
> > diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> > index 0c306473a79d..c8c5fc47c431 100644
> > --- a/net/xfrm/xfrm_state.c
> > +++ b/net/xfrm/xfrm_state.c
> > @@ -1292,6 +1292,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
> > if (km_query(x, tmpl, pol) == 0) {
> > spin_lock_bh(&net->xfrm.xfrm_state_lock);
> > x->km.state = XFRM_STATE_ACQ;
> > + x->dir = XFRM_SA_DIR_OUT;
>
> Would that make updates fail if userspace isn't setting SA_DIR
> afterwards?
Not in typical, operation of IKE daemons. I haven't update acquire state.
I don't think iproute2 supports that.
UPDSA is called for input where there is no acquire; acquire is for output.
For output SA, added using NEWSA, will find the output acquire and delete it
if p->seq matches. It won't update.
May be some other userspace update acquire? I extend the code to accomodate
this possible case, in v13.
> > diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
> > index 810b520493f3..d34ac467a219 100644
> > --- a/net/xfrm/xfrm_user.c
> > +++ b/net/xfrm/xfrm_user.c
> [...]
> > @@ -176,6 +200,7 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
> > struct netlink_ext_ack *extack)
> > {
> > int err;
> > + u8 sa_dir = attrs[XFRMA_SA_DIR] ? nla_get_u8(attrs[XFRMA_SA_DIR]) : 0;
>
> nit: extra ' ' after '?', only one is needed.
fixed.
> > @@ -358,6 +383,64 @@ static int verify_newsa_info(struct
> > xfrm_usersa_info *p,
> > err = -EINVAL;
> > goto out;
> > }
> > +
> > + if (sa_dir == XFRM_SA_DIR_OUT) {
> > + NL_SET_ERR_MSG(extack,
> > + "MTIMER_THRESH attribute should not be set on output SA");
> > + err = -EINVAL;
> > + goto out;
> > + }
> > + }
> > +
> > + if (sa_dir == XFRM_SA_DIR_OUT) {
> > + if (p->flags & XFRM_STATE_DECAP_DSCP) {
> > + NL_SET_ERR_MSG(extack, "Flag NDECAP_DSCP should not be set for output SA");
>
> That typo in the error string is still here (extra N in flag name).
sorry.Fixed. I will send v13 soon.
-antony
Powered by blists - more mailing lists