Skip to content

Commit 065fcfd

Browse files
Thadeu Lima de Souza Cascardodavem330
authored andcommitted
selftests: net: ip_defrag: ignore EPERM
When running with conntrack rules, the dropped overlap fragments may cause EPERM to be returned to sendto. Instead of completely failing, just ignore those errors and continue. If this causes packets with overlap fragments to be dropped as expected, that is okay. And if it causes packets that are expected to be received to be dropped, which should not happen, it will be detected as failure. Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e8224bf commit 065fcfd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/testing/selftests/net/ip_defrag.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ static void send_fragment(int fd_raw, struct sockaddr *addr, socklen_t alen,
192192
}
193193

194194
res = sendto(fd_raw, ip_frame, frag_len, 0, addr, alen);
195-
if (res < 0)
195+
if (res < 0 && errno != EPERM)
196196
error(1, errno, "send_fragment");
197-
if (res != frag_len)
197+
if (res >= 0 && res != frag_len)
198198
error(1, 0, "send_fragment: %d vs %d", res, frag_len);
199199

200200
frag_counter++;
@@ -313,9 +313,9 @@ static void send_udp_frags(int fd_raw, struct sockaddr *addr,
313313
iphdr->ip_len = htons(frag_len);
314314
}
315315
res = sendto(fd_raw, ip_frame, frag_len, 0, addr, alen);
316-
if (res < 0)
316+
if (res < 0 && errno != EPERM)
317317
error(1, errno, "sendto overlap: %d", frag_len);
318-
if (res != frag_len)
318+
if (res >= 0 && res != frag_len)
319319
error(1, 0, "sendto overlap: %d vs %d", (int)res, frag_len);
320320
frag_counter++;
321321
}

0 commit comments

Comments
 (0)