lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2zfmhiqk2.fsf@chopps.org>
Date: Sat, 02 Nov 2024 15:44:25 +0000
From: Christian Hopps <chopps@...pps.org>
To: Steffen Klassert <steffen.klassert@...unet.com>
Cc: Christian Hopps <chopps@...pps.org>, devel@...ux-ipsec.org,
 netdev@...r.kernel.org, Florian Westphal <fw@...len.de>, Sabrina Dubroca
 <sd@...asysnail.net>, Simon Horman <horms@...nel.org>, Antony Antony
 <antony@...nome.org>, Christian Hopps <chopps@...n.net>
Subject: Re: [PATCH ipsec-next v12 08/16] xfrm: iptfs: add user packet
 (tunnel ingress) handling


Steffen Klassert <steffen.klassert@...unet.com> writes:

> On Mon, Oct 07, 2024 at 09:59:20AM -0400, Christian Hopps wrote:
>> From: Christian Hopps <chopps@...n.net>
>> @@ -77,8 +609,11 @@ static int iptfs_user_init(struct net *net, struct xfrm_state *x,
>>  {
>>  	struct xfrm_iptfs_data *xtfs = x->mode_data;
>>  	struct xfrm_iptfs_config *xc;
>> +	u64 q;
>>
>>  	xc = &xtfs->cfg;
>> +	xc->max_queue_size = IPTFS_DEFAULT_MAX_QUEUE_SIZE;
>> +	xtfs->init_delay_ns = IPTFS_DEFAULT_INIT_DELAY_USECS * NSECS_IN_USEC;
>>
>>  	if (attrs[XFRMA_IPTFS_PKT_SIZE]) {
>>  		xc->pkt_size = nla_get_u32(attrs[XFRMA_IPTFS_PKT_SIZE]);
>> @@ -92,6 +627,17 @@ static int iptfs_user_init(struct net *net, struct xfrm_state *x,
>>  			return -EINVAL;
>>  		}
>>  	}
>> +	if (attrs[XFRMA_IPTFS_MAX_QSIZE])
>> +		xc->max_queue_size = nla_get_u32(attrs[XFRMA_IPTFS_MAX_QSIZE]);
>> +	if (attrs[XFRMA_IPTFS_INIT_DELAY])
>> +		xtfs->init_delay_ns =
>> +			(u64)nla_get_u32(attrs[XFRMA_IPTFS_INIT_DELAY]) *
>> +			NSECS_IN_USEC;
>> +
>> +	q = (u64)xc->max_queue_size * 95;
>> +	(void)do_div(q, 100);
>
> This cast is not need.

Removed.

FWIW, the cast was to document the ignoring of the returned remainder value; however, this is outside the normal linux kernel coding style.

>> +	xtfs->ecn_queue_size = (u32)q;
>> +
>>  	return 0;
>>  }
>>
>> @@ -101,8 +647,11 @@ static unsigned int iptfs_sa_len(const struct xfrm_state *x)
>>  	struct xfrm_iptfs_config *xc = &xtfs->cfg;
>>  	unsigned int l = 0;
>>
>> -	if (x->dir == XFRM_SA_DIR_OUT)
>> +	if (x->dir == XFRM_SA_DIR_OUT) {
>> +		l += nla_total_size(sizeof(u32)); /* init delay usec */
>> +		l += nla_total_size(sizeof(xc->max_queue_size));
>>  		l += nla_total_size(sizeof(xc->pkt_size));
>> +	}
>>
>>  	return l;
>>  }
>> @@ -112,9 +661,22 @@ static int iptfs_copy_to_user(struct xfrm_state *x, struct sk_buff *skb)
>>  	struct xfrm_iptfs_data *xtfs = x->mode_data;
>>  	struct xfrm_iptfs_config *xc = &xtfs->cfg;
>>  	int ret = 0;
>> +	u64 q;
>> +
>> +	if (x->dir == XFRM_SA_DIR_OUT) {
>> +		q = xtfs->init_delay_ns;
>> +		(void)do_div(q, NSECS_IN_USEC);
>
> Same here.

Removed.

Download attachment "signature.asc" of type "application/pgp-signature" (858 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ