* [LTP] [PATCH 0/2] pty: use correct protocol in pty04 based on line discipline
@ 2026-02-06 12:51 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
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Vasileios Almpanis via ltp @ 2026-02-06 12:51 UTC (permalink / raw)
To: ltp
Hi,
during testing of the LTP pty test pty04, we observed intermittent
failures caused by unexpected IPv6 packets being received.
The test currently filters packets using ETH_P_ALL. As a result,
packets with protocols other than the expected one (e.g. IPv6) may be
received, leading to data corruption reports such as:
TFAIL: Corrupt data (max 64 of 8191 bytes shown): data[0..64] =
TFAIL: 60 00 00 00 00 24 00 01 00 00 00 00 00 00 00 00
TFAIL: 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00
TFAIL: 00 00 00 00 00 00 00 16 3a 00 05 02 00 00 01 00
TFAIL: 8f 00 6e 8a 00 00 00 01 04 00 00 00 ff 02 00 00
This patch series addresses the issue by selecting the protocol based
on the configured line discipline.
Patch 1 adds a compatibility definition for ETH_P_CAN to the LAPI
headers. Patch 2 updates pty04 to choose the appropriate protocol,
avoiding reception of unrelated packets.
Signed-off-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
Vasileios Almpanis (2):
add ETH_P_CAN compat macro to LAPI headers
pty04: use the correct protocol per line discipline to avoid extra
packets
include/lapi/if_ether.h | 4 ++++
testcases/kernel/pty/pty04.c | 15 ++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH 1/2] add ETH_P_CAN compat macro to LAPI headers
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 ` 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:36 ` [LTP] [PATCH 0/2] pty: use correct protocol in pty04 based on line discipline Petr Vorel
2 siblings, 1 reply; 7+ messages in thread
From: Vasileios Almpanis via ltp @ 2026-02-06 12:51 UTC (permalink / raw)
To: ltp
Signed-off-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
---
include/lapi/if_ether.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/lapi/if_ether.h b/include/lapi/if_ether.h
index 536d1863a..423341c57 100644
--- a/include/lapi/if_ether.h
+++ b/include/lapi/if_ether.h
@@ -16,4 +16,8 @@
# define ETH_P_ALL 0x0003
#endif
+#ifndef ETH_P_CAN
+# define ETH_P_CAN 0x000C
+#endif
+
#endif /* LAPI_IF_ETHER_H__ */
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH 2/2] pty04: use the correct protocol per line discipline to avoid extra packets
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 12:51 ` Vasileios Almpanis via ltp
2026-02-06 14:39 ` Petr Vorel
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
2 siblings, 2 replies; 7+ messages in thread
From: Vasileios Almpanis via ltp @ 2026-02-06 12:51 UTC (permalink / raw)
To: ltp
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.
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));
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 1/2] add ETH_P_CAN compat macro to LAPI headers
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
0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2026-02-06 14:34 UTC (permalink / raw)
To: Vasileios Almpanis; +Cc: ltp
Hi Vasileios,
> include/lapi/if_ether.h | 4 ++++
> 1 file changed, 4 insertions(+)
> diff --git a/include/lapi/if_ether.h b/include/lapi/if_ether.h
> index 536d1863a..423341c57 100644
> --- a/include/lapi/if_ether.h
> +++ b/include/lapi/if_ether.h
> @@ -16,4 +16,8 @@
> # define ETH_P_ALL 0x0003
> #endif
> +#ifndef ETH_P_CAN
> +# define ETH_P_CAN 0x000C
> +#endif
This is not needed, because it was added to kernel's
include/uapi/linux/if_ether.h before UAPI creation in v3.7-rc1.
And we now expect kernel >= 4.4 [1].
FYI the fallback was originally added in 2017 in
db141701dd ("Add test for CVE-2017-7308 on a raw socket's ring buffer"),
the supported systems required it back then, but now whole include/lapi/if_ether.h,
could be deleted (as an separate effort). For now it'd be enough just to ignore
this commit (not add it).
Kind regards,
Petr
[1] https://linux-test-project.readthedocs.io/en/latest/users/supported_systems.html
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 0/2] pty: use correct protocol in pty04 based on line discipline
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 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:36 ` Petr Vorel
2 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2026-02-06 14:36 UTC (permalink / raw)
To: Vasileios Almpanis; +Cc: ltp
Hi Vasileios,
> Hi,
> during testing of the LTP pty test pty04, we observed intermittent
> failures caused by unexpected IPv6 packets being received.
> The test currently filters packets using ETH_P_ALL. As a result,
> packets with protocols other than the expected one (e.g. IPv6) may be
> received, leading to data corruption reports such as:
> TFAIL: Corrupt data (max 64 of 8191 bytes shown): data[0..64] =
> TFAIL: 60 00 00 00 00 24 00 01 00 00 00 00 00 00 00 00
> TFAIL: 00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00
> TFAIL: 00 00 00 00 00 00 00 16 3a 00 05 02 00 00 01 00
> TFAIL: 8f 00 6e 8a 00 00 00 01 04 00 00 00 ff 02 00 00
nit: IMHO useful info, it'd be nice to have it in the commit itself (otherwise
it will be lost). But no need to repost.
Kind regards,
Petr
> This patch series addresses the issue by selecting the protocol based
> on the configured line discipline.
> Patch 1 adds a compatibility definition for ETH_P_CAN to the LAPI
> headers. Patch 2 updates pty04 to choose the appropriate protocol,
> avoiding reception of unrelated packets.
> Signed-off-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
> Vasileios Almpanis (2):
> add ETH_P_CAN compat macro to LAPI headers
> pty04: use the correct protocol per line discipline to avoid extra
> packets
> include/lapi/if_ether.h | 4 ++++
> testcases/kernel/pty/pty04.c | 15 ++++++++++++++-
> 2 files changed, 18 insertions(+), 1 deletion(-)
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] pty04: use the correct protocol per line discipline to avoid extra packets
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
2026-02-11 16:44 ` Martin Doucha
1 sibling, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2026-02-06 14:39 UTC (permalink / raw)
To: Vasileios Almpanis; +Cc: Martin Doucha, ltp
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] pty04: use the correct protocol per line discipline to avoid extra packets
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
@ 2026-02-11 16:44 ` Martin Doucha
1 sibling, 0 replies; 7+ messages in thread
From: Martin Doucha @ 2026-02-11 16:44 UTC (permalink / raw)
To: Vasileios Almpanis, ltp
Hi!
Good catch, but it'd be cleaner to add a "protocol" field to the
ldisc_info structure instead of selecting protocol in a switch block.
On 2/6/26 13:51, Vasileios Almpanis via ltp wrote:
> 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.
>
> 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));
>
--
Martin Doucha mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-02-11 16:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox