aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/wired.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-01-02 17:12:33 (GMT)
committerJouni Malinen <j@w1.fi>2020-01-02 17:17:10 (GMT)
commita8b00423eabc80eb12f9d17243d3d2aa0d5bac33 (patch)
tree1ee26c90dee9da478a6b4fb8b77e3dfb09879550 /wlantest/wired.c
parent3ea58a05485f7ccdc13973bce676d1896d0a6a5e (diff)
downloadhostap-a8b00423eabc80eb12f9d17243d3d2aa0d5bac33.zip
hostap-a8b00423eabc80eb12f9d17243d3d2aa0d5bac33.tar.gz
hostap-a8b00423eabc80eb12f9d17243d3d2aa0d5bac33.tar.bz2
BSD: Use struct ip rather than struct iphdr
As we define __FAVOR_BSD use the BSD IP header. Compile tested on NetBSD, DragonFlyBSD, and Linux. Signed-off-by: Roy Marples <roy@marples.name>
Diffstat (limited to 'wlantest/wired.c')
-rw-r--r--wlantest/wired.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/wlantest/wired.c b/wlantest/wired.c
index 9267f97..653be33 100644
--- a/wlantest/wired.c
+++ b/wlantest/wired.c
@@ -231,43 +231,44 @@ static void process_udp(struct wlantest *wt, u32 dst, u32 src,
static void process_ipv4(struct wlantest *wt, const u8 *data, size_t len)
{
- const struct iphdr *ip;
+ const struct ip *ip;
const u8 *payload;
size_t plen;
- u16 frag_off, tot_len;
+ uint16_t frag_off, ip_len;
if (len < sizeof(*ip))
return;
- ip = (const struct iphdr *) data;
- if (ip->version != 4)
+ ip = (const struct ip *) data;
+ if (ip->ip_v != 4)
return;
- if (ip->ihl < 5)
+ if (ip->ip_hl < 5)
return;
/* TODO: check header checksum in ip->check */
- frag_off = be_to_host16(ip->frag_off);
+ frag_off = be_to_host16(ip->ip_off);
if (frag_off & 0x1fff) {
wpa_printf(MSG_EXCESSIVE, "IP fragment reassembly not yet "
"supported");
return;
}
- tot_len = be_to_host16(ip->tot_len);
- if (tot_len > len)
+ ip_len = be_to_host16(ip->ip_len);
+ if (ip_len > len)
return;
- if (tot_len < len)
- len = tot_len;
+ if (ip_len < len)
+ len = ip_len;
- payload = data + 4 * ip->ihl;
- plen = len - 4 * ip->ihl;
+ payload = data + 4 * ip->ip_hl;
+ plen = len - 4 * ip->ip_hl;
if (payload + plen > data + len)
return;
- switch (ip->protocol) {
+ switch (ip->ip_p) {
case IPPROTO_UDP:
- process_udp(wt, ip->daddr, ip->saddr, payload, plen);
+ process_udp(wt, ip->ip_dst.s_addr, ip->ip_src.s_addr,
+ payload, plen);
break;
}
}