From 6ff2626cdf82d2e21ee18e0d558e4eaab6811c82 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 27 Sep 2004 03:18:51 +0200 Subject: [PATCH] [NETFILTER]: Convert udp conntrack protocol to skb_header_pointer Signed-off-by: Patrick McHardy --- net/ipv4/netfilter/ip_conntrack_proto_udp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/ipv4/netfilter/ip_conntrack_proto_udp.c b/net/ipv4/netfilter/ip_conntrack_proto_udp.c index 44b8dd938ca78..5bc28a2246238 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_udp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_udp.c @@ -91,10 +91,11 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, { struct iphdr *iph = skb->nh.iph; unsigned int udplen = skb->len - iph->ihl * 4; - struct udphdr hdr; + struct udphdr _hdr, *hdr; /* Header is too small? */ - if (skb_copy_bits(skb, iph->ihl*4, &hdr, sizeof(hdr)) != 0) { + hdr = skb_header_pointer(skb, iph->ihl*4, sizeof(_hdr), &_hdr); + if (hdr == NULL) { if (LOG_INVALID(IPPROTO_UDP)) nf_log_packet(PF_INET, 0, skb, NULL, NULL, "ip_ct_udp: short packet "); @@ -102,7 +103,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, } /* Truncated/malformed packets */ - if (ntohs(hdr.len) > udplen || ntohs(hdr.len) < sizeof(hdr)) { + if (ntohs(hdr->len) > udplen || ntohs(hdr->len) < sizeof(*hdr)) { if (LOG_INVALID(IPPROTO_UDP)) nf_log_packet(PF_INET, 0, skb, NULL, NULL, "ip_ct_udp: truncated/malformed packet "); @@ -110,7 +111,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, } /* Packet with no checksum */ - if (!hdr.check) + if (!hdr->check) return NF_ACCEPT; /* Checksum invalid? Ignore. -- 2.53.0