aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-01-06 11:43:14 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-01-23 18:54:46 +0100
commit716a926ef485602d3e5aafd93ed5893d1eca39b6 (patch)
treeb9f94ac8839d7c5ff182f91f50130f8fdce304aa /tcp.c
parent67afaab411001d777c4af6b016c7c045ef4d8ed5 (diff)
downloadpasst-716a926ef485602d3e5aafd93ed5893d1eca39b6.tar
passt-716a926ef485602d3e5aafd93ed5893d1eca39b6.tar.gz
passt-716a926ef485602d3e5aafd93ed5893d1eca39b6.tar.bz2
passt-716a926ef485602d3e5aafd93ed5893d1eca39b6.tar.lz
passt-716a926ef485602d3e5aafd93ed5893d1eca39b6.tar.xz
passt-716a926ef485602d3e5aafd93ed5893d1eca39b6.tar.zst
passt-716a926ef485602d3e5aafd93ed5893d1eca39b6.zip
util: Parameterize ethernet header initializer macro
We have separate IPv4 and IPv6 versions of a macro to construct an initializer for ethernet headers. However, now that we have htons_constant it's easy to simply paramterize this with the ethernet protocol number. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tcp.c b/tcp.c
index ee3c6e5..ccb5895 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1059,7 +1059,7 @@ static void tcp_sock4_iov_init(void)
for (i = 0; i < ARRAY_SIZE(tcp4_l2_buf); i++) {
tcp4_l2_buf[i] = (struct tcp4_l2_buf_t) {
- .eh = L2_BUF_ETH_IP4_INIT,
+ .eh = L2_BUF_ETH_INIT(ETH_P_IP),
.iph = L2_BUF_IP4_INIT(IPPROTO_TCP),
.th = { .doff = sizeof(struct tcphdr) / 4, .ack = 1 }
};
@@ -1067,7 +1067,7 @@ static void tcp_sock4_iov_init(void)
for (i = 0; i < ARRAY_SIZE(tcp4_l2_flags_buf); i++) {
tcp4_l2_flags_buf[i] = (struct tcp4_l2_flags_buf_t) {
- .eh = L2_BUF_ETH_IP4_INIT,
+ .eh = L2_BUF_ETH_INIT(ETH_P_IP),
.iph = L2_BUF_IP4_INIT(IPPROTO_TCP)
};
}
@@ -1091,7 +1091,7 @@ static void tcp_sock6_iov_init(void)
for (i = 0; i < ARRAY_SIZE(tcp6_l2_buf); i++) {
tcp6_l2_buf[i] = (struct tcp6_l2_buf_t) {
- .eh = L2_BUF_ETH_IP6_INIT,
+ .eh = L2_BUF_ETH_INIT(ETH_P_IPV6),
.ip6h = L2_BUF_IP6_INIT(IPPROTO_TCP),
.th = { .doff = sizeof(struct tcphdr) / 4, .ack = 1 }
};
@@ -1099,7 +1099,7 @@ static void tcp_sock6_iov_init(void)
for (i = 0; i < ARRAY_SIZE(tcp6_l2_flags_buf); i++) {
tcp6_l2_flags_buf[i] = (struct tcp6_l2_flags_buf_t) {
- .eh = L2_BUF_ETH_IP6_INIT,
+ .eh = L2_BUF_ETH_INIT(ETH_P_IPV6),
.ip6h = L2_BUF_IP6_INIT(IPPROTO_TCP)
};
}