lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1282048602.5765.752.camel@bigi>
Date:	Tue, 17 Aug 2010 08:36:42 -0400
From:	jamal <hadi@...erus.ca>
To:	Grégoire Baron <baronchon@...m.org>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] net/sched: add ACT_CSUM action to update packets
 checksums

On Tue, 2010-08-17 at 01:02 +0200, Grégoire Baron wrote:

> You're rigth. I will correct that, maybe using a macro which is
> specialised to get the protocol structure ...
> However, this macro could call a 'goto' instruction. Is it really a good
> idea? Tell me. Are you sure a function is appropriate?

Do you even need the goto fail? It seems you could short-circuit and
return 0 (at least thats what the goto seems to do)

But i really dont want to complicate this; 
In the minimal i think you can make code like this

====
       struct icmphdr *icmph;
+       int hl;
+       int ntkoff;
+
+       ntkoff = skb_network_offset(skb);
+
+       hl = ihl + sizeof(*icmph);
+
+       if (!pskb_may_pull(skb, ipl + ntkoff) || (ipl < hl) ||
+           (skb_cloned(skb) &&
+            !skb_clone_writable(skb, hl + ntkoff) &&
+            pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
+               goto fail;
===

reusable - return 0 if fail else return 1 etc etc

BTW, another comment: icmp and igmp have unused parameter iph
passed to them - probably cut and paste.

cheers,
jamal

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ