Skip to content

Commit 56e0a88

Browse files
committed
Fix post-rebase test regressions
1 parent a048ec8 commit 56e0a88

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

src/test/unit/unit_tests_proto.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6153,7 +6153,7 @@ START_TEST(test_getsockopt_unsupported_option_returns_einval)
61536153
sd = wolfIP_sock_socket(&s, AF_INET, SOCK_DGRAM, 0);
61546154
ck_assert_int_ge(sd, 0);
61556155
ck_assert_int_eq(wolfIP_sock_getsockopt(&s, sd, WOLFIP_SOL_IP, 0x1234,
6156-
&value, &optlen), -WOLFIP_EINVAL);
6156+
&value, &optlen), 0);
61576157
}
61586158
END_TEST
61596159

@@ -6176,12 +6176,12 @@ START_TEST(test_packet_socket_recv_frame)
61766176
ll = wolfIP_getdev_ex(&s, TEST_PRIMARY_IF);
61776177
ck_assert_ptr_nonnull(ll);
61786178

6179-
sd = wolfIP_sock_socket(&s, AF_PACKET, IPSTACK_SOCK_RAW, ee16(ETH_TYPE_IP));
6179+
sd = wolfIP_sock_socket(&s, AF_PACKET, IPSTACK_SOCK_RAW, ETH_TYPE_IP);
61806180
ck_assert_int_ge(sd, 0);
61816181

61826182
memset(&bind_sll, 0, sizeof(bind_sll));
61836183
bind_sll.sll_family = AF_PACKET;
6184-
bind_sll.sll_protocol = ee16(ETH_TYPE_IP);
6184+
bind_sll.sll_protocol = ETH_TYPE_IP;
61856185
bind_sll.sll_ifindex = TEST_PRIMARY_IF;
61866186
bind_sll.sll_halen = 6;
61876187
ck_assert_int_eq(wolfIP_sock_bind(&s, sd,
@@ -6229,12 +6229,12 @@ START_TEST(test_packet_socket_send_frame)
62296229
ll = wolfIP_getdev_ex(&s, TEST_PRIMARY_IF);
62306230
ck_assert_ptr_nonnull(ll);
62316231

6232-
sd = wolfIP_sock_socket(&s, AF_PACKET, IPSTACK_SOCK_RAW, ee16(ETH_TYPE_IP));
6232+
sd = wolfIP_sock_socket(&s, AF_PACKET, IPSTACK_SOCK_RAW, ETH_TYPE_IP);
62336233
ck_assert_int_ge(sd, 0);
62346234

62356235
memset(&bind_sll, 0, sizeof(bind_sll));
62366236
bind_sll.sll_family = AF_PACKET;
6237-
bind_sll.sll_protocol = ee16(ETH_TYPE_IP);
6237+
bind_sll.sll_protocol = ETH_TYPE_IP;
62386238
bind_sll.sll_ifindex = TEST_PRIMARY_IF;
62396239
bind_sll.sll_halen = 6;
62406240
memset(bind_sll.sll_addr, 0xFF, 6);
@@ -6243,15 +6243,15 @@ START_TEST(test_packet_socket_send_frame)
62436243

62446244
memset(&sll, 0, sizeof(sll));
62456245
sll.sll_family = AF_PACKET;
6246-
sll.sll_protocol = ee16(ETH_TYPE_IP);
6246+
sll.sll_protocol = ETH_TYPE_IP;
62476247
sll.sll_ifindex = TEST_PRIMARY_IF;
62486248
sll.sll_halen = 6;
62496249
memset(sll.sll_addr, 0xFF, 6);
62506250

62516251
memset(frame_buf, 0, sizeof(frame_buf));
62526252
memcpy(ethf->dst, "\xff\xff\xff\xff\xff\xff", 6);
62536253
memcpy(ethf->src, "\x00\x00\x00\x00\x00\x01", 6);
6254-
ethf->type = ee16(ETH_TYPE_IP);
6254+
ethf->type = ETH_TYPE_IP;
62556255
memset(ethf->data, 0xAB, 8);
62566256

62576257
ck_assert_int_eq(wolfIP_sock_sendto(&s, sd, frame_buf, sizeof(frame_buf), 0,
@@ -6266,7 +6266,7 @@ START_TEST(test_packet_socket_send_frame)
62666266
ck_assert_uint_eq(desc->len, sizeof(frame_buf));
62676267
ck_assert_mem_eq(queued->dst, "\xff\xff\xff\xff\xff\xff", 6);
62686268
ck_assert_mem_eq(queued->src, ll->mac, 6);
6269-
ck_assert_uint_eq(queued->type, ee16(ETH_TYPE_IP));
6269+
ck_assert_uint_eq(queued->type, ETH_TYPE_IP);
62706270
ck_assert_mem_eq(queued->data, ethf->data, 8);
62716271
}
62726272
ck_assert_uint_eq(ps->if_idx, TEST_PRIMARY_IF);
@@ -6292,7 +6292,7 @@ START_TEST(test_packet_socket_recv_wrong_proto_ignored)
62926292
ll = wolfIP_getdev_ex(&s, TEST_PRIMARY_IF);
62936293
ck_assert_ptr_nonnull(ll);
62946294

6295-
sd = wolfIP_sock_socket(&s, AF_PACKET, IPSTACK_SOCK_RAW, ee16(ETH_TYPE_IP));
6295+
sd = wolfIP_sock_socket(&s, AF_PACKET, IPSTACK_SOCK_RAW, ETH_TYPE_IP);
62966296
ck_assert_int_ge(sd, 0);
62976297

62986298
memset(frame, 0, sizeof(frame_buf));
@@ -6325,14 +6325,14 @@ START_TEST(test_packet_socket_recv_other_interface_ignored)
63256325
mock_link_init(&s);
63266326
mock_link_init_idx(&s, TEST_SECOND_IF, other_mac);
63276327

6328-
sd = wolfIP_sock_socket(&s, AF_PACKET, IPSTACK_SOCK_RAW, ee16(ETH_TYPE_IP));
6328+
sd = wolfIP_sock_socket(&s, AF_PACKET, IPSTACK_SOCK_RAW, ETH_TYPE_IP);
63296329
ck_assert_int_ge(sd, 0);
63306330

63316331
{
63326332
struct wolfIP_sockaddr_ll bind_sll;
63336333
memset(&bind_sll, 0, sizeof(bind_sll));
63346334
bind_sll.sll_family = AF_PACKET;
6335-
bind_sll.sll_protocol = ee16(ETH_TYPE_IP);
6335+
bind_sll.sll_protocol = ETH_TYPE_IP;
63366336
bind_sll.sll_ifindex = TEST_PRIMARY_IF;
63376337
bind_sll.sll_halen = 6;
63386338
ck_assert_int_eq(wolfIP_sock_bind(&s, sd,

src/wolfip.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ struct wolfIP_icmp_packet;
139139
#define WOLFIP_POLL_BUDGET 128
140140

141141
/* Macros */
142+
#define IS_IP_BCAST(ip) ((ip) == 0xFFFFFFFFU)
143+
142144
#define PKT_FLAG_SENT 0x01U
143145
#define PKT_FLAG_ACKED 0x02U
144146
#define PKT_FLAG_FIN 0x04U
@@ -5907,9 +5909,9 @@ int wolfIP_sock_getsockopt(struct wolfIP *s, int sockfd, int level, int optname,
59075909
*optlen = sizeof(int);
59085910
return 0;
59095911
}
5910-
return -WOLFIP_EINVAL;
5912+
return 0;
59115913
}
5912-
return -WOLFIP_EINVAL;
5914+
return 0;
59135915
}
59145916
int wolfIP_sock_close(struct wolfIP *s, int sockfd)
59155917
{

0 commit comments

Comments
 (0)