Re: [nft PATCH v4 11/32] netlink_delinearize: correct length of right bitwise operand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022-05-23, at 19:22:02 +0200, Pablo Neira Ayuso wrote:
> On Mon, Apr 04, 2022 at 01:13:49PM +0100, Jeremy Sowden wrote:
> > Set it to match the length of the left operand.
> >
> > Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx>
> > ---
> >  src/netlink_delinearize.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
> > index 8b010fe4d168..cf5359bf269e 100644
> > --- a/src/netlink_delinearize.c
> > +++ b/src/netlink_delinearize.c
> > @@ -2613,6 +2613,7 @@ static void expr_postprocess(struct rule_pp_ctx *ctx, struct expr **exprp)
> >  				      BYTEORDER_HOST_ENDIAN);
> >  			break;
> >  		default:
> > +			expr->right->len = expr->left->len;
>
> This seems to be required for EXPR_BINOP (exclusing left/right shift)
>
> I am assuming here expr->right is the value of the bitmask.
>
> Was expr->right->len unset?

Hmm.  I can't now remember what purpose this served.  I spent a lot of
time staring at the delinearization code for binops and payloads while
debugging this series, and it is possible that I just spotted that under
some circumstances the length of the right hand operand after delinea-
rization wasn't right or didn't match what it did after evaluation, and
made this change for correctness.  However, reverting it doesn't seem to
break anything, so I'm happy to drop it.

> >  			expr_set_type(expr->right, expr->left->dtype,
> >  				      expr->left->byteorder);
> >  		}
> > --
> > 2.35.1
> >
>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux