Skip to content

Commit a5f0f83

Browse files
Vasileios Almpanispevik
authored andcommitted
pty04: use the correct protocol per line discipline to avoid extra packets
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. Link: https://lore.kernel.org/ltp/20260228222227.779444-1-vasileios.almpanis@virtuozzo.com/ Reviewed-by: Martin Doucha <mdoucha@suse.cz> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
1 parent f630471 commit a5f0f83

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

testcases/kernel/pty/pty04.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ struct ldisc_info {
8484
int n;
8585
char *name;
8686
int mtu;
87+
int protocol;
8788
};
8889

8990
static struct ldisc_info ldiscs[] = {
90-
{N_SLIP, "N_SLIP", 8192},
91-
{N_SLCAN, "N_SLCAN", CAN_MTU},
91+
{N_SLIP, "N_SLIP", 8192, ETH_P_IP},
92+
{N_SLCAN, "N_SLCAN", CAN_MTU, ETH_P_CAN},
9293
};
9394

9495
static int ptmx = -1, pts = -1, sk = -1, mtu, no_check;
@@ -282,7 +283,7 @@ static void open_netdev(const struct ldisc_info *ldisc)
282283
SAFE_IOCTL(sk, SIOCGIFINDEX, &ifreq);
283284

284285
lla.sll_family = PF_PACKET;
285-
lla.sll_protocol = htons(ETH_P_ALL);
286+
lla.sll_protocol = htons(ldisc->protocol);
286287
lla.sll_ifindex = ifreq.ifr_ifindex;
287288
SAFE_BIND(sk, (struct sockaddr *)&lla, sizeof(struct sockaddr_ll));
288289

0 commit comments

Comments
 (0)