netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Missing csum_fold() in ip6t_HL.c ?
@ 2006-09-15 10:37 Alexey Dobriyan
  2006-09-15 20:19 ` Patrick McHardy
  2007-02-12 14:47 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 2 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2006-09-15 10:37 UTC (permalink / raw)
  To: netdev; +Cc: netfilter-devel

It looks like "diffs" array is write-only. It also looks like ipv4
occurences use some csum_fold() trickery. Was is forgotten here? Should
"diffs" be removed?

    20	static unsigned int ip6t_hl_target(struct sk_buff **pskb,
    21					   const struct net_device *in,
    22					   const struct net_device *out,
    23					   unsigned int hooknum,
    24					   const struct xt_target *target,
    25					   const void *targinfo, void *userinfo)
    26	{
    27		struct ipv6hdr *ip6h;
    28		const struct ip6t_HL_info *info = targinfo;
    29	===>	u_int16_t diffs[2];	<===
    30		int new_hl;
    31
    32		if (!skb_make_writable(pskb, (*pskb)->len))
    33			return NF_DROP;
    34
    35		ip6h = (*pskb)->nh.ipv6h;
    36
    37		switch (info->mode) {
    38			case IP6T_HL_SET:
    39				new_hl = info->hop_limit;
    40				break;
    41			case IP6T_HL_INC:
    42				new_hl = ip6h->hop_limit + info->hop_limit;
    43				if (new_hl > 255)
    44					new_hl = 255;
    45				break;
    46			case IP6T_HL_DEC:
    47				new_hl = ip6h->hop_limit - info->hop_limit;
    48				if (new_hl < 0)
    49					new_hl = 0;
    50				break;
    51			default:
    52				new_hl = ip6h->hop_limit;
    53				break;
    54		}
    55
    56		if (new_hl != ip6h->hop_limit) {
    57	===>		diffs[0] = htons(((unsigned)ip6h->hop_limit) << 8) ^ 0xFFFF;
    58			ip6h->hop_limit = new_hl;
    59	===>		diffs[1] = htons(((unsigned)ip6h->hop_limit) << 8);
    60		}
    61
    62		return IP6T_CONTINUE;
    63	}


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-02-12 15:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-15 10:37 Missing csum_fold() in ip6t_HL.c ? Alexey Dobriyan
2006-09-15 20:19 ` Patrick McHardy
2007-02-12 14:47 ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-12 14:52   ` Patrick McHardy
2007-02-12 15:01     ` YOSHIFUJI Hideaki / 吉藤英明

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).