Skip to content

Commit 0f2526a

Browse files
committed
sink: use struct ip in place of struct iphdr
1 parent b16940b commit 0f2526a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

codelab/sink.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ static inline int
3333
udp_port_match(const char *buf, unsigned len, int udp_port)
3434
{
3535
struct ether_header *ethh;
36-
struct iphdr *iph;
36+
struct ip *iph;
3737
struct udphdr *udph;
3838

3939
ethh = (struct ether_header *)buf;
4040
if (ethh->ether_type != htons(ETHERTYPE_IP)) {
4141
/* Filter out non-IP traffic. */
4242
return 0;
4343
}
44-
iph = (struct iphdr *)(ethh + 1);
45-
if (iph->protocol != IPPROTO_UDP) {
44+
iph = (struct ip *)(ethh + 1);
45+
if (iph->ip_p != IPPROTO_UDP) {
4646
/* Filter out non-UDP traffic. */
4747
return 0;
4848
}

0 commit comments

Comments
 (0)