From owner-p4-projects@FreeBSD.ORG Thu Feb 8 11:00:05 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 71E1616A409; Thu, 8 Feb 2007 10:59:38 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD1D716A400 for ; Thu, 8 Feb 2007 10:59:34 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id BC14E13C481 for ; Thu, 8 Feb 2007 10:59:34 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l18AxYcj070563 for ; Thu, 8 Feb 2007 10:59:34 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l18AxY9Y070560 for perforce@freebsd.org; Thu, 8 Feb 2007 10:59:34 GMT (envelope-from piso@freebsd.org) Date: Thu, 8 Feb 2007 10:59:34 GMT Message-Id: <200702081059.l18AxY9Y070560@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to piso@freebsd.org using -f From: Paolo Pisati To: Perforce Change Reviews Cc: Subject: PERFORCE change 114233 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2007 11:00:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=114233 Change 114233 by piso@piso_newluxor on 2007/02/08 10:58:34 o when pulling up an ip hdr, if present, pullup the options too. o rewrite some PULLUP macros, using PULLUP_SIZE. Affected files ... .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_local.h#24 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_local.h#24 (text+ko) ==== @@ -181,59 +181,50 @@ #define MYMTOD(p, foo) (p != NULL) ? mtod(p, foo) : NULL +#define PULLUP_SIZE(pip, ptr, s) do { \ + *ptr = m_pullup((*ptr), s); \ + (pip) = MYMTOD(*ptr, struct ip *); \ +} while (0) + #define PULLUP_IPHDR(pip, ptr) do { \ - *ptr = m_pullup((*ptr), sizeof(struct ip)); \ - (pip) = MYMTOD(*ptr, struct ip *); \ + PULLUP_SIZE(pip, ptr, sizeof(struct ip)); \ + if (pip != NULL && ((pip->ip_hl << 2) > sizeof(struct ip))) \ + PULLUP_SIZE(pip, ptr, (pip->ip_hl << 2)); \ } while (0) #define PULLUP_UDPHDR(pip, ptr) do { \ - pip = mtod(*ptr, struct ip *); \ - *ptr = m_pullup((*ptr), (pip->ip_hl << 2) + sizeof(struct udphdr)); \ - (pip) = MYMTOD(*ptr, struct ip *); \ + pip = mtod(*ptr, struct ip *); \ + PULLUP_SIZE(pip, ptr, (pip->ip_hl << 2) + sizeof(struct udphdr)); \ } while (0) #define PULLUP_TCPHDR(pip, ptr) do { \ - pip = mtod(*ptr, struct ip *); \ - *ptr = m_pullup((*ptr), (pip->ip_hl << 2) + sizeof(struct tcphdr)); \ - (pip) = MYMTOD(*ptr, struct ip *); \ + pip = mtod(*ptr, struct ip *); \ + PULLUP_SIZE(pip, ptr, (pip->ip_hl << 2) + sizeof(struct tcphdr)); \ } while (0) #define PULLUP_ICMPHDR(pip, ptr) do { \ - pip = mtod(*ptr, struct ip *); \ - *ptr = m_pullup((*ptr), (pip->ip_hl << 2) + sizeof(struct icmp)); \ - (pip) = MYMTOD(*ptr, struct ip *); \ + pip = mtod(*ptr, struct ip *); \ + PULLUP_SIZE(pip, ptr, (pip->ip_hl << 2) + sizeof(struct icmp)); \ } while (0) #define PULLUP_ICMPIP64(pip, ptr, ic) do { \ int s; \ - pip = mtod(*ptr, struct ip *); \ - s = (pip->ip_hl << 2) + sizeof(struct icmp) + \ - (ic->icmp_ip.ip_hl << 2) - sizeof(struct ip) + 8; \ - *ptr = m_pullup((*ptr), s); \ - (pip) = MYMTOD(*ptr, struct ip *); \ + pip = mtod(*ptr, struct ip *); \ + s = (pip->ip_hl << 2) + sizeof(struct icmp) + \ + (ic->icmp_ip.ip_hl << 2) - sizeof(struct ip) + 8; \ + PULLUP_SIZE(pip, ptr, s); \ } while (0) #define PULLUP_IPTCPHDR(pip, ptr) do { \ - *ptr = m_pullup((*ptr), sizeof(struct ip)); \ - (pip) = MYMTOD(*ptr, struct ip *); \ - if (pip != NULL) { \ - *ptr = m_pullup((*ptr), (pip->ip_hl << 2) + sizeof(struct tcphdr)); \ - (pip) = MYMTOD(*ptr, struct ip *); \ - } \ + PULLUP_IPHDR(pip, ptr); \ + if (pip != NULL) \ + PULLUP_TCPHDR(pip, ptr); \ } while (0) #define PULLUP_IPUDPHDR(pip, ptr) do { \ - *ptr = m_pullup((*ptr), sizeof(struct ip)); \ - (pip) = MYMTOD(*ptr, struct ip *); \ - if (pip != NULL) { \ - *ptr = m_pullup((*ptr), (pip->ip_hl << 2) + sizeof(struct udphdr)); \ - (pip) = MYMTOD(*ptr, struct ip *); \ - } \ -} while (0) - -#define PULLUP_SIZE(pip, ptr, s) do { \ - *ptr = m_pullup((*ptr), s); \ - (pip) = MYMTOD(*ptr, struct ip *); \ + PULLUP_IPHDR(pip, ptr); \ + if (pip != NULL) \ + PULLUP_UDPHDR(pip, ptr); \ } while (0) #else