Loading net/sched/act_csum.c +38 −39 Original line number Original line Diff line number Diff line Loading @@ -73,7 +73,8 @@ static int tcf_csum_init(struct nlattr *nla, struct nlattr *est, pc = tcf_hash_check(parm->index, a, bind, &csum_hash_info); pc = tcf_hash_check(parm->index, a, bind, &csum_hash_info); if (!pc) { if (!pc) { pc = tcf_hash_create(parm->index, est, a, sizeof(*p), bind, &csum_idx_gen, &csum_hash_info); pc = tcf_hash_create(parm->index, est, a, sizeof(*p), bind, &csum_idx_gen, &csum_hash_info); if (IS_ERR(pc)) if (IS_ERR(pc)) return PTR_ERR(pc); return PTR_ERR(pc); p = to_tcf_csum(pc); p = to_tcf_csum(pc); Loading Loading @@ -230,8 +231,9 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, struct iphdr *iph, struct udphdr *udph; struct udphdr *udph; u16 ul; u16 ul; /* Support both UDP and UDPLITE checksum algorithms, /* * Don't use udph->len to get the real length without any protocol check, * Support both UDP and UDPLITE checksum algorithms, Don't use * udph->len to get the real length without any protocol check, * UDPLITE uses udph->len for another thing, * UDPLITE uses udph->len for another thing, * Use iph->tot_len, or just ipl. * Use iph->tot_len, or just ipl. */ */ Loading @@ -249,10 +251,8 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, struct iphdr *iph, if (udplite) { if (udplite) { if (ul == 0) if (ul == 0) skb->csum = csum_partial(udph, ipl - ihl, 0); skb->csum = csum_partial(udph, ipl - ihl, 0); else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl)) else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl)) skb->csum = csum_partial(udph, ul, 0); skb->csum = csum_partial(udph, ul, 0); else else goto ignore_obscure_skb; goto ignore_obscure_skb; } else { } else { Loading Loading @@ -282,8 +282,9 @@ static int tcf_csum_ipv6_udp(struct sk_buff *skb, struct ipv6hdr *ip6h, struct udphdr *udph; struct udphdr *udph; u16 ul; u16 ul; /* Support both UDP and UDPLITE checksum algorithms, /* * Don't use udph->len to get the real length without any protocol check, * Support both UDP and UDPLITE checksum algorithms, Don't use * udph->len to get the real length without any protocol check, * UDPLITE uses udph->len for another thing, * UDPLITE uses udph->len for another thing, * Use ip6h->payload_len + sizeof(*ip6h) ... , or just ipl. * Use ip6h->payload_len + sizeof(*ip6h) ... , or just ipl. */ */ Loading Loading @@ -340,32 +341,32 @@ static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags) switch (iph->frag_off & htons(IP_OFFSET) ? 0 : iph->protocol) { switch (iph->frag_off & htons(IP_OFFSET) ? 0 : iph->protocol) { case IPPROTO_ICMP: case IPPROTO_ICMP: if (update_flags & TCA_CSUM_UPDATE_FLAG_ICMP) if (update_flags & TCA_CSUM_UPDATE_FLAG_ICMP) if (!tcf_csum_ipv4_icmp(skb, if (!tcf_csum_ipv4_icmp(skb, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len))) ntohs(iph->tot_len))) goto fail; goto fail; break; break; case IPPROTO_IGMP: case IPPROTO_IGMP: if (update_flags & TCA_CSUM_UPDATE_FLAG_IGMP) if (update_flags & TCA_CSUM_UPDATE_FLAG_IGMP) if (!tcf_csum_ipv4_igmp(skb, if (!tcf_csum_ipv4_igmp(skb, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len))) ntohs(iph->tot_len))) goto fail; goto fail; break; break; case IPPROTO_TCP: case IPPROTO_TCP: if (update_flags & TCA_CSUM_UPDATE_FLAG_TCP) if (update_flags & TCA_CSUM_UPDATE_FLAG_TCP) if (!tcf_csum_ipv4_tcp(skb, iph, if (!tcf_csum_ipv4_tcp(skb, iph, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len))) ntohs(iph->tot_len))) goto fail; goto fail; break; break; case IPPROTO_UDP: case IPPROTO_UDP: if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP) if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP) if (!tcf_csum_ipv4_udp(skb, iph, if (!tcf_csum_ipv4_udp(skb, iph, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len), 0)) ntohs(iph->tot_len), 0)) goto fail; goto fail; break; break; case IPPROTO_UDPLITE: case IPPROTO_UDPLITE: if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE) if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE) if (!tcf_csum_ipv4_udp(skb, iph, if (!tcf_csum_ipv4_udp(skb, iph, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len), 1)) ntohs(iph->tot_len), 1)) goto fail; goto fail; break; break; } } Loading Loading @@ -395,8 +396,7 @@ static int tcf_csum_ipv6_hopopts(struct ipv6_opt_hdr *ip6xh, len = ixhl - off; len = ixhl - off; while (len > 1) { while (len > 1) { switch (xh[off]) switch (xh[off]) { { case IPV6_TLV_PAD0: case IPV6_TLV_PAD0: optlen = 1; optlen = 1; break; break; Loading Loading @@ -476,14 +476,14 @@ static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags) goto done; goto done; case IPPROTO_UDP: case IPPROTO_UDP: if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP) if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP) if (!tcf_csum_ipv6_udp(skb, ip6h, if (!tcf_csum_ipv6_udp(skb, ip6h, hl, hl, pl + sizeof(*ip6h), 0)) pl + sizeof(*ip6h), 0)) goto fail; goto fail; goto done; goto done; case IPPROTO_UDPLITE: case IPPROTO_UDPLITE: if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE) if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE) if (!tcf_csum_ipv6_udp(skb, ip6h, if (!tcf_csum_ipv6_udp(skb, ip6h, hl, hl, pl + sizeof(*ip6h), 1)) pl + sizeof(*ip6h), 1)) goto fail; goto fail; goto done; goto done; default: default: Loading Loading @@ -544,7 +544,6 @@ static int tcf_csum_dump(struct sk_buff *skb, struct tcf_csum *p = a->priv; struct tcf_csum *p = a->priv; struct tc_csum opt = { struct tc_csum opt = { .update_flags = p->update_flags, .update_flags = p->update_flags, .index = p->tcf_index, .index = p->tcf_index, .action = p->tcf_action, .action = p->tcf_action, .refcnt = p->tcf_refcnt - ref, .refcnt = p->tcf_refcnt - ref, Loading Loading
net/sched/act_csum.c +38 −39 Original line number Original line Diff line number Diff line Loading @@ -73,7 +73,8 @@ static int tcf_csum_init(struct nlattr *nla, struct nlattr *est, pc = tcf_hash_check(parm->index, a, bind, &csum_hash_info); pc = tcf_hash_check(parm->index, a, bind, &csum_hash_info); if (!pc) { if (!pc) { pc = tcf_hash_create(parm->index, est, a, sizeof(*p), bind, &csum_idx_gen, &csum_hash_info); pc = tcf_hash_create(parm->index, est, a, sizeof(*p), bind, &csum_idx_gen, &csum_hash_info); if (IS_ERR(pc)) if (IS_ERR(pc)) return PTR_ERR(pc); return PTR_ERR(pc); p = to_tcf_csum(pc); p = to_tcf_csum(pc); Loading Loading @@ -230,8 +231,9 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, struct iphdr *iph, struct udphdr *udph; struct udphdr *udph; u16 ul; u16 ul; /* Support both UDP and UDPLITE checksum algorithms, /* * Don't use udph->len to get the real length without any protocol check, * Support both UDP and UDPLITE checksum algorithms, Don't use * udph->len to get the real length without any protocol check, * UDPLITE uses udph->len for another thing, * UDPLITE uses udph->len for another thing, * Use iph->tot_len, or just ipl. * Use iph->tot_len, or just ipl. */ */ Loading @@ -249,10 +251,8 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, struct iphdr *iph, if (udplite) { if (udplite) { if (ul == 0) if (ul == 0) skb->csum = csum_partial(udph, ipl - ihl, 0); skb->csum = csum_partial(udph, ipl - ihl, 0); else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl)) else if ((ul >= sizeof(*udph)) && (ul <= ipl - ihl)) skb->csum = csum_partial(udph, ul, 0); skb->csum = csum_partial(udph, ul, 0); else else goto ignore_obscure_skb; goto ignore_obscure_skb; } else { } else { Loading Loading @@ -282,8 +282,9 @@ static int tcf_csum_ipv6_udp(struct sk_buff *skb, struct ipv6hdr *ip6h, struct udphdr *udph; struct udphdr *udph; u16 ul; u16 ul; /* Support both UDP and UDPLITE checksum algorithms, /* * Don't use udph->len to get the real length without any protocol check, * Support both UDP and UDPLITE checksum algorithms, Don't use * udph->len to get the real length without any protocol check, * UDPLITE uses udph->len for another thing, * UDPLITE uses udph->len for another thing, * Use ip6h->payload_len + sizeof(*ip6h) ... , or just ipl. * Use ip6h->payload_len + sizeof(*ip6h) ... , or just ipl. */ */ Loading Loading @@ -340,32 +341,32 @@ static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags) switch (iph->frag_off & htons(IP_OFFSET) ? 0 : iph->protocol) { switch (iph->frag_off & htons(IP_OFFSET) ? 0 : iph->protocol) { case IPPROTO_ICMP: case IPPROTO_ICMP: if (update_flags & TCA_CSUM_UPDATE_FLAG_ICMP) if (update_flags & TCA_CSUM_UPDATE_FLAG_ICMP) if (!tcf_csum_ipv4_icmp(skb, if (!tcf_csum_ipv4_icmp(skb, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len))) ntohs(iph->tot_len))) goto fail; goto fail; break; break; case IPPROTO_IGMP: case IPPROTO_IGMP: if (update_flags & TCA_CSUM_UPDATE_FLAG_IGMP) if (update_flags & TCA_CSUM_UPDATE_FLAG_IGMP) if (!tcf_csum_ipv4_igmp(skb, if (!tcf_csum_ipv4_igmp(skb, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len))) ntohs(iph->tot_len))) goto fail; goto fail; break; break; case IPPROTO_TCP: case IPPROTO_TCP: if (update_flags & TCA_CSUM_UPDATE_FLAG_TCP) if (update_flags & TCA_CSUM_UPDATE_FLAG_TCP) if (!tcf_csum_ipv4_tcp(skb, iph, if (!tcf_csum_ipv4_tcp(skb, iph, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len))) ntohs(iph->tot_len))) goto fail; goto fail; break; break; case IPPROTO_UDP: case IPPROTO_UDP: if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP) if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP) if (!tcf_csum_ipv4_udp(skb, iph, if (!tcf_csum_ipv4_udp(skb, iph, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len), 0)) ntohs(iph->tot_len), 0)) goto fail; goto fail; break; break; case IPPROTO_UDPLITE: case IPPROTO_UDPLITE: if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE) if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE) if (!tcf_csum_ipv4_udp(skb, iph, if (!tcf_csum_ipv4_udp(skb, iph, iph->ihl * 4, iph->ihl * 4, ntohs(iph->tot_len), 1)) ntohs(iph->tot_len), 1)) goto fail; goto fail; break; break; } } Loading Loading @@ -395,8 +396,7 @@ static int tcf_csum_ipv6_hopopts(struct ipv6_opt_hdr *ip6xh, len = ixhl - off; len = ixhl - off; while (len > 1) { while (len > 1) { switch (xh[off]) switch (xh[off]) { { case IPV6_TLV_PAD0: case IPV6_TLV_PAD0: optlen = 1; optlen = 1; break; break; Loading Loading @@ -476,14 +476,14 @@ static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags) goto done; goto done; case IPPROTO_UDP: case IPPROTO_UDP: if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP) if (update_flags & TCA_CSUM_UPDATE_FLAG_UDP) if (!tcf_csum_ipv6_udp(skb, ip6h, if (!tcf_csum_ipv6_udp(skb, ip6h, hl, hl, pl + sizeof(*ip6h), 0)) pl + sizeof(*ip6h), 0)) goto fail; goto fail; goto done; goto done; case IPPROTO_UDPLITE: case IPPROTO_UDPLITE: if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE) if (update_flags & TCA_CSUM_UPDATE_FLAG_UDPLITE) if (!tcf_csum_ipv6_udp(skb, ip6h, if (!tcf_csum_ipv6_udp(skb, ip6h, hl, hl, pl + sizeof(*ip6h), 1)) pl + sizeof(*ip6h), 1)) goto fail; goto fail; goto done; goto done; default: default: Loading Loading @@ -544,7 +544,6 @@ static int tcf_csum_dump(struct sk_buff *skb, struct tcf_csum *p = a->priv; struct tcf_csum *p = a->priv; struct tc_csum opt = { struct tc_csum opt = { .update_flags = p->update_flags, .update_flags = p->update_flags, .index = p->tcf_index, .index = p->tcf_index, .action = p->tcf_action, .action = p->tcf_action, .refcnt = p->tcf_refcnt - ref, .refcnt = p->tcf_refcnt - ref, Loading