- if (ip->protocol == IP_PROTO_TCP) {
- if (unlikely(l4hdr + sizeof(struct tcphdr) > data_end))
- DO_RETURN(PKT_LEN_DROP, XDP_DROP);
- tcp = (struct tcphdr*) l4hdr;
- } else if (ip->protocol == IP_PROTO_UDP) {
- if (unlikely(l4hdr + sizeof(struct udphdr) > data_end))
- DO_RETURN(PKT_LEN_DROP, XDP_DROP);
- udp = (struct udphdr*) l4hdr;
- } else if (ip->protocol == IP_PROTO_ICMP) {
- if (unlikely(l4hdr + sizeof(struct icmphdr) > data_end))
- DO_RETURN(PKT_LEN_DROP, XDP_DROP);
- icmp = (struct icmphdr*) l4hdr;
+ if ((ip->frag_off & BE16(IP_OFFSET)) == 0) {
+ if (ip->protocol == IP_PROTO_TCP) {
+ CHECK_LEN(l4hdr, tcphdr);
+ tcp = (struct tcphdr*) l4hdr;
+ } else if (ip->protocol == IP_PROTO_UDP) {
+ CHECK_LEN(l4hdr, udphdr);
+ udp = (struct udphdr*) l4hdr;
+ } else if (ip->protocol == IP_PROTO_ICMP) {
+ CHECK_LEN(l4hdr, icmphdr);
+ icmp = (struct icmphdr*) l4hdr;
+ }