Skip to content

Commit 4987c7b

Browse files
Lukasz Majewskijukkar
authored andcommitted
test: af_packet: Do not change proto to network order when creating socket
The setup_socket() function calls socket() with proto changed to network order. In this case functions with zsock_* prefix are called instead of zpacket_*. The problem is with 'packet_is_supported()' method from sockets_packet.c, which returns false when ETH_P_ALL proto is converted with htons(). This patch fixes this issue by removing the htons() call. Signed-off-by: Lukasz Majewski <[email protected]> Suggested-by: Jukka Rissanen <[email protected]>
1 parent 6e7a2ec commit 4987c7b

File tree

1 file changed

+1
-1
lines changed
  • tests/net/socket/af_packet/src

1 file changed

+1
-1
lines changed

tests/net/socket/af_packet/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int setup_socket(struct net_if *iface, int type, int proto)
9595
{
9696
int sock;
9797

98-
sock = socket(AF_PACKET, type, htons(proto));
98+
sock = socket(AF_PACKET, type, proto);
9999
zassert_true(sock >= 0, "Cannot create packet socket (%d)", -errno);
100100

101101
return sock;

0 commit comments

Comments
 (0)