public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
Cc: Martin Doucha <martin.doucha@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] pty04: use the correct protocol per line discipline to avoid extra packets
Date: Fri, 6 Feb 2026 15:39:55 +0100	[thread overview]
Message-ID: <20260206143955.GC402479@pevik> (raw)
In-Reply-To: <20260206125818.319190-3-vasileios.almpanis@virtuozzo.com>

Hi Vasileios,

> Use specific protocol filter (ETH_P_IP for N_SLIP, ETH_P_CAN for N_SLCAN)
> instead of ETH_P_ALL to avoid catching unrelated packets like IPv6
> multicast (MLD) which cause false test failures.

LGTM.
@Martin: could you please double check?

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

> Signed-off-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
> ---
>  testcases/kernel/pty/pty04.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)

> diff --git a/testcases/kernel/pty/pty04.c b/testcases/kernel/pty/pty04.c
> index 204703253..770c053c4 100644
> --- a/testcases/kernel/pty/pty04.c
> +++ b/testcases/kernel/pty/pty04.c
> @@ -258,6 +258,19 @@ static void open_netdev(const struct ldisc_info *ldisc)
>  {
>  	struct ifreq ifreq = { 0 };
>  	struct sockaddr_ll lla = { 0 };
> +	int protocol;
> +
> +	switch (ldisc->n) {
> +		case N_SLIP:
> +			protocol = ETH_P_IP;
> +			break;
> +		case N_SLCAN:
> +			protocol = ETH_P_CAN;
> +			break;
> +		default:
> +			protocol = ETH_P_ALL;
> +			break;
> +	}

>  	SAFE_IOCTL(pts, SIOCGIFNAME, ifreq.ifr_name);
>  	tst_res(TINFO, "Netdev is %s", ifreq.ifr_name);
> @@ -282,7 +295,7 @@ static void open_netdev(const struct ldisc_info *ldisc)
>  	SAFE_IOCTL(sk, SIOCGIFINDEX, &ifreq);

>  	lla.sll_family = PF_PACKET;
> -	lla.sll_protocol = htons(ETH_P_ALL);
> +	lla.sll_protocol = htons(protocol);
>  	lla.sll_ifindex = ifreq.ifr_ifindex;
>  	SAFE_BIND(sk, (struct sockaddr *)&lla, sizeof(struct sockaddr_ll));

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-02-06 14:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 12:51 [LTP] [PATCH 0/2] pty: use correct protocol in pty04 based on line discipline Vasileios Almpanis via ltp
2026-02-06 12:51 ` [LTP] [PATCH 1/2] add ETH_P_CAN compat macro to LAPI headers Vasileios Almpanis via ltp
2026-02-06 14:34   ` Petr Vorel
2026-02-06 12:51 ` [LTP] [PATCH 2/2] pty04: use the correct protocol per line discipline to avoid extra packets Vasileios Almpanis via ltp
2026-02-06 14:39   ` Petr Vorel [this message]
2026-02-11 16:44   ` Martin Doucha
2026-02-06 14:36 ` [LTP] [PATCH 0/2] pty: use correct protocol in pty04 based on line discipline Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260206143955.GC402479@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=martin.doucha@suse.com \
    --cc=vasileios.almpanis@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox