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>
This commit is contained in:

committed by
Stefano Brivio

parent
67afaab411
commit
716a926ef4
11
util.h
11
util.h
@@ -102,18 +102,11 @@ int do_clone(int (*fn)(void *), char *stack_area, size_t stack_size, int flags,
|
||||
(void *)(arg)); \
|
||||
} while (0)
|
||||
|
||||
#define L2_BUF_ETH_IP4_INIT \
|
||||
#define L2_BUF_ETH_INIT(proto) \
|
||||
{ \
|
||||
.h_dest = { 0 }, \
|
||||
.h_source = { 0 }, \
|
||||
.h_proto = htons_constant(ETH_P_IP), \
|
||||
}
|
||||
|
||||
#define L2_BUF_ETH_IP6_INIT \
|
||||
{ \
|
||||
.h_dest = { 0 }, \
|
||||
.h_source = { 0 }, \
|
||||
.h_proto = htons_constant(ETH_P_IPV6), \
|
||||
.h_proto = htons_constant(proto), \
|
||||
}
|
||||
|
||||
#define L2_BUF_IP4_INIT(proto) \
|
||||
|
Reference in New Issue
Block a user