fix DPDK/LWIP redifintion

This commit is contained in:
Christian Giese
2022-11-02 17:52:51 +01:00
committed by Christian Giese
parent 8e0e00baa9
commit 840fbbb2a4
10 changed files with 40 additions and 40 deletions
+14 -14
View File
@@ -363,7 +363,7 @@ ip6_select_source_address(struct netif *netif, const ip6_addr_t *dest)
* @param inp the netif on which this packet was received
*/
static void
ip6_forward(struct pbuf *p, struct ip6_hdr *iphdr, struct netif *inp)
ip6_forward(struct pbuf *p, struct lwip_ip6_hdr *iphdr, struct netif *inp)
{
struct netif *netif;
@@ -508,7 +508,7 @@ ip6_input_accept(struct netif *netif)
err_t
ip6_input(struct pbuf *p, struct netif *inp)
{
struct ip6_hdr *ip6hdr;
struct lwip_ip6_hdr *ip6hdr;
struct netif *netif;
const u8_t *nexth;
u16_t hlen, hlen_tot; /* the current header length */
@@ -525,7 +525,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
IP6_STATS_INC(ip6.recv);
/* identify the IP header */
ip6hdr = (struct ip6_hdr *)p->payload;
ip6hdr = (struct lwip_ip6_hdr *)p->payload;
if (IP6H_V(ip6hdr) != 6) {
LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_WARNING, ("IPv6 packet dropped due to bad version number %"U32_F"\n",
IP6H_V(ip6hdr)));
@@ -1013,7 +1013,7 @@ netif_found:
/* Returned p point to IPv6 header.
* Update all our variables and pointers and continue. */
ip6hdr = (struct ip6_hdr *)p->payload;
ip6hdr = (struct lwip_ip6_hdr *)p->payload;
nexth = &IP6H_NEXTH(ip6hdr);
hlen = hlen_tot = IP6_HLEN;
pbuf_remove_header(p, IP6_HLEN);
@@ -1174,7 +1174,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc,
u8_t nexth, struct netif *netif)
{
struct ip6_hdr *ip6hdr;
struct lwip_ip6_hdr *ip6hdr;
ip6_addr_t dest_addr;
LWIP_ASSERT_CORE_LOCKED();
@@ -1203,9 +1203,9 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
return ERR_BUF;
}
ip6hdr = (struct ip6_hdr *)p->payload;
LWIP_ASSERT("check that first pbuf can hold struct ip6_hdr",
(p->len >= sizeof(struct ip6_hdr)));
ip6hdr = (struct lwip_ip6_hdr *)p->payload;
LWIP_ASSERT("check that first pbuf can hold struct lwip_ip6_hdr",
(p->len >= sizeof(struct lwip_ip6_hdr)));
IP6H_HOPLIM_SET(ip6hdr, hl);
IP6H_NEXTH_SET(ip6hdr, nexth);
@@ -1224,7 +1224,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
} else {
/* IP header already included in p */
ip6hdr = (struct ip6_hdr *)p->payload;
ip6hdr = (struct lwip_ip6_hdr *)p->payload;
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
ip6_addr_assign_zone(&dest_addr, IP6_UNKNOWN, netif);
dest = &dest_addr;
@@ -1292,7 +1292,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc, u8_t nexth)
{
struct netif *netif;
struct ip6_hdr *ip6hdr;
struct lwip_ip6_hdr *ip6hdr;
ip6_addr_t src_addr, dest_addr;
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
@@ -1301,7 +1301,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
netif = ip6_route(src, dest);
} else {
/* IP header included in p, read addresses. */
ip6hdr = (struct ip6_hdr *)p->payload;
ip6hdr = (struct lwip_ip6_hdr *)p->payload;
ip6_addr_copy_from_packed(src_addr, ip6hdr->src);
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
netif = ip6_route(&src_addr, &dest_addr);
@@ -1351,7 +1351,7 @@ ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc, u8_t nexth, struct netif_hint *netif_hint)
{
struct netif *netif;
struct ip6_hdr *ip6hdr;
struct lwip_ip6_hdr *ip6hdr;
ip6_addr_t src_addr, dest_addr;
err_t err;
@@ -1361,7 +1361,7 @@ ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
netif = ip6_route(src, dest);
} else {
/* IP header included in p, read addresses. */
ip6hdr = (struct ip6_hdr *)p->payload;
ip6hdr = (struct lwip_ip6_hdr *)p->payload;
ip6_addr_copy_from_packed(src_addr, ip6hdr->src);
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
netif = ip6_route(&src_addr, &dest_addr);
@@ -1452,7 +1452,7 @@ ip6_options_add_hbh_ra(struct pbuf *p, u8_t nexth, u8_t value)
void
ip6_debug_print(struct pbuf *p)
{
struct ip6_hdr *ip6hdr = (struct ip6_hdr *)p->payload;
struct lwip_ip6_hdr *ip6hdr = (struct lwip_ip6_hdr *)p->payload;
LWIP_DEBUGF(IP6_DEBUG, ("IPv6 header:\n"));
LWIP_DEBUGF(IP6_DEBUG, ("+-------------------------------+\n"));
+7 -7
View File
@@ -551,7 +551,7 @@ ip6_reass(struct pbuf *p)
if (valid) {
/* All fragments have been received */
struct ip6_hdr* iphdr_ptr;
struct lwip_ip6_hdr* iphdr_ptr;
/* chain together the pbufs contained within the ip6_reassdata list. */
iprh = (struct ip6_reass_helper*) ipr->p->payload;
@@ -610,7 +610,7 @@ ip6_reass(struct pbuf *p)
(size_t)((u8_t*)p->payload - (u8_t*)ipr->iphdr));
/* This is where the IPv6 header is now. */
iphdr_ptr = (struct ip6_hdr*)((u8_t*)ipr->iphdr +
iphdr_ptr = (struct lwip_ip6_hdr*)((u8_t*)ipr->iphdr +
sizeof(struct ip6_frag_hdr));
/* Adjust datagram length by adding header lengths. */
@@ -719,8 +719,8 @@ ip6_frag_free_pbuf_custom(struct pbuf *p)
err_t
ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
{
struct ip6_hdr *original_ip6hdr;
struct ip6_hdr *ip6hdr;
struct lwip_ip6_hdr *original_ip6hdr;
struct lwip_ip6_hdr *ip6hdr;
struct ip6_frag_hdr *frag_hdr;
struct pbuf *rambuf;
#if !LWIP_NETIF_TX_SINGLE_PBUF
@@ -738,7 +738,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
identification++;
original_ip6hdr = (struct ip6_hdr *)p->payload;
original_ip6hdr = (struct lwip_ip6_hdr *)p->payload;
/* @todo we assume there are no options in the unfragmentable part (IPv6 header). */
LWIP_ASSERT("p->tot_len >= IP6_HLEN", p->tot_len >= IP6_HLEN);
@@ -767,7 +767,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
}
/* fill in the IP header */
SMEMCPY(rambuf->payload, original_ip6hdr, IP6_HLEN);
ip6hdr = (struct ip6_hdr *)rambuf->payload;
ip6hdr = (struct lwip_ip6_hdr *)rambuf->payload;
frag_hdr = (struct ip6_frag_hdr *)((u8_t*)rambuf->payload + IP6_HLEN);
#else
/* When not using a static buffer, create a chain of pbufs.
@@ -783,7 +783,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
LWIP_ASSERT("this needs a pbuf in one piece!",
(rambuf->len >= (IP6_HLEN)));
SMEMCPY(rambuf->payload, original_ip6hdr, IP6_HLEN);
ip6hdr = (struct ip6_hdr *)rambuf->payload;
ip6hdr = (struct lwip_ip6_hdr *)rambuf->payload;
frag_hdr = (struct ip6_frag_hdr *)((u8_t*)rambuf->payload + IP6_HLEN);
/* Can just adjust p directly for needed offset. */
+5 -5
View File
@@ -910,7 +910,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
case ICMP6_TYPE_PTB: /* Packet too big */
{
struct icmp6_hdr *icmp6hdr; /* Packet too big message */
struct ip6_hdr *ip6hdr; /* IPv6 header of the packet which caused the error */
struct lwip_ip6_hdr *ip6hdr; /* IPv6 header of the packet which caused the error */
u32_t pmtu;
ip6_addr_t destination_address;
@@ -924,7 +924,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
}
icmp6hdr = (struct icmp6_hdr *)p->payload;
ip6hdr = (struct ip6_hdr *)((u8_t*)p->payload + sizeof(struct icmp6_hdr));
ip6hdr = (struct lwip_ip6_hdr *)((u8_t*)p->payload + sizeof(struct icmp6_hdr));
/* Create an aligned, zoned copy of the destination address. */
ip6_addr_copy_from_packed(destination_address, ip6hdr->dest);
@@ -2212,7 +2212,7 @@ nd6_free_q(struct nd6_q_entry *q)
static void
nd6_send_q(s8_t i)
{
struct ip6_hdr *ip6hdr;
struct lwip_ip6_hdr *ip6hdr;
ip6_addr_t dest;
#if LWIP_ND6_QUEUEING
struct nd6_q_entry *q;
@@ -2229,7 +2229,7 @@ nd6_send_q(s8_t i)
/* pop first item off the queue */
neighbor_cache[i].q = q->next;
/* Get ipv6 header. */
ip6hdr = (struct ip6_hdr *)(q->p->payload);
ip6hdr = (struct lwip_ip6_hdr *)(q->p->payload);
/* Create an aligned copy. */
ip6_addr_copy_from_packed(dest, ip6hdr->dest);
/* Restore the zone, if applicable. */
@@ -2245,7 +2245,7 @@ nd6_send_q(s8_t i)
#else /* LWIP_ND6_QUEUEING */
if (neighbor_cache[i].q != NULL) {
/* Get ipv6 header. */
ip6hdr = (struct ip6_hdr *)(neighbor_cache[i].q->payload);
ip6hdr = (struct lwip_ip6_hdr *)(neighbor_cache[i].q->payload);
/* Create an aligned copy. */
ip6_addr_copy_from_packed(dest, ip6hdr->dest);
/* Restore the zone, if applicable. */
+1 -1
View File
@@ -146,7 +146,7 @@ raw_input(struct pbuf *p, struct netif *inp)
if (IP_HDR_GET_VERSION(p->payload) == 6)
#endif /* LWIP_IPV4 */
{
struct ip6_hdr *ip6hdr = (struct ip6_hdr *)p->payload;
struct lwip_ip6_hdr *ip6hdr = (struct lwip_ip6_hdr *)p->payload;
proto = IP6H_NEXTH(ip6hdr);
}
#if LWIP_IPV4
+3 -3
View File
@@ -116,7 +116,7 @@ struct ip_globals
#endif /* LWIP_IPV4 */
#if LWIP_IPV6
/** Header of the input IPv6 packet currently being processed. */
struct ip6_hdr *current_ip6_header;
struct lwip_ip6_hdr *current_ip6_header;
#endif /* LWIP_IPV6 */
/** Total header length of current_ip4/6_header (i.e. after this, the UDP/TCP header starts) */
u16_t current_ip_header_tot_len;
@@ -152,7 +152,7 @@ extern struct ip_globals ip_data;
/** Get the IPv6 header of the current packet.
* This function must only be called from a receive callback (udp_recv,
* raw_recv, tcp_accept). It will return NULL otherwise. */
#define ip6_current_header() ((const struct ip6_hdr*)(ip_data.current_ip6_header))
#define ip6_current_header() ((const struct lwip_ip6_hdr*)(ip_data.current_ip6_header))
/** Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4 */
#define ip_current_is_v6() (ip6_current_header() != NULL)
/** Source IPv6 address of current_header */
@@ -194,7 +194,7 @@ extern struct ip_globals ip_data;
/** Get the IPv6 header of the current packet.
* This function must only be called from a receive callback (udp_recv,
* raw_recv, tcp_accept). It will return NULL otherwise. */
#define ip6_current_header() ((const struct ip6_hdr*)(ip_data.current_ip6_header))
#define ip6_current_header() ((const struct lwip_ip6_hdr*)(ip_data.current_ip6_header))
/** Always returns TRUE when only supporting IPv6 only */
#define ip_current_is_v6() 1
/** Get the transport layer protocol */
+1 -1
View File
@@ -90,7 +90,7 @@ extern "C" {
struct ip6_reassdata {
struct ip6_reassdata *next;
struct pbuf *p;
struct ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */
struct lwip_ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */
#if IPV6_FRAG_COPYHEADER
ip6_addr_p_t src; /* copy of the source address in the IP header */
ip6_addr_p_t dest; /* copy of the destination address in the IP header */
+1 -1
View File
@@ -79,7 +79,7 @@ typedef struct ip6_addr_packed ip6_addr_p_t;
# include "arch/bpstruct.h"
#endif
PACK_STRUCT_BEGIN
struct ip6_hdr {
struct lwip_ip6_hdr {
/** version / traffic class / flow label */
PACK_STRUCT_FIELD(u32_t _v_tc_fl);
/** payload length */
+2 -2
View File
@@ -571,12 +571,12 @@ lowpan6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr)
struct lowpan6_link_addr src, dest;
#if LWIP_6LOWPAN_INFER_SHORT_ADDRESS
ip6_addr_t ip6_src;
struct ip6_hdr *ip6_hdr;
struct lwip_ip6_hdr *ip6_hdr;
#endif /* LWIP_6LOWPAN_INFER_SHORT_ADDRESS */
#if LWIP_6LOWPAN_INFER_SHORT_ADDRESS
/* Check if we can compress source address (use aligned copy) */
ip6_hdr = (struct ip6_hdr *)q->payload;
ip6_hdr = (struct lwip_ip6_hdr *)q->payload;
ip6_addr_copy_from_packed(ip6_src, ip6_hdr->src);
ip6_addr_assign_zone(&ip6_src, IP6_UNICAST, netif);
if (lowpan6_get_address_mode(&ip6_src, &short_mac_addr) == 3) {
+4 -4
View File
@@ -137,7 +137,7 @@ lowpan6_compress_headers(struct netif *netif, u8_t *inbuf, size_t inbuf_size, u8
u8_t lowpan6_header_len;
u8_t hidden_header_len = 0;
s8_t i;
struct ip6_hdr *ip6hdr;
struct lwip_ip6_hdr *ip6hdr;
ip_addr_t ip6src, ip6dst;
LWIP_ASSERT("netif != NULL", netif != NULL);
@@ -160,7 +160,7 @@ lowpan6_compress_headers(struct netif *netif, u8_t *inbuf, size_t inbuf_size, u8
}
/* Point to ip6 header and align copies of src/dest addresses. */
ip6hdr = (struct ip6_hdr *)inptr;
ip6hdr = (struct lwip_ip6_hdr *)inptr;
ip_addr_copy_from_ip6_packed(ip6dst, ip6hdr->dest);
ip6_addr_assign_zone(ip_2_ip6(&ip6dst), IP6_UNKNOWN, netif);
ip_addr_copy_from_ip6_packed(ip6src, ip6hdr->src);
@@ -396,7 +396,7 @@ lowpan6_decompress_hdr(u8_t *lowpan6_buffer, size_t lowpan6_bufsize,
struct lowpan6_link_addr *src, struct lowpan6_link_addr *dest)
{
u16_t lowpan6_offset;
struct ip6_hdr *ip6hdr;
struct lwip_ip6_hdr *ip6hdr;
s8_t i;
u32_t header_temp;
u16_t ip6_offset = IP6_HLEN;
@@ -408,7 +408,7 @@ lowpan6_decompress_hdr(u8_t *lowpan6_buffer, size_t lowpan6_bufsize,
LWIP_ASSERT("hdr_size_comp != NULL", hdr_size_comp != NULL);
LWIP_ASSERT("dehdr_size_decompst != NULL", hdr_size_decomp != NULL);
ip6hdr = (struct ip6_hdr *)decomp_buffer;
ip6hdr = (struct lwip_ip6_hdr *)decomp_buffer;
if (decomp_bufsize < IP6_HLEN) {
return ERR_MEM;
}
+2 -2
View File
@@ -319,7 +319,7 @@ START_TEST(test_ip6_dest_unreachable_chained_pbuf)
u8_t udp_payload[] = "abcdefghijklmnopqrstuvwxyz0123456789";
struct pbuf *data = pbuf_alloc(PBUF_RAW, sizeof(udp_payload), PBUF_ROM);
u8_t *icmpptr;
struct ip6_hdr *outhdr;
struct lwip_ip6_hdr *outhdr;
struct icmp6_hdr *icmp6hdr;
LWIP_UNUSED_ARG(_i);
@@ -343,7 +343,7 @@ START_TEST(test_ip6_dest_unreachable_chained_pbuf)
/* Verify ICMP reply packet contents */
fail_unless(cloned_pbuf);
fail_unless(cloned_pbuf->len == IP6_HLEN + ICMP6_HLEN + sizeof(udp_hdr) + sizeof(udp_payload));
outhdr = (struct ip6_hdr*) cloned_pbuf->payload;
outhdr = (struct lwip_ip6_hdr*) cloned_pbuf->payload;
fail_unless(ip6_addr_packed_eq(ip_2_ip6(&my_addr), &outhdr->src, IP6_NO_ZONE));
fail_unless(ip6_addr_packed_eq(ip_2_ip6(&peer_addr), &outhdr->dest, IP6_NO_ZONE));
icmpptr = &((u8_t*)cloned_pbuf->payload)[IP6_HLEN];