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
| ||
|
Date: Thu, 27 Jul 2006 22:30:10 -0700 (PDT) From: David Miller <davem@...emloft.net> To: gerrit@....abdn.ac.uk Cc: akpm@...l.org, yoshfuji@...ux-ipv6.org, kuznet@....inr.ac.ru, jmorris@...ei.org, kaber@...eworks.de, pekkas@...core.fi, netdev@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCHv2 2.6.18-rc1-mm2 1/3] net: UDP-Lite generic support From: Gerrit Renker <gerrit@....abdn.ac.uk> Date: Fri, 14 Jul 2006 17:19:02 +0100 > Generic support (header files, configuration, and documentation) for > the UDP-Lite protocol (RFC 3828). Gerrit, I tried to bring myself over the edge to accept this work and push it into my net-2.6.19 tree, but I simply can't The amount of code duplication is absolutely enormous and totally unnecessary. With proper abstractions, you can easily add UDP-lite support to the existing UDP code. And I would really like it to be in that format before we put it into the tree. Then all you need to do is something like add: __u16 pcslen; __u16 pcrlen; /* checksum coverage set indicators used by pcflag */ #define UDPLITE_SEND_CC 0x1 #define UDPLITE_RECV_CC 0x2 __u8 pcflag; to struct udp_sock. Add the seperate udp_port_rover and udlite_hash[] table to udp.c, make the latter sized by UDP_HTABLE_SIZE, with suitable exports, and share the udp_hash_lock for mutual exclusion. Finally, parameterize all the UDP hash table routines to take a hash table base and a port rover pointer so that they can operate on both UDP and UDP-Lite sockets transparently. Next make 2 top-level routines for things like udp_err() etc. So that you can go: /* Common code */ static void __udp_err(struct sock *sk, struct sk_buff *skb, int type, int code, u32 info) { struct inet_sock *inet; int type = skb->h.icmph->type; int code = skb->h.icmph->code; int harderr, err; if (sk == NULL) { ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); return; /* No socket for error */ } err = 0; harderr = 0; inet = inet_sk(sk); switch (type) { ... } /* * RFC1122: OK. Passes ICMP errors back to application, as per * 4.1.3.3. */ if (!inet->recverr) { if (!harderr || sk->sk_state != TCP_ESTABLISHED) goto out; } else { ip_icmp_error(sk, skb, err, uh->dest, info, (u8*)(uh+1)); } sk->sk_err = err; sk->sk_error_report(sk); out: sock_put(sk); } void udp_err(struct sk_buff *skb, u32 info) { struct iphdr *iph = (struct iphdr*)skb->data; struct udphdr *uh = (struct udphdr*)(skb->data+(iph->ihl<<2)); int type = skb->h.icmph->type; int code = skb->h.icmph->code; struct sock *sk; sk = udp_v4_lookup(udp_hash, iph->daddr, uh->dest, iph->saddr, uh->source, skb->dev->ifindex); __udp_err(sk, skb, type, code, info); } void udplite_err(struct sk_buff *skb, u32 info) { struct iphdr *iph = (struct iphdr*)skb->data; struct udphdr *uh = (struct udphdr*)(skb->data+(iph->ihl<<2)); int type = skb->h.icmph->type; int code = skb->h.icmph->code; struct sock *sk; sk = udp_v4_lookup(udplite_hash, iph->daddr, uh->dest, iph->saddr, uh->source, skb->dev->ifindex); __udp_err(sk, skb, type, code, info); } Make similar abstractions for the send and recive path processing, substituting in the specific UDP vs. UDP-Lite header and checksum semantic handling along the way. It's mostly clerical work, but it will mean that we will have one copy of all this code and as a result we won't even need a config option for UDP-Lite. Thanks. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists