From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 13:23:14 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5D0E106568F; Sun, 27 Dec 2009 13:23:14 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B515E8FC1F; Sun, 27 Dec 2009 13:23:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBRDNEFW057626; Sun, 27 Dec 2009 13:23:14 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBRDNEsj057622; Sun, 27 Dec 2009 13:23:14 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912271323.nBRDNEsj057622@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 27 Dec 2009 13:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201049 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 13:23:14 -0000 Author: luigi Date: Sun Dec 27 13:23:14 2009 New Revision: 201049 URL: http://svn.freebsd.org/changeset/base/201049 Log: merge some common code to attach/detach hooks into a single function. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Sun Dec 27 13:05:56 2009 (r201048) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Sun Dec 27 13:23:14 2009 (r201049) @@ -1176,7 +1176,7 @@ do { \ IPFW_RUNLOCK(chain); return (IP_FW_DENY); /* invalid */ } - f_pos = ipfw_find_rule(chain, skipto, 0); + f_pos = ipfw_find_rule(chain, skipto+1, 0); } } /* reset divert rule to avoid confusion later */ @@ -2378,7 +2378,7 @@ vnet_ipfw_init(const void *unused) */ V_ip_fw_ctl_ptr = ipfw_ctl; V_ip_fw_chk_ptr = ipfw_chk; - error = ipfw_attach_hooks(); + error = ipfw_attach_hooks(1); return (error); } @@ -2398,10 +2398,7 @@ vnet_ipfw_uninit(const void *unused) * Then grab, release and grab again the WLOCK so we make * sure the update is propagated and nobody will be in. */ - ipfw_unhook(); -#ifdef INET6 - ipfw6_unhook(); -#endif + (void)ipfw_attach_hooks(0 /* detach */); V_ip_fw_chk_ptr = NULL; V_ip_fw_ctl_ptr = NULL; IPFW_UH_WLOCK(chain); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 13:05:56 2009 (r201048) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 13:23:14 2009 (r201049) @@ -458,87 +458,44 @@ nodivert: return 1; } +/* + * attach or detach hooks for a given protocol family + */ static int -ipfw_hook(void) +ipfw_hook(int onoff, int pf) { - struct pfil_head *pfh_inet; + struct pfil_head *pfh; + int (*fn)(int (*pfil_func)(void *, struct mbuf **, + struct ifnet *, int, struct inpcb *), + void *, int, struct pfil_head *); - pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); - if (pfh_inet == NULL) - return ENOENT; - - (void)pfil_add_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, - pfh_inet); - (void)pfil_add_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, - pfh_inet); - - return 0; -} -int -ipfw_unhook(void) -{ - struct pfil_head *pfh_inet; - - pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); - if (pfh_inet == NULL) + pfh = pfil_head_get(PFIL_TYPE_AF, pf); + if (pfh == NULL) return ENOENT; - (void)pfil_remove_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, - pfh_inet); - (void)pfil_remove_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, - pfh_inet); + fn = (onoff) ? pfil_add_hook : pfil_remove_hook; + (void)fn(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh); + (void)fn(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh); return 0; } -#ifdef INET6 -static int -ipfw6_hook(void) -{ - struct pfil_head *pfh_inet6; - - pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6); - if (pfh_inet6 == NULL) - return ENOENT; - - (void)pfil_add_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, - pfh_inet6); - (void)pfil_add_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, - pfh_inet6); - - return 0; -} - -int -ipfw6_unhook(void) -{ - struct pfil_head *pfh_inet6; - - pfh_inet6 = pfil_head_get(PFIL_TYPE_AF, AF_INET6); - if (pfh_inet6 == NULL) - return ENOENT; - - (void)pfil_remove_hook(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, - pfh_inet6); - (void)pfil_remove_hook(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, - pfh_inet6); - - return 0; -} -#endif /* INET6 */ - int -ipfw_attach_hooks(void) +ipfw_attach_hooks(int arg) { int error = 0; - if (V_fw_enable && ipfw_hook() != 0) { + if (arg == 0) /* detach */ + ipfw_hook(0, AF_INET); + else if (V_fw_enable && ipfw_hook(1, AF_INET) != 0) { error = ENOENT; /* see ip_fw_pfil.c::ipfw_hook() */ printf("ipfw_hook() error\n"); } #ifdef INET6 - if (V_fw6_enable && ipfw6_hook() != 0) { + if (arg == 0) /* detach */ + ipfw_hook(0, AF_INET6); + else if (V_fw6_enable && ipfw_hook(1, AF_INET6) != 0) { error = ENOENT; printf("ipfw6_hook() error\n"); } @@ -552,13 +509,16 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS) int enable; int oldenable; int error; + int af; if (arg1 == &VNET_NAME(fw_enable)) { enable = V_fw_enable; + af = AF_INET; } #ifdef INET6 else if (arg1 == &VNET_NAME(fw6_enable)) { enable = V_fw6_enable; + af = AF_INET6; } #endif else @@ -576,19 +536,14 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS) if (enable == oldenable) return (0); - if (arg1 == &VNET_NAME(fw_enable)) { - error = (enable) ? ipfw_hook() : ipfw_unhook(); - if (error) - return (error); + error = ipfw_hook(enable, af); + if (error) + return (error); + if (af == AF_INET) V_fw_enable = enable; - } #ifdef INET6 - else if (arg1 == &VNET_NAME(fw6_enable)) { - error = (enable) ? ipfw6_hook() : ipfw6_unhook(); - if (error) - return (error); + else if (af == AF_INET6) V_fw6_enable = enable; - } #endif return (0); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Sun Dec 27 13:05:56 2009 (r201048) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Sun Dec 27 13:23:14 2009 (r201049) @@ -132,9 +132,8 @@ int ipfw_check_in(void *, struct mbuf ** int ipfw_check_out(void *, struct mbuf **, struct ifnet *, int, struct inpcb *inp); -int ipfw_attach_hooks(void); -int ipfw_unhook(void); -int ipfw6_unhook(void); +/* attach (arg = 1) or detach (arg = 0) hooks */ +int ipfw_attach_hooks(int); #ifdef NOTYET void ipfw_nat_destroy(void); #endif From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 13:56:36 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36F4E1065676; Sun, 27 Dec 2009 13:56:36 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22F8B8FC1A; Sun, 27 Dec 2009 13:56:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBRDuagG058294; Sun, 27 Dec 2009 13:56:36 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBRDuZ4N058250; Sun, 27 Dec 2009 13:56:35 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912271356.nBRDuZ4N058250@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 27 Dec 2009 13:56:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201050 - in user/luigi/ipfw3-head: . bin/setfacl bin/sh contrib/telnet/telnetd contrib/top etc lib/libc/posix1e lib/libpam/modules/pam_lastlog lib/libulog libexec/atrun libexec/talkd r... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 13:56:36 -0000 Author: luigi Date: Sun Dec 27 13:56:35 2009 New Revision: 201050 URL: http://svn.freebsd.org/changeset/base/201050 Log: svn merge -r 200947:201048 from HEAD Added: user/luigi/ipfw3-head/share/man/man4/mk48txx.4 - copied unchanged from r201048, head/share/man/man4/mk48txx.4 user/luigi/ipfw3-head/tools/regression/bin/sh/builtins/fc2.0 - copied unchanged from r201048, head/tools/regression/bin/sh/builtins/fc2.0 Modified: user/luigi/ipfw3-head/UPDATING user/luigi/ipfw3-head/bin/setfacl/merge.c user/luigi/ipfw3-head/bin/setfacl/remove.c user/luigi/ipfw3-head/bin/setfacl/setfacl.h user/luigi/ipfw3-head/bin/setfacl/util.c user/luigi/ipfw3-head/bin/sh/alias.c user/luigi/ipfw3-head/bin/sh/alias.h user/luigi/ipfw3-head/bin/sh/arith.h user/luigi/ipfw3-head/bin/sh/arith.y user/luigi/ipfw3-head/bin/sh/cd.c user/luigi/ipfw3-head/bin/sh/error.c user/luigi/ipfw3-head/bin/sh/error.h user/luigi/ipfw3-head/bin/sh/exec.c user/luigi/ipfw3-head/bin/sh/exec.h user/luigi/ipfw3-head/bin/sh/expand.c user/luigi/ipfw3-head/bin/sh/expand.h user/luigi/ipfw3-head/bin/sh/histedit.c user/luigi/ipfw3-head/bin/sh/input.c user/luigi/ipfw3-head/bin/sh/input.h user/luigi/ipfw3-head/bin/sh/jobs.c user/luigi/ipfw3-head/bin/sh/mail.c user/luigi/ipfw3-head/bin/sh/main.c user/luigi/ipfw3-head/bin/sh/main.h user/luigi/ipfw3-head/bin/sh/memalloc.c user/luigi/ipfw3-head/bin/sh/memalloc.h user/luigi/ipfw3-head/bin/sh/myhistedit.h user/luigi/ipfw3-head/bin/sh/options.c user/luigi/ipfw3-head/bin/sh/options.h user/luigi/ipfw3-head/bin/sh/output.c user/luigi/ipfw3-head/bin/sh/output.h user/luigi/ipfw3-head/bin/sh/parser.c user/luigi/ipfw3-head/bin/sh/parser.h user/luigi/ipfw3-head/bin/sh/show.c user/luigi/ipfw3-head/bin/sh/show.h user/luigi/ipfw3-head/bin/sh/trap.h user/luigi/ipfw3-head/bin/sh/var.c user/luigi/ipfw3-head/bin/sh/var.h user/luigi/ipfw3-head/contrib/telnet/telnetd/sys_term.c user/luigi/ipfw3-head/contrib/top/username.c user/luigi/ipfw3-head/etc/rc.subr user/luigi/ipfw3-head/lib/libc/posix1e/acl_delete_entry.c user/luigi/ipfw3-head/lib/libpam/modules/pam_lastlog/pam_lastlog.c user/luigi/ipfw3-head/lib/libulog/ulog.h user/luigi/ipfw3-head/lib/libulog/ulog_getutxent.c user/luigi/ipfw3-head/lib/libulog/ulog_pututxline.c user/luigi/ipfw3-head/lib/libulog/ulog_setutxfile.3 user/luigi/ipfw3-head/libexec/atrun/atrun.c user/luigi/ipfw3-head/libexec/talkd/Makefile user/luigi/ipfw3-head/libexec/talkd/process.c user/luigi/ipfw3-head/release/picobsd/bridge/PICOBSD user/luigi/ipfw3-head/release/picobsd/bridge/crunch.conf user/luigi/ipfw3-head/sbin/nfsiod/nfsiod.8 user/luigi/ipfw3-head/sbin/nfsiod/nfsiod.c user/luigi/ipfw3-head/share/man/man4/Makefile user/luigi/ipfw3-head/share/man/man4/gem.4 user/luigi/ipfw3-head/share/man/man4/ste.4 user/luigi/ipfw3-head/sys/cam/ata/ata_da.c user/luigi/ipfw3-head/sys/conf/files.ia64 user/luigi/ipfw3-head/sys/dev/ae/if_ae.c user/luigi/ipfw3-head/sys/dev/ahci/ahci.c user/luigi/ipfw3-head/sys/dev/hwpmc/hwpmc_core.c user/luigi/ipfw3-head/sys/dev/hwpmc/hwpmc_mod.c user/luigi/ipfw3-head/sys/dev/jme/if_jme.c user/luigi/ipfw3-head/sys/dev/mc146818/mc146818.c user/luigi/ipfw3-head/sys/dev/mc146818/mc146818reg.h user/luigi/ipfw3-head/sys/dev/mc146818/mc146818var.h user/luigi/ipfw3-head/sys/dev/mk48txx/mk48txx.c user/luigi/ipfw3-head/sys/dev/mk48txx/mk48txxreg.h user/luigi/ipfw3-head/sys/dev/mk48txx/mk48txxvar.h user/luigi/ipfw3-head/sys/dev/ste/if_ste.c user/luigi/ipfw3-head/sys/dev/ste/if_stereg.h user/luigi/ipfw3-head/sys/dev/twe/twe.c user/luigi/ipfw3-head/sys/dev/twe/twe_freebsd.c user/luigi/ipfw3-head/sys/dev/twe/twevar.h user/luigi/ipfw3-head/sys/dev/usb/net/if_aue.c user/luigi/ipfw3-head/sys/dev/usb/net/if_axe.c user/luigi/ipfw3-head/sys/dev/usb/net/if_cue.c user/luigi/ipfw3-head/sys/dev/usb/net/if_kue.c user/luigi/ipfw3-head/sys/dev/usb/serial/uftdi.c user/luigi/ipfw3-head/sys/dev/usb/serial/uplcom.c user/luigi/ipfw3-head/sys/dev/usb/serial/uslcom.c user/luigi/ipfw3-head/sys/dev/usb/serial/uvisor.c user/luigi/ipfw3-head/sys/dev/usb/usbdevs user/luigi/ipfw3-head/sys/dev/usb/wlan/if_rum.c user/luigi/ipfw3-head/sys/dev/usb/wlan/if_ural.c user/luigi/ipfw3-head/sys/dev/vge/if_vge.c user/luigi/ipfw3-head/sys/fs/nfs/nfs_commonacl.c user/luigi/ipfw3-head/sys/fs/nfs/nfs_var.h user/luigi/ipfw3-head/sys/fs/nfsclient/nfs.h user/luigi/ipfw3-head/sys/fs/nfsclient/nfs_clbio.c user/luigi/ipfw3-head/sys/fs/nfsclient/nfs_clvnops.c user/luigi/ipfw3-head/sys/fs/nfsserver/nfs_nfsdport.c user/luigi/ipfw3-head/sys/fs/nfsserver/nfs_nfsdserv.c user/luigi/ipfw3-head/sys/ia64/include/cpufunc.h user/luigi/ipfw3-head/sys/kern/kern_proc.c user/luigi/ipfw3-head/sys/kern/kern_rmlock.c user/luigi/ipfw3-head/sys/kern/subr_acl_nfs4.c user/luigi/ipfw3-head/sys/kern/subr_acl_posix1e.c user/luigi/ipfw3-head/sys/kern/vfs_subr.c user/luigi/ipfw3-head/sys/nfsclient/krpc_subr.c user/luigi/ipfw3-head/sys/sparc64/include/intr_machdep.h user/luigi/ipfw3-head/sys/sparc64/pci/ofw_pcib.c user/luigi/ipfw3-head/sys/sparc64/pci/psycho.c user/luigi/ipfw3-head/sys/sparc64/pci/schizo.c user/luigi/ipfw3-head/sys/sparc64/sparc64/eeprom.c user/luigi/ipfw3-head/sys/sparc64/sparc64/intr_machdep.c user/luigi/ipfw3-head/sys/sparc64/sparc64/nexus.c user/luigi/ipfw3-head/sys/sparc64/sparc64/rtc.c user/luigi/ipfw3-head/sys/sys/pmc.h user/luigi/ipfw3-head/tools/regression/acltools/tools-crossfs.test user/luigi/ipfw3-head/usr.bin/killall/killall.1 user/luigi/ipfw3-head/usr.bin/rwho/rwho.c user/luigi/ipfw3-head/usr.bin/who/who.c user/luigi/ipfw3-head/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile user/luigi/ipfw3-head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c user/luigi/ipfw3-head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c user/luigi/ipfw3-head/usr.sbin/diskinfo/diskinfo.8 user/luigi/ipfw3-head/usr.sbin/diskinfo/diskinfo.c user/luigi/ipfw3-head/usr.sbin/lastlogin/lastlogin.c user/luigi/ipfw3-head/usr.sbin/ntp/config.h user/luigi/ipfw3-head/usr.sbin/service/service.8 user/luigi/ipfw3-head/usr.sbin/syslogd/Makefile user/luigi/ipfw3-head/usr.sbin/syslogd/syslogd.c user/luigi/ipfw3-head/usr.sbin/wake/wake.8 user/luigi/ipfw3-head/usr.sbin/wake/wake.c Directory Properties: user/luigi/ipfw3-head/ (props changed) user/luigi/ipfw3-head/cddl/contrib/opensolaris/ (props changed) user/luigi/ipfw3-head/contrib/bind9/ (props changed) user/luigi/ipfw3-head/contrib/cpio/ (props changed) user/luigi/ipfw3-head/contrib/csup/ (props changed) user/luigi/ipfw3-head/contrib/ee/ (props changed) user/luigi/ipfw3-head/contrib/expat/ (props changed) user/luigi/ipfw3-head/contrib/file/ (props changed) user/luigi/ipfw3-head/contrib/gdb/ (props changed) user/luigi/ipfw3-head/contrib/gdtoa/ (props changed) user/luigi/ipfw3-head/contrib/less/ (props changed) user/luigi/ipfw3-head/contrib/libpcap/ (props changed) user/luigi/ipfw3-head/contrib/ncurses/ (props changed) user/luigi/ipfw3-head/contrib/netcat/ (props changed) user/luigi/ipfw3-head/contrib/ntp/ (props changed) user/luigi/ipfw3-head/contrib/openbsm/ (props changed) user/luigi/ipfw3-head/contrib/openpam/ (props changed) user/luigi/ipfw3-head/contrib/pf/ (props changed) user/luigi/ipfw3-head/contrib/sendmail/ (props changed) user/luigi/ipfw3-head/contrib/tcpdump/ (props changed) user/luigi/ipfw3-head/contrib/tcsh/ (props changed) user/luigi/ipfw3-head/contrib/top/ (props changed) user/luigi/ipfw3-head/contrib/top/install-sh (props changed) user/luigi/ipfw3-head/contrib/wpa/ (props changed) user/luigi/ipfw3-head/crypto/openssh/ (props changed) user/luigi/ipfw3-head/crypto/openssl/ (props changed) user/luigi/ipfw3-head/lib/libc/ (props changed) user/luigi/ipfw3-head/lib/libc/stdtime/ (props changed) user/luigi/ipfw3-head/lib/libutil/ (props changed) user/luigi/ipfw3-head/sbin/ (props changed) user/luigi/ipfw3-head/sbin/ipfw/ (props changed) user/luigi/ipfw3-head/share/zoneinfo/ (props changed) user/luigi/ipfw3-head/sys/ (props changed) user/luigi/ipfw3-head/sys/amd64/include/xen/ (props changed) user/luigi/ipfw3-head/sys/cddl/contrib/opensolaris/ (props changed) user/luigi/ipfw3-head/sys/contrib/dev/acpica/ (props changed) user/luigi/ipfw3-head/sys/contrib/pf/ (props changed) user/luigi/ipfw3-head/sys/dev/xen/xenpci/ (props changed) user/luigi/ipfw3-head/usr.bin/csup/ (props changed) user/luigi/ipfw3-head/usr.bin/procstat/ (props changed) user/luigi/ipfw3-head/usr.sbin/zic/ (props changed) Modified: user/luigi/ipfw3-head/UPDATING ============================================================================== --- user/luigi/ipfw3-head/UPDATING Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/UPDATING Sun Dec 27 13:56:35 2009 (r201050) @@ -161,7 +161,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. 20090712: Padding has been added to struct tcpcb, sackhint and tcpstat in to facilitate future MFCs and bug fixes whilst - maintainig the ABI. However, this change breaks the ABI, so bump + maintaining the ABI. However, this change breaks the ABI, so bump __FreeBSD_version to 800102. User space tools that rely on the size of any of these structs (e.g. sockstat) need to be recompiled. @@ -895,7 +895,7 @@ COMMON ITEMS: ------------- Avoid using make -j when upgrading. While generally safe, there are sometimes problems using -j to upgrade. If your upgrade fails with - -j, please try again wtihout -j. From time to time in the past there + -j, please try again without -j. From time to time in the past there have been problems using -j with buildworld and/or installworld. This is especially true when upgrading between "distant" versions (eg one that cross a major release boundary or several minor releases, or when Modified: user/luigi/ipfw3-head/bin/setfacl/merge.c ============================================================================== --- user/luigi/ipfw3-head/bin/setfacl/merge.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/setfacl/merge.c Sun Dec 27 13:56:35 2009 (r201050) @@ -100,11 +100,10 @@ merge_acl(acl_t acl, acl_t *prev_acl, co acl_get_brand_np(acl, &acl_brand); acl_get_brand_np(*prev_acl, &prev_acl_brand); - if (acl_brand != prev_acl_brand) { + if (branding_mismatch(acl_brand, prev_acl_brand)) { warnx("%s: branding mismatch; existing ACL is %s, " "entry to be merged is %s", filename, - prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e", - acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e"); + brand_name(prev_acl_brand), brand_name(acl_brand)); return (-1); } @@ -252,9 +251,10 @@ add_acl(acl_t acl, uint entry_number, ac return (-1); } - if (acl_brand != ACL_BRAND_NFS4) { + if (branding_mismatch(acl_brand, ACL_BRAND_NFS4)) { warnx("%s: branding mismatch; existing ACL is NFSv4, " - "entry to be added is POSIX.1e", filename); + "entry to be added is %s", filename, + brand_name(acl_brand)); return (-1); } Modified: user/luigi/ipfw3-head/bin/setfacl/remove.c ============================================================================== --- user/luigi/ipfw3-head/bin/setfacl/remove.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/setfacl/remove.c Sun Dec 27 13:56:35 2009 (r201050) @@ -53,11 +53,10 @@ remove_acl(acl_t acl, acl_t *prev_acl, c acl_get_brand_np(acl, &acl_brand); acl_get_brand_np(*prev_acl, &prev_acl_brand); - if (acl_brand != prev_acl_brand) { + if (branding_mismatch(acl_brand, prev_acl_brand)) { warnx("%s: branding mismatch; existing ACL is %s, " "entry to be removed is %s", filename, - prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e", - acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e"); + brand_name(prev_acl_brand), brand_name(acl_brand)); return (-1); } Modified: user/luigi/ipfw3-head/bin/setfacl/setfacl.h ============================================================================== --- user/luigi/ipfw3-head/bin/setfacl/setfacl.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/setfacl/setfacl.h Sun Dec 27 13:56:35 2009 (r201050) @@ -71,6 +71,8 @@ void remove_ext(acl_t *prev_acl, const int set_acl_mask(acl_t *prev_acl, const char *filename); /* util.c */ void *zmalloc(size_t size); +const char *brand_name(int brand); +int branding_mismatch(int brand1, int brand2); uint have_mask; uint need_mask; Modified: user/luigi/ipfw3-head/bin/setfacl/util.c ============================================================================== --- user/luigi/ipfw3-head/bin/setfacl/util.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/setfacl/util.c Sun Dec 27 13:56:35 2009 (r201050) @@ -43,3 +43,26 @@ zmalloc(size_t size) err(1, "calloc() failed"); return (ptr); } + +const char * +brand_name(int brand) +{ + switch (brand) { + case ACL_BRAND_NFS4: + return "NFSv4"; + case ACL_BRAND_POSIX: + return "POSIX.1e"; + default: + return "unknown"; + } +} + +int +branding_mismatch(int brand1, int brand2) +{ + if (brand1 == ACL_BRAND_UNKNOWN || brand2 == ACL_BRAND_UNKNOWN) + return (0); + if (brand1 != brand2) + return (1); + return (0); +} Modified: user/luigi/ipfw3-head/bin/sh/alias.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/alias.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/alias.c Sun Dec 27 13:56:35 2009 (r201050) @@ -52,13 +52,13 @@ __FBSDID("$FreeBSD$"); STATIC struct alias *atab[ATABSIZE]; STATIC int aliases; -STATIC void setalias(char *, char *); +STATIC void setalias(const char *, const char *); STATIC int unalias(const char *); STATIC struct alias **hashalias(const char *); STATIC void -setalias(char *name, char *val) +setalias(const char *name, const char *val) { struct alias *ap, **app; @@ -176,7 +176,7 @@ rmaliases(void) } struct alias * -lookupalias(char *name, int check) +lookupalias(const char *name, int check) { struct alias *ap = *hashalias(name); Modified: user/luigi/ipfw3-head/bin/sh/alias.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/alias.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/alias.h Sun Dec 27 13:56:35 2009 (r201050) @@ -42,7 +42,7 @@ struct alias { int flag; }; -struct alias *lookupalias(char *, int); +struct alias *lookupalias(const char *, int); int aliascmd(int, char **); int unaliascmd(int, char **); void rmaliases(void); Modified: user/luigi/ipfw3-head/bin/sh/arith.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/arith.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/arith.h Sun Dec 27 13:56:35 2009 (r201050) @@ -34,8 +34,8 @@ #define DIGITS(var) (3 + (2 + CHAR_BIT * sizeof((var))) / 3) -extern char *arith_buf, *arith_startbuf; +extern const char *arith_buf, *arith_startbuf; -arith_t arith(char *); +arith_t arith(const char *); void arith_lex_reset(void); int expcmd(int, char **); Modified: user/luigi/ipfw3-head/bin/sh/arith.y ============================================================================== --- user/luigi/ipfw3-head/bin/sh/arith.y Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/arith.y Sun Dec 27 13:56:35 2009 (r201050) @@ -265,7 +265,7 @@ expr: #define YYPARSE_PARAM_TYPE arith_t * #define YYPARSE_PARAM result -char *arith_buf, *arith_startbuf; +const char *arith_buf, *arith_startbuf; int yylex(void); int yyparse(YYPARSE_PARAM_TYPE); @@ -284,7 +284,7 @@ arith_assign(char *name, arith_t value) } arith_t -arith(char *s) +arith(const char *s) { arith_t result; @@ -299,7 +299,7 @@ arith(char *s) } static void -yyerror(char *s) +yyerror(const char *s) { yyerrok; @@ -354,7 +354,7 @@ main(int argc, char *argv[]) printf("%d\n", exp(argv[1])); } -error(char *s) +error(const char *s) { fprintf(stderr, "exp: %s\n", s); exit(1); Modified: user/luigi/ipfw3-head/bin/sh/cd.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/cd.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/cd.c Sun Dec 27 13:56:35 2009 (r201050) @@ -80,7 +80,7 @@ int cdcmd(int argc, char **argv) { char *dest; - char *path; + const char *path; char *p; struct stat statb; int ch, phys, print = 0; Modified: user/luigi/ipfw3-head/bin/sh/error.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/error.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/error.c Sun Dec 27 13:56:35 2009 (r201050) @@ -67,7 +67,7 @@ volatile sig_atomic_t intpending; char *commandname; -static void exverror(int, const char *, va_list) __printf0like(2, 0); +static void exverror(int, const char *, va_list) __printf0like(2, 0) __dead2; /* * Called to raise an exception. Since C doesn't include exceptions, we Modified: user/luigi/ipfw3-head/bin/sh/error.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/error.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/error.h Sun Dec 27 13:56:35 2009 (r201050) @@ -78,10 +78,10 @@ extern volatile sig_atomic_t intpending; #define CLEAR_PENDING_INT intpending = 0 #define int_pending() intpending -void exraise(int); +void exraise(int) __dead2; void onint(void); -void error(const char *, ...) __printf0like(1, 2); -void exerror(int, const char *, ...) __printf0like(2, 3); +void error(const char *, ...) __printf0like(1, 2) __dead2; +void exerror(int, const char *, ...) __printf0like(2, 3) __dead2; /* Modified: user/luigi/ipfw3-head/bin/sh/exec.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/exec.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/exec.c Sun Dec 27 13:56:35 2009 (r201050) @@ -98,7 +98,7 @@ int exerrno = 0; /* Last exec error */ STATIC void tryexec(char *, char **, char **); STATIC void printentry(struct tblentry *, int); -STATIC struct tblentry *cmdlookup(char *, int); +STATIC struct tblentry *cmdlookup(const char *, int); STATIC void delete_cmd_entry(void); @@ -109,7 +109,7 @@ STATIC void delete_cmd_entry(void); */ void -shellexec(char **argv, char **envp, char *path, int index) +shellexec(char **argv, char **envp, const char *path, int index) { char *cmdname; int e; @@ -175,13 +175,13 @@ tryexec(char *cmd, char **argv, char **e * NULL. */ -char *pathopt; +const char *pathopt; char * -padvance(char **path, char *name) +padvance(const char **path, const char *name) { - char *p, *q; - char *start; + const char *p, *start; + char *q; int len; if (*path == NULL) @@ -269,7 +269,7 @@ STATIC void printentry(struct tblentry *cmdp, int verbose) { int index; - char *path; + const char *path; char *name; if (cmdp->cmdtype == CMDNORMAL) { @@ -310,7 +310,8 @@ printentry(struct tblentry *cmdp, int ve */ void -find_command(char *name, struct cmdentry *entry, int printerr, char *path) +find_command(const char *name, struct cmdentry *entry, int printerr, + const char *path) { struct tblentry *cmdp; int index; @@ -446,7 +447,7 @@ success: */ int -find_builtin(char *name, int *special) +find_builtin(const char *name, int *special) { const struct builtincmd *bp; @@ -608,10 +609,10 @@ STATIC struct tblentry **lastcmdentry; STATIC struct tblentry * -cmdlookup(char *name, int add) +cmdlookup(const char *name, int add) { int hashval; - char *p; + const char *p; struct tblentry *cmdp; struct tblentry **pp; @@ -664,7 +665,7 @@ delete_cmd_entry(void) */ void -addcmdentry(char *name, struct cmdentry *entry) +addcmdentry(const char *name, struct cmdentry *entry) { struct tblentry *cmdp; @@ -684,7 +685,7 @@ addcmdentry(char *name, struct cmdentry */ void -defun(char *name, union node *func) +defun(const char *name, union node *func) { struct cmdentry entry; @@ -701,7 +702,7 @@ defun(char *name, union node *func) */ int -unsetfunc(char *name) +unsetfunc(const char *name) { struct tblentry *cmdp; @@ -767,7 +768,8 @@ typecmd_impl(int argc, char **argv, int switch (entry.cmdtype) { case CMDNORMAL: { if (strchr(argv[i], '/') == NULL) { - char *path = pathval(), *name; + const char *path = pathval(); + char *name; int j = entry.u.index; do { name = padvance(&path, argv[i]); Modified: user/luigi/ipfw3-head/bin/sh/exec.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/exec.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/exec.h Sun Dec 27 13:56:35 2009 (r201050) @@ -57,20 +57,20 @@ struct cmdentry { }; -extern char *pathopt; /* set by padvance */ +extern const char *pathopt; /* set by padvance */ extern int exerrno; /* last exec error */ -void shellexec(char **, char **, char *, int); -char *padvance(char **, char *); +void shellexec(char **, char **, const char *, int) __dead2; +char *padvance(const char **, const char *); int hashcmd(int, char **); -void find_command(char *, struct cmdentry *, int, char *); -int find_builtin(char *, int *); +void find_command(const char *, struct cmdentry *, int, const char *); +int find_builtin(const char *, int *); void hashcd(void); void changepath(const char *); void deletefuncs(void); -void addcmdentry(char *, struct cmdentry *); -void defun(char *, union node *); -int unsetfunc(char *); +void addcmdentry(const char *, struct cmdentry *); +void defun(const char *, union node *); +int unsetfunc(const char *); int typecmd_impl(int, char **, int); int typecmd(int, char **); void clearcmdentry(int); Modified: user/luigi/ipfw3-head/bin/sh/expand.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/expand.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/expand.c Sun Dec 27 13:56:35 2009 (r201050) @@ -107,7 +107,7 @@ STATIC void expmeta(char *, char *); STATIC void addfname(char *); STATIC struct strlist *expsort(struct strlist *); STATIC struct strlist *msort(struct strlist *, int); -STATIC int pmatch(char *, char *, int); +STATIC int pmatch(const char *, const char *, int); STATIC char *cvtnum(int, char *); STATIC int collate_range_cmp(int, int); @@ -271,8 +271,13 @@ exptilde(char *p, int flag) while ((c = *p) != '\0') { switch(c) { - case CTLESC: - return (startp); + case CTLESC: /* This means CTL* are always considered quoted. */ + case CTLVAR: + case CTLENDVAR: + case CTLBACKQ: + case CTLBACKQ | CTLQUOTE: + case CTLARI: + case CTLENDARI: case CTLQUOTEMARK: return (startp); case ':': @@ -1338,7 +1343,7 @@ msort(struct strlist *list, int len) */ int -patmatch(char *pattern, char *string, int squoted) +patmatch(const char *pattern, const char *string, int squoted) { #ifdef notdef if (pattern[0] == '!' && pattern[1] == '!') @@ -1350,9 +1355,9 @@ patmatch(char *pattern, char *string, in STATIC int -pmatch(char *pattern, char *string, int squoted) +pmatch(const char *pattern, const char *string, int squoted) { - char *p, *q; + const char *p, *q; char c; p = pattern; @@ -1400,7 +1405,7 @@ pmatch(char *pattern, char *string, int } while (*q++ != '\0'); return 0; case '[': { - char *endp; + const char *endp; int invert, found; char chr; @@ -1504,7 +1509,7 @@ rmescapes(char *str) */ int -casematch(union node *pattern, char *val) +casematch(union node *pattern, const char *val) { struct stackmark smark; int result; Modified: user/luigi/ipfw3-head/bin/sh/expand.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/expand.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/expand.h Sun Dec 27 13:56:35 2009 (r201050) @@ -58,7 +58,7 @@ union node; void expandhere(union node *, int); void expandarg(union node *, struct arglist *, int); void expari(int); -int patmatch(char *, char *, int); +int patmatch(const char *, const char *, int); void rmescapes(char *); -int casematch(union node *, char *); +int casematch(union node *, const char *); int wordexpcmd(int, char **); Modified: user/luigi/ipfw3-head/bin/sh/histedit.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/histedit.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/histedit.c Sun Dec 27 13:56:35 2009 (r201050) @@ -406,7 +406,7 @@ fc_replace(const char *s, char *p, char } int -not_fcnumber(char *s) +not_fcnumber(const char *s) { if (s == NULL) return (0); @@ -416,10 +416,10 @@ not_fcnumber(char *s) } int -str_to_event(char *str, int last) +str_to_event(const char *str, int last) { HistEvent he; - char *s = str; + const char *s = str; int relative = 0; int i, retval; Modified: user/luigi/ipfw3-head/bin/sh/input.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/input.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/input.c Sun Dec 27 13:56:35 2009 (r201050) @@ -401,7 +401,7 @@ popstring(void) */ void -setinputfile(char *fname, int push) +setinputfile(const char *fname, int push) { int fd; int fd2; Modified: user/luigi/ipfw3-head/bin/sh/input.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/input.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/input.h Sun Dec 27 13:56:35 2009 (r201050) @@ -54,7 +54,7 @@ int preadateof(void); void pungetc(void); void pushstring(char *, int, void *); void popstring(void); -void setinputfile(char *, int); +void setinputfile(const char *, int); void setinputfd(int, int); void setinputstring(char *, int); void popfile(void); Modified: user/luigi/ipfw3-head/bin/sh/jobs.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/jobs.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/jobs.c Sun Dec 27 13:56:35 2009 (r201050) @@ -757,6 +757,7 @@ forkshell(struct job *jp, union node *n, TRACE(("Child shell %d\n", (int)getpid())); wasroot = rootshell; rootshell = 0; + handler = &main_handler; closescript(); INTON; clear_traps(); Modified: user/luigi/ipfw3-head/bin/sh/mail.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/mail.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/mail.c Sun Dec 27 13:56:35 2009 (r201050) @@ -72,7 +72,7 @@ void chkmail(int silent) { int i; - char *mpath; + const char *mpath; char *p; char *q; struct stackmark smark; Modified: user/luigi/ipfw3-head/bin/sh/main.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/main.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/main.c Sun Dec 27 13:56:35 2009 (r201050) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); int rootpid; int rootshell; +struct jmploc main_handler; STATIC void read_profile(char *); STATIC char *find_dot_file(char *); @@ -90,14 +91,13 @@ STATIC char *find_dot_file(char *); int main(int argc, char *argv[]) { - struct jmploc jmploc; struct stackmark smark; volatile int state; char *shinit; (void) setlocale(LC_ALL, ""); state = 0; - if (setjmp(jmploc.loc)) { + if (setjmp(main_handler.loc)) { /* * When a shell procedure is executed, we raise the * exception EXSHELLPROC to clean up before executing @@ -143,7 +143,7 @@ main(int argc, char *argv[]) else goto state4; } - handler = &jmploc; + handler = &main_handler; #ifdef DEBUG opentrace(); trputs("Shell args: "); trargs(argv); @@ -269,7 +269,7 @@ read_profile(char *name) */ void -readcmdfile(char *name) +readcmdfile(const char *name) { int fd; @@ -296,7 +296,7 @@ find_dot_file(char *basename) { static char localname[FILENAME_MAX+1]; char *fullname; - char *path = pathval(); + const char *path = pathval(); struct stat statb; /* don't try this for absolute or relative paths */ Modified: user/luigi/ipfw3-head/bin/sh/main.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/main.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/main.h Sun Dec 27 13:56:35 2009 (r201050) @@ -35,8 +35,9 @@ extern int rootpid; /* pid of main shell */ extern int rootshell; /* true if we aren't a child of the main shell */ +extern struct jmploc main_handler; /* top level exception handler */ -void readcmdfile(char *); +void readcmdfile(const char *); void cmdloop(int); int dotcmd(int, char **); int exitcmd(int, char **); Modified: user/luigi/ipfw3-head/bin/sh/memalloc.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/memalloc.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/memalloc.c Sun Dec 27 13:56:35 2009 (r201050) @@ -95,7 +95,7 @@ ckfree(pointer p) */ char * -savestr(char *s) +savestr(const char *s) { char *p; Modified: user/luigi/ipfw3-head/bin/sh/memalloc.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/memalloc.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/memalloc.h Sun Dec 27 13:56:35 2009 (r201050) @@ -51,7 +51,7 @@ extern int herefd; pointer ckmalloc(size_t); pointer ckrealloc(pointer, int); void ckfree(pointer); -char *savestr(char *); +char *savestr(const char *); pointer stalloc(int); void stunalloc(pointer); void setstackmark(struct stackmark *); Modified: user/luigi/ipfw3-head/bin/sh/myhistedit.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/myhistedit.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/myhistedit.h Sun Dec 27 13:56:35 2009 (r201050) @@ -39,7 +39,7 @@ extern int displayhist; void histedit(void); void sethistsize(const char *); int histcmd(int, char **); -int not_fcnumber(char *); -int str_to_event(char *, int); +int not_fcnumber(const char *); +int str_to_event(const char *, int); int bindcmd(int, char **); Modified: user/luigi/ipfw3-head/bin/sh/options.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/options.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/options.c Sun Dec 27 13:56:35 2009 (r201050) @@ -554,9 +554,10 @@ out: */ int -nextopt(char *optstring) +nextopt(const char *optstring) { - char *p, *q; + char *p; + const char *q; char c; if ((p = optptr) == NULL || *p == '\0') { Modified: user/luigi/ipfw3-head/bin/sh/options.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/options.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/options.h Sun Dec 27 13:56:35 2009 (r201050) @@ -111,5 +111,5 @@ void freeparam(struct shparam *); int shiftcmd(int, char **); int setcmd(int, char **); int getoptscmd(int, char **); -int nextopt(char *); +int nextopt(const char *); void getoptsreset(const char *); Modified: user/luigi/ipfw3-head/bin/sh/output.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/output.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/output.c Sun Dec 27 13:56:35 2009 (r201050) @@ -314,7 +314,7 @@ doformat(struct output *dest, const char */ int -xwrite(int fd, char *buf, int nbytes) +xwrite(int fd, const char *buf, int nbytes) { int ntry; int i; Modified: user/luigi/ipfw3-head/bin/sh/output.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/output.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/output.h Sun Dec 27 13:56:35 2009 (r201050) @@ -52,7 +52,6 @@ extern struct output memout; extern struct output *out1; extern struct output *out2; -void open_mem(char *, int, struct output *); void out1str(const char *); void out1qstr(const char *); void out2str(const char *); @@ -68,7 +67,7 @@ void out1fmt(const char *, ...) __printf void out2fmt_flush(const char *, ...) __printflike(1, 2); void fmtstr(char *, int, const char *, ...) __printflike(3, 4); void doformat(struct output *, const char *, va_list) __printflike(2, 0); -int xwrite(int, char *, int); +int xwrite(int, const char *, int); #define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c))) #define out1c(c) outc(c, out1); Modified: user/luigi/ipfw3-head/bin/sh/parser.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/parser.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/parser.c Sun Dec 27 13:56:35 2009 (r201050) @@ -1510,9 +1510,9 @@ noexpand(char *text) */ int -goodname(char *name) +goodname(const char *name) { - char *p; + const char *p; p = name; if (! is_name(*p)) Modified: user/luigi/ipfw3-head/bin/sh/parser.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/parser.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/parser.h Sun Dec 27 13:56:35 2009 (r201050) @@ -77,5 +77,5 @@ extern int whichprompt; /* 1 == PS1, 2 union node *parsecmd(int); void fixredir(union node *, const char *, int); -int goodname(char *); +int goodname(const char *); char *getprompt(void *); Modified: user/luigi/ipfw3-head/bin/sh/show.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/show.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/show.c Sun Dec 27 13:56:35 2009 (r201050) @@ -307,7 +307,7 @@ sh_trace(const char *fmt, ...) void -trputs(char *s) +trputs(const char *s) { if (tracefile == NULL) return; Modified: user/luigi/ipfw3-head/bin/sh/show.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/show.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/show.h Sun Dec 27 13:56:35 2009 (r201050) @@ -35,6 +35,6 @@ void showtree(union node *); void sh_trace(const char *, ...) __printflike(1, 2); void trargs(char **); void trputc(int); -void trputs(char *); +void trputs(const char *); void opentrace(void); #endif Modified: user/luigi/ipfw3-head/bin/sh/trap.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/trap.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/trap.h Sun Dec 27 13:56:35 2009 (r201050) @@ -45,4 +45,4 @@ void ignoresig(int); void onsig(int); void dotrap(void); void setinteractive(int); -void exitshell(int); +void exitshell(int) __dead2; Modified: user/luigi/ipfw3-head/bin/sh/var.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/var.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/var.c Sun Dec 27 13:56:35 2009 (r201050) @@ -122,9 +122,9 @@ STATIC const struct varinit varinit[] = STATIC struct var *vartab[VTABSIZE]; -STATIC struct var **hashvar(char *); -STATIC int varequal(char *, char *); -STATIC int localevar(char *); +STATIC struct var **hashvar(const char *); +STATIC int varequal(const char *, const char *); +STATIC int localevar(const char *); /* * Initialize the variable symbol tables and import the environment. @@ -190,7 +190,7 @@ initvar(void) */ int -setvarsafe(char *name, char *val, int flags) +setvarsafe(const char *name, const char *val, int flags) { struct jmploc jmploc; struct jmploc *const savehandler = handler; @@ -215,9 +215,9 @@ setvarsafe(char *name, char *val, int fl */ void -setvar(char *name, char *val, int flags) +setvar(const char *name, const char *val, int flags) { - char *p, *q; + const char *p; int len; int namelen; char *nameeq; @@ -245,19 +245,18 @@ setvar(char *name, char *val, int flags) } else { len += strlen(val); } - p = nameeq = ckmalloc(len); - q = name; - while (--namelen >= 0) - *p++ = *q++; - *p++ = '='; - *p = '\0'; + nameeq = ckmalloc(len); + memcpy(nameeq, name, namelen); + nameeq[namelen] = '='; if (val) - scopy(val, p); + scopy(val, nameeq + namelen + 1); + else + nameeq[namelen + 1] = '\0'; setvareq(nameeq, flags); } STATIC int -localevar(char *s) +localevar(const char *s) { static char *lnames[7] = { "ALL", "COLLATE", "CTYPE", "MONETARY", @@ -283,7 +282,7 @@ localevar(char *s) * pointer into environ where the string should not be manipulated. */ static void -change_env(char *s, int set) +change_env(const char *s, int set) { char *eqp; char *ss; @@ -389,7 +388,7 @@ listsetvar(struct strlist *list) */ char * -lookupvar(char *name) +lookupvar(const char *name) { struct var *v; @@ -412,7 +411,7 @@ lookupvar(char *name) */ char * -bltinlookup(char *name, int doall) +bltinlookup(const char *name, int doall) { struct strlist *sp; struct var *v; @@ -796,7 +795,7 @@ unsetcmd(int argc __unused, char **argv */ int -unsetvar(char *s) +unsetvar(const char *s) { struct var **vpp; struct var *vp; @@ -836,7 +835,7 @@ unsetvar(char *s) */ STATIC struct var ** -hashvar(char *p) +hashvar(const char *p) { unsigned int hashval; @@ -855,7 +854,7 @@ hashvar(char *p) */ STATIC int -varequal(char *p, char *q) +varequal(const char *p, const char *q) { while (*p == *q++) { if (*p++ == '=') Modified: user/luigi/ipfw3-head/bin/sh/var.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/var.h Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/bin/sh/var.h Sun Dec 27 13:56:35 2009 (r201050) @@ -101,12 +101,12 @@ extern struct var vhistsize; #define mpathset() ((vmpath.flags & VUNSET) == 0) void initvar(void); -void setvar(char *, char *, int); +void setvar(const char *, const char *, int); void setvareq(char *, int); struct strlist; void listsetvar(struct strlist *); -char *lookupvar(char *); -char *bltinlookup(char *, int); +char *lookupvar(const char *); +char *bltinlookup(const char *, int); char **environment(void); void shprocvar(void); int showvarscmd(int, char **); @@ -116,5 +116,5 @@ void mklocal(char *); void poplocalvars(void); int setvarcmd(int, char **); int unsetcmd(int, char **); -int unsetvar(char *); -int setvarsafe(char *, char *, int); +int unsetvar(const char *); +int setvarsafe(const char *, const char *, int); Modified: user/luigi/ipfw3-head/contrib/telnet/telnetd/sys_term.c ============================================================================== --- user/luigi/ipfw3-head/contrib/telnet/telnetd/sys_term.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/contrib/telnet/telnetd/sys_term.c Sun Dec 27 13:56:35 2009 (r201050) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "telnetd.h" #include "pathnames.h" @@ -55,19 +54,6 @@ __FBSDID("$FreeBSD$"); int cleanopen(char *); void scrub_env(void); -struct utmp wtmp; - -#ifdef _PATH_WTMP -char wtmpf[] = _PATH_WTMP; -#else -char wtmpf[] = "/var/log/wtmp"; -#endif -#ifdef _PATH_UTMP -char utmpf[] = _PATH_UTMP; -#else -char utmpf[] = "/var/run/utmp"; -#endif - char *envinit[3]; extern char **environ; Modified: user/luigi/ipfw3-head/contrib/top/username.c ============================================================================== --- user/luigi/ipfw3-head/contrib/top/username.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/contrib/top/username.c Sun Dec 27 13:56:35 2009 (r201050) @@ -30,17 +30,17 @@ * This makes the table size independent of the passwd file size. */ +#include #include #include #include -#include #include "top.local.h" #include "utils.h" struct hash_el { int uid; - char name[UT_NAMESIZE + 1]; + char name[MAXLOGNAME]; }; #define is_empty_hash(x) (hash_table[x].name[0] == 0) @@ -129,7 +129,7 @@ int wecare; /* 1 = enter it always, 0 = /* empty or wrong slot -- fill it with new value */ hash_table[hashindex].uid = uid; - (void) strncpy(hash_table[hashindex].name, name, UT_NAMESIZE); + (void) strncpy(hash_table[hashindex].name, name, MAXLOGNAME - 1); return(hashindex); } Modified: user/luigi/ipfw3-head/etc/rc.subr ============================================================================== --- user/luigi/ipfw3-head/etc/rc.subr Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/etc/rc.subr Sun Dec 27 13:56:35 2009 (r201050) @@ -738,7 +738,7 @@ $command $rc_flags $command_args" if [ -n "$_nice" ]; then if [ -z "$_user" ]; then _doit="sh -c \"$_doit\"" - fi + fi _doit="nice -n $_nice $_doit" fi fi @@ -958,10 +958,11 @@ _run_rc_killcmd() # # run_rc_script file arg # Start the script `file' with `arg', and correctly handle the -# return value from the script. If `file' ends with `.sh', it's -# sourced into the current environment. If `file' appears to be -# a backup or scratch file, ignore it. Otherwise if it's -# executable run as a child process. +# return value from the script. +# If `file' ends with `.sh', it's sourced into the current environment +# when $rc_fast_and_loose is set, otherwise it is run as a child process. +# If `file' appears to be a backup or scratch file, ignore it. +# Otherwise if it is executable run as a child process. # run_rc_script() { @@ -1063,7 +1064,7 @@ load_rc_config() esac done } - + # # load_rc_config_var name var # Read the rc.conf(5) var for name and set in the Modified: user/luigi/ipfw3-head/lib/libc/posix1e/acl_delete_entry.c ============================================================================== --- user/luigi/ipfw3-head/lib/libc/posix1e/acl_delete_entry.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/lib/libc/posix1e/acl_delete_entry.c Sun Dec 27 13:56:35 2009 (r201050) @@ -75,6 +75,7 @@ int acl_delete_entry(acl_t acl, acl_entry_t entry_d) { struct acl *acl_int; + struct acl_entry entry_int; int i, j, found = 0; if (acl == NULL || entry_d == NULL) { @@ -94,8 +95,12 @@ acl_delete_entry(acl_t acl, acl_entry_t errno = EINVAL; return (-1); } + + /* Use a local copy to prevent deletion of more than this entry */ + entry_int = *entry_d; + for (i = 0; i < acl->ats_acl.acl_cnt;) { - if (_entry_matches(&(acl->ats_acl.acl_entry[i]), entry_d)) { + if (_entry_matches(&(acl->ats_acl.acl_entry[i]), &entry_int)) { /* ...shift the remaining entries... */ for (j = i; j < acl->ats_acl.acl_cnt - 1; ++j) acl->ats_acl.acl_entry[j] = Modified: user/luigi/ipfw3-head/lib/libpam/modules/pam_lastlog/pam_lastlog.c ============================================================================== --- user/luigi/ipfw3-head/lib/libpam/modules/pam_lastlog/pam_lastlog.c Sun Dec 27 13:23:14 2009 (r201049) +++ user/luigi/ipfw3-head/lib/libpam/modules/pam_lastlog/pam_lastlog.c Sun Dec 27 13:56:35 2009 (r201050) @@ -91,7 +91,7 @@ pam_sm_open_session(pam_handle_t *pamh, } if ((flags & PAM_SILENT) == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 18:20:51 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5922D106568B; Sun, 27 Dec 2009 18:20:51 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4972B8FC17; Sun, 27 Dec 2009 18:20:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBRIKpK7063471; Sun, 27 Dec 2009 18:20:51 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBRIKpJd063469; Sun, 27 Dec 2009 18:20:51 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912271820.nBRIKpJd063469@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 27 Dec 2009 18:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201054 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 18:20:51 -0000 Author: luigi Date: Sun Dec 27 18:20:51 2009 New Revision: 201054 URL: http://svn.freebsd.org/changeset/base/201054 Log: use DIR_DROP for explicit packet drops Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Dec 27 18:04:05 2009 (r201053) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Dec 27 18:20:51 2009 (r201054) @@ -551,7 +551,6 @@ transmit_event(struct dn_pipe *pipe, str } #define div64(a, b) ((int64_t)(a) / (int64_t)(b)) -#define DN_TO_DROP 0xffff /* * Compute how many ticks we have to wait before being able to send * a packet. This is computed as the "wire time" for the packet @@ -596,7 +595,7 @@ compute_extra_bits(struct mbuf *pkt, str if (index >= p->loss_level) { struct dn_pkt_tag *dt = dn_tag_get(pkt); if (dt) - dt->dn_dir = DN_TO_DROP; + dt->dn_dir = DIR_DROP; } return extra_bits; } @@ -979,7 +978,7 @@ dummynet_send(struct mbuf *m) m->m_nextpkt = NULL; if (m_tag_first(m) == NULL) { pkt = NULL; /* probably unnecessary */ - dst = DN_TO_DROP; + dst = DIR_DROP; } else { pkt = dn_tag_get(m); dst = pkt->dn_dir; @@ -1031,7 +1030,7 @@ dummynet_send(struct mbuf *m) ether_output_frame(pkt->ifp, m); break; - case DN_TO_DROP: + case DIR_DROP: /* drop the packet after some time */ dn_free_pkt(m); break; From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 18:25:44 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 516021065693; Sun, 27 Dec 2009 18:25:44 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34DFB8FC08; Sun, 27 Dec 2009 18:25:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBRIPi44063597; Sun, 27 Dec 2009 18:25:44 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBRIPijI063594; Sun, 27 Dec 2009 18:25:44 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912271825.nBRIPijI063594@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 27 Dec 2009 18:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201055 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 18:25:44 -0000 Author: luigi Date: Sun Dec 27 18:25:44 2009 New Revision: 201055 URL: http://svn.freebsd.org/changeset/base/201055 Log: remove some duplicated code in ip_fw_pfil. The input and output processing uses almost exactly the same code so there is no need to use two separate hooks. ip_fw_pfil.o goes from 2096 to 1382 bytes of .text Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 18:20:51 2009 (r201054) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 18:25:44 2009 (r201055) @@ -81,7 +81,7 @@ ip_divert_packet_t *ip_divert_ptr = NULL ng_ipfw_input_t *ng_ipfw_input_p = NULL; /* Forward declarations. */ -static int ipfw_divert(struct mbuf **, int, int); +static void ipfw_divert(struct mbuf **, int, int); #ifdef SYSCTL_NODE SYSCTL_DECL(_net_inet_ip_fw); @@ -96,162 +96,32 @@ SYSCTL_VNET_PROC(_net_inet6_ip6_fw, OID_ #endif /* INET6 */ #endif /* SYSCTL_NODE */ -int -ipfw_check_in(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, - struct inpcb *inp) -{ - struct ip_fw_args args; - struct ng_ipfw_tag *ng_tag; - struct m_tag *dn_tag; - int ipfw = 0; - int divert; - int tee; -#ifdef IPFIREWALL_FORWARD - struct m_tag *fwd_tag; -#endif - - KASSERT(dir == PFIL_IN, ("ipfw_check_in wrong direction!")); - - bzero(&args, sizeof(args)); - - ng_tag = (struct ng_ipfw_tag *)m_tag_locate(*m0, NGM_IPFW_COOKIE, 0, - NULL); - if (ng_tag != NULL) { - KASSERT(ng_tag->dir == DIR_IN, - ("ng_ipfw tag with wrong direction")); - args.slot = ng_tag->slot; - args.rulenum = ng_tag->rulenum; - args.rule_id = ng_tag->rule_id; - args.chain_id = ng_tag->chain_id; - m_tag_delete(*m0, (struct m_tag *)ng_tag); - } - -again: - dn_tag = m_tag_find(*m0, PACKET_TAG_DUMMYNET, NULL); - if (dn_tag != NULL){ - struct dn_pkt_tag *dt; - - dt = (struct dn_pkt_tag *)(dn_tag+1); - args.slot = dt->slot; - args.rulenum = dt->rulenum; - args.rule_id = dt->rule_id; - args.chain_id = dt->chain_id; - m_tag_delete(*m0, dn_tag); - } - - args.m = *m0; - args.inp = inp; - tee = 0; - - if (V_fw_one_pass == 0 || args.slot == 0) { - ipfw = ipfw_chk(&args); - *m0 = args.m; - } else - ipfw = IP_FW_PASS; - - KASSERT(*m0 != NULL || ipfw == IP_FW_DENY, ("%s: m0 is NULL", - __func__)); - - switch (ipfw) { - case IP_FW_PASS: - if (args.next_hop == NULL) - goto pass; - -#ifdef IPFIREWALL_FORWARD - fwd_tag = m_tag_get(PACKET_TAG_IPFORWARD, - sizeof(struct sockaddr_in), M_NOWAIT); - if (fwd_tag == NULL) - goto drop; - bcopy(args.next_hop, (fwd_tag+1), sizeof(struct sockaddr_in)); - m_tag_prepend(*m0, fwd_tag); - - if (in_localip(args.next_hop->sin_addr)) - (*m0)->m_flags |= M_FASTFWD_OURS; - goto pass; -#endif - break; /* not reached */ - - case IP_FW_DENY: - goto drop; - break; /* not reached */ - - case IP_FW_DUMMYNET: - if (ip_dn_io_ptr == NULL) - goto drop; - if (mtod(*m0, struct ip *)->ip_v == 4) - ip_dn_io_ptr(m0, DIR_IN, &args); - else if (mtod(*m0, struct ip *)->ip_v == 6) - ip_dn_io_ptr(m0, DIR_IN | PROTO_IPV6, &args); - if (*m0 != NULL) - goto again; - return 0; /* packet consumed */ - - case IP_FW_TEE: - tee = 1; - /* fall through */ - - case IP_FW_DIVERT: - divert = ipfw_divert(m0, DIR_IN, tee); - if (divert) { - *m0 = NULL; - return 0; /* packet consumed */ - } else { - args.slot = 0; - goto again; /* continue with packet */ - } - - case IP_FW_NGTEE: - if (!NG_IPFW_LOADED) - goto drop; - (void)ng_ipfw_input_p(m0, DIR_IN, &args, 1); - goto again; /* continue with packet */ - - case IP_FW_NETGRAPH: - if (!NG_IPFW_LOADED) - goto drop; - return ng_ipfw_input_p(m0, DIR_IN, &args, 0); - - case IP_FW_NAT: - goto again; /* continue with packet */ - - case IP_FW_REASS: - goto again; - - default: - KASSERT(0, ("%s: unknown retval", __func__)); - } - -drop: - if (*m0) - m_freem(*m0); - *m0 = NULL; - return (EACCES); -pass: - return 0; /* not filtered */ -} - -int -ipfw_check_out(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, +/* + * The pfilter hook to pass packets to ipfw_chk and then to + * dummynet, divert, netgraph or other modules. + * The packet may be consumed. + */ +static int +ipfw_check_hook(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, struct inpcb *inp) { struct ip_fw_args args; struct ng_ipfw_tag *ng_tag; struct m_tag *dn_tag; int ipfw; - int divert; - int tee; + int ret; #ifdef IPFIREWALL_FORWARD struct m_tag *fwd_tag; #endif - KASSERT(dir == PFIL_OUT, ("ipfw_check_out wrong direction!")); - + /* convert dir to IPFW values */ + dir = (dir == PFIL_IN) ? DIR_IN : DIR_OUT; bzero(&args, sizeof(args)); ng_tag = (struct ng_ipfw_tag *)m_tag_locate(*m0, NGM_IPFW_COOKIE, 0, NULL); if (ng_tag != NULL) { - KASSERT(ng_tag->dir == DIR_OUT, + KASSERT(ng_tag->dir == dir, ("ng_ipfw tag with wrong direction")); args.slot = ng_tag->slot; args.rulenum = ng_tag->rulenum; @@ -274,9 +144,8 @@ again: } args.m = *m0; - args.oif = ifp; + args.oif = dir == DIR_OUT ? ifp : NULL; args.inp = inp; - tee = 0; if (V_fw_one_pass == 0 || args.slot == 0) { ipfw = ipfw_chk(&args); @@ -287,150 +156,167 @@ again: KASSERT(*m0 != NULL || ipfw == IP_FW_DENY, ("%s: m0 is NULL", __func__)); + /* breaking out of the switch means drop */ + ret = 0; /* default return value for pass */ switch (ipfw) { case IP_FW_PASS: + /* next_hop may be set by ipfw_chk */ if (args.next_hop == NULL) - goto pass; -#ifdef IPFIREWALL_FORWARD - /* Overwrite existing tag. */ - fwd_tag = m_tag_find(*m0, PACKET_TAG_IPFORWARD, NULL); - if (fwd_tag == NULL) { + break; /* pass */ +#ifndef IPFIREWALL_FORWARD + ret = EACCES; +#else + /* Incoming packets should not be tagged so we do not + * m_tag_find. Outgoing packets may be tagged, so we + * reuse the tag if present. + */ + fwd_tag = (dir == DIR_IN) ? NULL : + m_tag_find(*m0, PACKET_TAG_IPFORWARD, NULL); + if (fwd_tag != NULL) { + m_tag_unlink(*m0, fwd_tag); + } else { fwd_tag = m_tag_get(PACKET_TAG_IPFORWARD, sizeof(struct sockaddr_in), M_NOWAIT); - if (fwd_tag == NULL) - goto drop; - } else - m_tag_unlink(*m0, fwd_tag); + if (fwd_tag == NULL) { + ret = EACCES; + break; /* i.e. drop */ + } + } bcopy(args.next_hop, (fwd_tag+1), sizeof(struct sockaddr_in)); m_tag_prepend(*m0, fwd_tag); if (in_localip(args.next_hop->sin_addr)) (*m0)->m_flags |= M_FASTFWD_OURS; - goto pass; #endif - break; /* not reached */ + break; case IP_FW_DENY: - goto drop; - break; /* not reached */ + ret = EACCES; + break; /* i.e. drop */ case IP_FW_DUMMYNET: + ret = EACCES; if (ip_dn_io_ptr == NULL) - break; + break; /* i.e. drop */ if (mtod(*m0, struct ip *)->ip_v == 4) - ip_dn_io_ptr(m0, DIR_OUT, &args); + ret = ip_dn_io_ptr(m0, dir, &args); else if (mtod(*m0, struct ip *)->ip_v == 6) - ip_dn_io_ptr(m0, DIR_OUT | PROTO_IPV6, &args); + ret = ip_dn_io_ptr(m0, dir | PROTO_IPV6, &args); + else + break; /* drop it */ + /* + * XXX should read the return value. + * dummynet normally eats the packet and sets *m0=NULL + * unless the packet can be sent immediately. In this + * case args is updated and we should re-run the + * check without clearing args. + */ if (*m0 != NULL) goto again; - return 0; /* packet consumed */ - break; case IP_FW_TEE: - tee = 1; - /* fall through */ - case IP_FW_DIVERT: - divert = ipfw_divert(m0, DIR_OUT, tee); - if (divert) { - *m0 = NULL; - return 0; /* packet consumed */ - } else { + if (ip_divert_ptr == NULL) { + ret = EACCES; + break; /* i.e. drop */ + } + ipfw_divert(m0, dir, (ipfw == IP_FW_TEE) ? 1 : 0); + if (*m0) { + /* continue processing for this one. We set + * args.slot=0, but the divert tag is processed + * in ipfw_chk to jump to the right place. + */ args.slot = 0; goto again; /* continue with packet */ } + break; case IP_FW_NGTEE: - if (!NG_IPFW_LOADED) - goto drop; - (void)ng_ipfw_input_p(m0, DIR_OUT, &args, 1); - goto again; /* continue with packet */ - case IP_FW_NETGRAPH: - if (!NG_IPFW_LOADED) - goto drop; - return ng_ipfw_input_p(m0, DIR_OUT, &args, 0); + if (!NG_IPFW_LOADED) { + ret = EACCES; + break; /* i.e. drop */ + } + ret = ng_ipfw_input_p(m0, dir, &args, + (ipfw == IP_FW_NGTEE) ? 1 : 0); + if (ipfw == IP_FW_NGTEE) /* ignore errors for NGTEE */ + goto again; /* continue with packet */ + break; case IP_FW_NAT: - goto again; /* continue with packet */ - case IP_FW_REASS: - goto again; + goto again; /* continue with packet */ default: KASSERT(0, ("%s: unknown retval", __func__)); } -drop: - if (*m0) - m_freem(*m0); - *m0 = NULL; - return (EACCES); -pass: - return 0; /* not filtered */ + if (ret != 0) { + if (*m0) + m_freem(*m0); + *m0 = NULL; + } + return ret; } -static int -ipfw_divert(struct mbuf **m, int incoming, int tee) +static void +ipfw_divert(struct mbuf **m0, int incoming, int tee) { /* * ipfw_chk() has already tagged the packet with the divert tag. * If tee is set, copy packet and return original. * If not tee, consume packet and send it to divert socket. */ - struct mbuf *clone, *reass; + struct mbuf *clone; struct ip *ip; - int hlen; - - reass = NULL; - - /* Is divert module loaded? */ - if (ip_divert_ptr == NULL) - goto nodivert; /* Cloning needed for tee? */ - if (tee) { - clone = m_dup(*m, M_DONTWAIT); - /* In case m_dup was unable to allocate mbufs. */ + if (tee == 0) { + clone = *m0; /* use the original mbuf */ + *m0 = NULL; + } else { + clone = m_dup(*m0, M_DONTWAIT); + /* If we cannot duplicate the mbuf, we sacrifice the divert + * chain and continue with the tee-ed packet. + */ if (clone == NULL) - return 0; - } else - clone = *m; - + return; + } /* - * Divert listeners can only handle non-fragmented packets. - * However when tee is set we will *not* de-fragment the packets; - * Doing do would put the reassembly into double-jeopardy. On top - * of that someone doing a tee will probably want to get the packet - * in its original form. + * Divert listeners can normally handle non-fragmented packets, + * but we can only reass in the non-tee case. + * This means that listeners on a tee rule may get fragments, + * and have to live with that. + * Note that we now have the 'reass' ipfw option so if we care + * we can do it before a 'tee'. */ ip = mtod(clone, struct ip *); if (!tee && ip->ip_off & (IP_MF | IP_OFFMASK)) { + int hlen; + struct mbuf *reass; - /* Reassemble packet. */ - reass = ip_reass(clone); - + reass = ip_reass(clone); /* Reassemble packet. */ + if (reass == NULL) + return; + /* if reass = NULL then it was consumed by ip_reass */ /* * IP header checksum fixup after reassembly and leave header * in network byte order. */ - if (reass != NULL) { - ip = mtod(reass, struct ip *); - hlen = ip->ip_hl << 2; + ip = mtod(reass, struct ip *); + hlen = ip->ip_hl << 2; #ifndef HAVE_NET_IPLEN - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); + ip->ip_len = htons(ip->ip_len); + ip->ip_off = htons(ip->ip_off); #endif /* !HAVE_NET_IPLEN */ - ip->ip_sum = 0; - if (hlen == sizeof(struct ip)) - ip->ip_sum = in_cksum_hdr(ip); - else - ip->ip_sum = in_cksum(reass, hlen); - clone = reass; - } else - clone = NULL; + ip->ip_sum = 0; + if (hlen == sizeof(struct ip)) + ip->ip_sum = in_cksum_hdr(ip); + else + ip->ip_sum = in_cksum(reass, hlen); + clone = reass; } else { #ifndef HAVE_NET_IPLEN /* Convert header to network byte order. */ @@ -440,22 +326,7 @@ ipfw_divert(struct mbuf **m, int incomin } /* Do the dirty job... */ - if (clone && ip_divert_ptr != NULL) - ip_divert_ptr(clone, incoming); - - /* - * For tee we leave the divert tag attached to original packet. - * It will then continue rule evaluation after the tee rule. - */ - if (tee) - return 0; - - /* Packet diverted and consumed */ - return 1; - -nodivert: - m_freem(*m); - return 1; + ip_divert_ptr(clone, incoming); } /* @@ -475,8 +346,7 @@ ipfw_hook(int onoff, int pf) return ENOENT; fn = (onoff) ? pfil_add_hook : pfil_remove_hook; - (void)fn(ipfw_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh); - (void)fn(ipfw_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh); + (void)fn(ipfw_check_hook, NULL, PFIL_IN | PFIL_OUT | PFIL_WAITOK, pfh); return 0; } Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Sun Dec 27 18:20:51 2009 (r201054) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Sun Dec 27 18:25:44 2009 (r201055) @@ -126,12 +126,6 @@ enum { * Function definitions. */ -/* Firewall hooks */ -int ipfw_check_in(void *, struct mbuf **, struct ifnet *, - int, struct inpcb *inp); -int ipfw_check_out(void *, struct mbuf **, struct ifnet *, - int, struct inpcb *inp); - /* attach (arg = 1) or detach (arg = 0) hooks */ int ipfw_attach_hooks(int); #ifdef NOTYET From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 19:17:03 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ECD51065670; Sun, 27 Dec 2009 19:17:03 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E1F28FC0A; Sun, 27 Dec 2009 19:17:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBRJH3VZ064696; Sun, 27 Dec 2009 19:17:03 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBRJH3WH064688; Sun, 27 Dec 2009 19:17:03 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912271917.nBRJH3WH064688@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 27 Dec 2009 19:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201057 - in user/luigi/ipfw3-head/sys/netinet: . ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 19:17:03 -0000 Author: luigi Date: Sun Dec 27 19:17:03 2009 New Revision: 201057 URL: http://svn.freebsd.org/changeset/base/201057 Log: Historically, BSD keeps ip_len and ip_off in host format when doing layer 3 processing. This often requires to translate the format back and forth. I suppose the original motivation was to avoid carrying additional metadata, and/or save a couple of local variables to store off and len. My impression is that nowadays there are much bigger disadvantages: - many unnecessary writes to the mbuf, which make it harder to share the data, and also cause cache traffic; - visual clutter in the code; - portability problems, either across layers (e.g. we cannot use the same code to do deep packet inspection for L2 and L3 packets) or across operating systems; - potential source of confusion, because the format is different in different parts of the code. Eventually, I would like these fields to remain in network format across the lifetime of a packet, but this may take a long time, so let's see if we can find ways to at least make the switch easier. Here I define a couple of macros that do the format conversion back and forth. On BIG_ENDIAN machines, or when we will switch, they become no-ops. At the moment I am only using these macros in the ipfw code, I am not sure this is the best solution across the entire stack. #if (BYTE_ORDER == BIG_ENDIAN) || defined(HAVE_NET_IPLEN) #define SET_NET_IPLEN(p) do {} while (0) #define SET_HOST_IPLEN(p) do {} while (0) #else #define SET_NET_IPLEN(p) do { \ struct ip *h_ip = (p); \ h_ip->ip_len = htons(h_ip->ip_len); \ h_ip->ip_off = htons(h_ip->ip_off); \ } while (0) #define SET_HOST_IPLEN(p) do { \ struct ip *h_ip = (p); \ h_ip->ip_len = ntohs(h_ip->ip_len); \ h_ip->ip_off = ntohs(h_ip->ip_off); \ } while (0) #endif /* !HAVE_NET_IPLEN */ Modified: user/luigi/ipfw3-head/sys/netinet/in.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Modified: user/luigi/ipfw3-head/sys/netinet/in.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/in.h Sun Dec 27 18:32:44 2009 (r201056) +++ user/luigi/ipfw3-head/sys/netinet/in.h Sun Dec 27 19:17:03 2009 (r201057) @@ -734,6 +734,32 @@ void in_ifdetach(struct ifnet *); #define sintosa(sin) ((struct sockaddr *)(sin)) #define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) +/* + * Historically, BSD keeps ip_len and ip_off in host format + * when doing layer 3 processing, and this often requires + * to translate the format back and forth. + * To make the process explicit, we define a couple of macros + * that also take into account the fact that at some point + * we may want to keep those fields always in net format. + */ + +#if (BYTE_ORDER == BIG_ENDIAN) || defined(HAVE_NET_IPLEN) +#define SET_NET_IPLEN(p) do {} while (0) +#define SET_HOST_IPLEN(p) do {} while (0) +#else +#define SET_NET_IPLEN(p) do { \ + struct ip *h_ip = (p); \ + h_ip->ip_len = htons(h_ip->ip_len); \ + h_ip->ip_off = htons(h_ip->ip_off); \ + } while (0) + +#define SET_HOST_IPLEN(p) do { \ + struct ip *h_ip = (p); \ + h_ip->ip_len = ntohs(h_ip->ip_len); \ + h_ip->ip_off = ntohs(h_ip->ip_off); \ + } while (0) +#endif /* !HAVE_NET_IPLEN */ + #endif /* _KERNEL */ /* INET6 stuff */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Dec 27 18:32:44 2009 (r201056) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Sun Dec 27 19:17:03 2009 (r201057) @@ -990,10 +990,7 @@ dummynet_send(struct mbuf *m) break ; case DIR_IN : ip = mtod(m, struct ip *); -#ifndef HAVE_NET_IPLEN - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); -#endif /* !HAVE_NET_IPLEN */ + SET_NET_IPLEN(ip); netisr_dispatch(NETISR_IP, m); break; #ifdef INET6 Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Sun Dec 27 18:32:44 2009 (r201056) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Sun Dec 27 19:17:03 2009 (r201057) @@ -588,7 +588,7 @@ send_reject6(struct ip_fw_args *args, in * sends a reject message, consuming the mbuf passed as an argument. */ static void -send_reject(struct ip_fw_args *args, int code, int ip_len, struct ip *ip) +send_reject(struct ip_fw_args *args, int code, int iplen, struct ip *ip) { #if 0 @@ -602,13 +602,10 @@ send_reject(struct ip_fw_args *args, int m_adj(m, args->L3offset); #endif if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */ -#ifndef HAVE_NET_IPLEN /* We need the IP header in host order for icmp_error(). */ if (args->eh != NULL) { - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); + SET_HOST_IPLEN(ip); } -#endif /* !HAVE_NET_IPLEN */ icmp_error(args->m, ICMP_UNREACH, code, 0L, 0); } else if (args->f_id.proto == IPPROTO_TCP) { struct tcphdr *const tcp = @@ -850,12 +847,12 @@ ipfw_chk(struct ip_fw_args *args) * src_ip, dst_ip ip addresses, in NETWORK format. * Only valid for IPv4 packets. */ - u_int8_t proto; - u_int16_t src_port = 0, dst_port = 0; /* NOTE: host format */ + uint8_t proto; + uint16_t src_port = 0, dst_port = 0; /* NOTE: host format */ struct in_addr src_ip, dst_ip; /* NOTE: network format */ - u_int16_t ip_len=0; + uint16_t iplen=0; int pktlen; - u_int16_t etype = 0; /* Host order stored ether type */ + uint16_t etype = 0; /* Host order stored ether type */ /* * dyn_dir = MATCH_UNKNOWN when rules unchecked, @@ -1096,14 +1093,14 @@ do { \ #ifndef HAVE_NET_IPLEN if (args->eh == NULL) { /* on l3 these are in host format */ offset = ip->ip_off & IP_OFFMASK; - ip_len = ip->ip_len; + iplen = ip->ip_len; } else #endif /* !HAVE_NET_IPLEN */ { /* otherwise they are in net format */ offset = ntohs(ip->ip_off) & IP_OFFMASK; - ip_len = ntohs(ip->ip_len); + iplen = ntohs(ip->ip_len); } - pktlen = ip_len < pktlen ? ip_len : pktlen; + pktlen = iplen < pktlen ? iplen : pktlen; if (offset == 0) { switch (proto) { @@ -1517,7 +1514,7 @@ do { \ int i; if (cmd->opcode == O_IPLEN) - x = ip_len; + x = iplen; else if (cmd->opcode == O_IPTTL) x = ip->ip_ttl; else /* must be IPID */ @@ -1552,7 +1549,7 @@ do { \ int i; tcp = TCP(ulp); - x = ip_len - + x = iplen - ((ip->ip_hl + tcp->th_off) << 2); if (cmdlen == 1) { match = (cmd->arg1 == x); @@ -2025,7 +2022,7 @@ do { \ is_icmp_query(ICMP(ulp))) && !(m->m_flags & (M_BCAST|M_MCAST)) && !IN_MULTICAST(ntohl(dst_ip.s_addr))) { - send_reject(args, cmd->arg1, ip_len, ip); + send_reject(args, cmd->arg1, iplen, ip); m = args->m; } /* FALLTHROUGH */ @@ -2137,17 +2134,14 @@ do { \ /* if not fragmented, go to next rule */ if ((ip_off & (IP_MF | IP_OFFMASK)) == 0) break; -#ifndef HAVE_NET_IPLEN /* * ip_reass() expects len & off in host * byte order: fix them in case we come * from layer2. */ if (args->eh != NULL) { - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); + SET_HOST_IPLEN(ip); } -#endif /* !HAVE_NET_IPLEN */ args->m = m = ip_reass(m); @@ -2163,13 +2157,10 @@ do { \ ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; -#ifndef HAVE_NET_IPLEN /* revert len. & off to net format if needed */ if (args->eh != NULL) { - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); + SET_NET_IPLEN(ip); } -#endif /* !HAVE_NET_IPLEN */ ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c Sun Dec 27 18:32:44 2009 (r201056) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c Sun Dec 27 19:17:03 2009 (r201057) @@ -1002,7 +1002,7 @@ ipfw_send_pkt(struct mbuf *replyto, stru h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; h->ip_off = 0; -#ifdef HAVE_NET_IPLEN +#ifdef HAVE_NET_IPLEN /* XXX do we handle layer2 ? */ h->ip_len = htons(len); #else h->ip_len = len; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c Sun Dec 27 18:32:44 2009 (r201056) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c Sun Dec 27 19:17:03 2009 (r201057) @@ -165,22 +165,16 @@ ipfw_log(struct ip_fw *f, u_int hlen, st * more info in the header */ mh.mh_data = "DDDDDDSSSSSS\x08\x00"; -#ifndef HAVE_NET_IPLEN if (args->f_id.addr_type == 4) { /* restore wire format */ - ip->ip_off = ntohs(ip->ip_off); - ip->ip_len = ntohs(ip->ip_len); + SET_NET_IPLEN(ip); } -#endif /* !HAVE_NET_IPLEN */ } BPF_MTAP(log_if, (struct mbuf *)&mh); -#ifndef HAVE_NET_IPLEN if (args->eh == NULL && args->f_id.addr_type == 4) { /* restore host format */ - ip->ip_off = htons(ip->ip_off); - ip->ip_len = htons(ip->ip_len); + SET_HOST_IPLEN(ip); } -#endif /* !HAVE_NET_IPLEN */ #endif /* !WITHOUT_BPF */ return; } Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c Sun Dec 27 18:32:44 2009 (r201056) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c Sun Dec 27 19:17:03 2009 (r201057) @@ -219,12 +219,9 @@ ipfw_nat(struct ip_fw_args *args, struct return (IP_FW_DENY); } ip = mtod(mcl, struct ip *); -#ifndef HAVE_NET_IPLEN if (args->eh == NULL) { - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); + SET_NET_IPLEN(ip); } -#endif /* !HAVE_NET_IPLEN */ /* * XXX - Libalias checksum offload 'duct tape': @@ -334,12 +331,9 @@ ipfw_nat(struct ip_fw_args *args, struct } ip->ip_len = htons(ip->ip_len); } -#ifndef HAVE_NET_IPLEN if (args->eh == NULL) { - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); + SET_HOST_IPLEN(ip); } -#endif /* !HAVE_NET_IPLEN */ args->m = mcl; return (IP_FW_NAT); } Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 18:32:44 2009 (r201056) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 19:17:03 2009 (r201057) @@ -307,10 +307,7 @@ ipfw_divert(struct mbuf **m0, int incomi */ ip = mtod(reass, struct ip *); hlen = ip->ip_hl << 2; -#ifndef HAVE_NET_IPLEN - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); -#endif /* !HAVE_NET_IPLEN */ + SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); @@ -318,11 +315,8 @@ ipfw_divert(struct mbuf **m0, int incomi ip->ip_sum = in_cksum(reass, hlen); clone = reass; } else { -#ifndef HAVE_NET_IPLEN /* Convert header to network byte order. */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); -#endif /* !HAVE_NET_IPLEN */ + SET_NET_IPLEN(ip); } /* Do the dirty job... */ From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 20:41:18 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9C9210656AE for ; Sun, 27 Dec 2009 20:41:18 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outZ.internet-mail-service.net (outz.internet-mail-service.net [216.240.47.249]) by mx1.freebsd.org (Postfix) with ESMTP id A31A48FC2B for ; Sun, 27 Dec 2009 20:41:18 +0000 (UTC) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 992AB37BA0; Sun, 27 Dec 2009 12:41:30 -0800 (PST) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137]) by idiom.com (Postfix) with ESMTP id C5A5A2D6016; Sun, 27 Dec 2009 12:41:17 -0800 (PST) Message-ID: <4B37C66D.9040505@elischer.org> Date: Sun, 27 Dec 2009 12:41:17 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: Luigi Rizzo References: <200912271917.nBRJH3WH064688@svn.freebsd.org> In-Reply-To: <200912271917.nBRJH3WH064688@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r201057 - in user/luigi/ipfw3-head/sys/netinet: . ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 20:41:18 -0000 Luigi Rizzo wrote: > Author: luigi > Date: Sun Dec 27 19:17:03 2009 > New Revision: 201057 > URL: http://svn.freebsd.org/changeset/base/201057 > > Log: > Historically, BSD keeps ip_len and ip_off in host format when doing > layer 3 processing. This often requires to translate the format > back and forth. [...] > > Eventually, I would like these fields to remain in network format > across the lifetime of a packet, but this may take a long time, > so let's see if we can find ways to at least make the switch easier. > I think I'd go for this sooner than later. It's always annoyed me. From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 22:13:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE002106566B; Sun, 27 Dec 2009 22:13:19 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF0C78FC08; Sun, 27 Dec 2009 22:13:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBRMDJIE069045; Sun, 27 Dec 2009 22:13:19 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBRMDJAC069043; Sun, 27 Dec 2009 22:13:19 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912272213.nBRMDJAC069043@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 27 Dec 2009 22:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201063 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 22:13:19 -0000 Author: luigi Date: Sun Dec 27 22:13:19 2009 New Revision: 201063 URL: http://svn.freebsd.org/changeset/base/201063 Log: use a less obfuscated construct to call the hook/unhook functions Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 21:58:48 2009 (r201062) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 22:13:19 2009 (r201063) @@ -329,18 +329,17 @@ ipfw_divert(struct mbuf **m0, int incomi static int ipfw_hook(int onoff, int pf) { + const int arg = PFIL_IN | PFIL_OUT | PFIL_WAITOK; struct pfil_head *pfh; - int (*fn)(int (*pfil_func)(void *, struct mbuf **, - struct ifnet *, int, struct inpcb *), - void *, int, struct pfil_head *); - pfh = pfil_head_get(PFIL_TYPE_AF, pf); if (pfh == NULL) return ENOENT; - fn = (onoff) ? pfil_add_hook : pfil_remove_hook; - (void)fn(ipfw_check_hook, NULL, PFIL_IN | PFIL_OUT | PFIL_WAITOK, pfh); + if (onoff) + (void)pfil_add_hook(ipfw_check_hook, NULL, arg, pfh); + else + (void)pfil_remove_hook(ipfw_check_hook, NULL, arg, pfh); return 0; } From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 22:34:32 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C3D5106568B; Sun, 27 Dec 2009 22:34:32 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 393F48FC15; Sun, 27 Dec 2009 22:34:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBRMYWEb069546; Sun, 27 Dec 2009 22:34:32 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBRMYVmq069518; Sun, 27 Dec 2009 22:34:31 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912272234.nBRMYVmq069518@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 27 Dec 2009 22:34:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201065 - in user/luigi/ipfw3-head: bin/sh contrib/top release/picobsd/build release/picobsd/floppy.tree/etc release/picobsd/floppy.tree/sbin release/picobsd/qemu sys/conf sys/sparc64/p... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 22:34:32 -0000 Author: luigi Date: Sun Dec 27 22:34:31 2009 New Revision: 201065 URL: http://svn.freebsd.org/changeset/base/201065 Log: Merging r201049 through r201063 from HEAD Added: user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin/ user/luigi/ipfw3-head/release/picobsd/qemu/ - copied from r201063, head/release/picobsd/qemu/ user/luigi/ipfw3-head/sys/sparc64/pci/fire.c - copied unchanged from r201063, head/sys/sparc64/pci/fire.c user/luigi/ipfw3-head/sys/sparc64/pci/firereg.h - copied unchanged from r201063, head/sys/sparc64/pci/firereg.h user/luigi/ipfw3-head/sys/sparc64/pci/firevar.h - copied unchanged from r201063, head/sys/sparc64/pci/firevar.h Modified: user/luigi/ipfw3-head/bin/sh/arith.y user/luigi/ipfw3-head/bin/sh/cd.c user/luigi/ipfw3-head/bin/sh/eval.c user/luigi/ipfw3-head/bin/sh/eval.h user/luigi/ipfw3-head/bin/sh/exec.c user/luigi/ipfw3-head/bin/sh/expand.c user/luigi/ipfw3-head/bin/sh/histedit.c user/luigi/ipfw3-head/bin/sh/input.c user/luigi/ipfw3-head/bin/sh/jobs.c user/luigi/ipfw3-head/bin/sh/main.c user/luigi/ipfw3-head/bin/sh/miscbltin.c user/luigi/ipfw3-head/bin/sh/mkbuiltins user/luigi/ipfw3-head/bin/sh/mkinit.c user/luigi/ipfw3-head/bin/sh/mksyntax.c user/luigi/ipfw3-head/bin/sh/mystring.c user/luigi/ipfw3-head/bin/sh/options.c user/luigi/ipfw3-head/bin/sh/options.h user/luigi/ipfw3-head/bin/sh/parser.c user/luigi/ipfw3-head/bin/sh/parser.h user/luigi/ipfw3-head/bin/sh/var.c user/luigi/ipfw3-head/bin/sh/var.h user/luigi/ipfw3-head/release/picobsd/build/mfs.mtree user/luigi/ipfw3-head/release/picobsd/build/picobsd user/luigi/ipfw3-head/release/picobsd/floppy.tree/etc/master.passwd user/luigi/ipfw3-head/sys/conf/options.sparc64 user/luigi/ipfw3-head/usr.sbin/rwhod/Makefile user/luigi/ipfw3-head/usr.sbin/rwhod/rwhod.c user/luigi/ipfw3-head/usr.sbin/ypserv/ypinit.sh Directory Properties: user/luigi/ipfw3-head/ (props changed) user/luigi/ipfw3-head/cddl/contrib/opensolaris/ (props changed) user/luigi/ipfw3-head/contrib/bind9/ (props changed) user/luigi/ipfw3-head/contrib/cpio/ (props changed) user/luigi/ipfw3-head/contrib/csup/ (props changed) user/luigi/ipfw3-head/contrib/ee/ (props changed) user/luigi/ipfw3-head/contrib/expat/ (props changed) user/luigi/ipfw3-head/contrib/file/ (props changed) user/luigi/ipfw3-head/contrib/gdb/ (props changed) user/luigi/ipfw3-head/contrib/gdtoa/ (props changed) user/luigi/ipfw3-head/contrib/less/ (props changed) user/luigi/ipfw3-head/contrib/libpcap/ (props changed) user/luigi/ipfw3-head/contrib/ncurses/ (props changed) user/luigi/ipfw3-head/contrib/netcat/ (props changed) user/luigi/ipfw3-head/contrib/ntp/ (props changed) user/luigi/ipfw3-head/contrib/openbsm/ (props changed) user/luigi/ipfw3-head/contrib/openpam/ (props changed) user/luigi/ipfw3-head/contrib/pf/ (props changed) user/luigi/ipfw3-head/contrib/sendmail/ (props changed) user/luigi/ipfw3-head/contrib/tcpdump/ (props changed) user/luigi/ipfw3-head/contrib/tcsh/ (props changed) user/luigi/ipfw3-head/contrib/top/ (props changed) user/luigi/ipfw3-head/contrib/top/install-sh (props changed) user/luigi/ipfw3-head/contrib/wpa/ (props changed) user/luigi/ipfw3-head/crypto/openssh/ (props changed) user/luigi/ipfw3-head/crypto/openssl/ (props changed) user/luigi/ipfw3-head/lib/libc/ (props changed) user/luigi/ipfw3-head/lib/libc/stdtime/ (props changed) user/luigi/ipfw3-head/lib/libutil/ (props changed) user/luigi/ipfw3-head/sbin/ (props changed) user/luigi/ipfw3-head/sbin/ipfw/ (props changed) user/luigi/ipfw3-head/share/zoneinfo/ (props changed) user/luigi/ipfw3-head/sys/ (props changed) user/luigi/ipfw3-head/sys/amd64/include/xen/ (props changed) user/luigi/ipfw3-head/sys/cddl/contrib/opensolaris/ (props changed) user/luigi/ipfw3-head/sys/contrib/dev/acpica/ (props changed) user/luigi/ipfw3-head/sys/contrib/pf/ (props changed) user/luigi/ipfw3-head/sys/dev/xen/xenpci/ (props changed) user/luigi/ipfw3-head/usr.bin/csup/ (props changed) user/luigi/ipfw3-head/usr.bin/procstat/ (props changed) user/luigi/ipfw3-head/usr.sbin/zic/ (props changed) Modified: user/luigi/ipfw3-head/bin/sh/arith.y ============================================================================== --- user/luigi/ipfw3-head/bin/sh/arith.y Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/arith.y Sun Dec 27 22:34:31 2009 (r201065) @@ -314,7 +314,7 @@ yyerror(const char *s) int expcmd(int argc, char **argv) { - char *p; + const char *p; char *concat; char **ap; arith_t i; Modified: user/luigi/ipfw3-head/bin/sh/cd.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/cd.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/cd.c Sun Dec 27 22:34:31 2009 (r201065) @@ -79,7 +79,7 @@ STATIC char *cdcomppath; int cdcmd(int argc, char **argv) { - char *dest; + const char *dest; const char *path; char *p; struct stat statb; Modified: user/luigi/ipfw3-head/bin/sh/eval.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/eval.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/eval.c Sun Dec 27 22:34:31 2009 (r201065) @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); #endif -MKINIT int evalskip; /* set if we are skipping commands */ +int evalskip; /* set if we are skipping commands */ STATIC int skipcount; /* number of levels to skip */ MKINIT int loopnest; /* current loop nesting level */ int funcnest; /* depth of function calls */ @@ -407,8 +407,7 @@ evalsubshell(union node *n, int flags) flags &=~ EV_TESTED; redirect(n->nredir.redirect, 0); evaltree(n->nredir.n, flags | EV_EXIT); /* never returns */ - } - if (! backgnd) { + } else if (! backgnd) { INTOFF; exitstatus = waitforjob(jp, (int *)NULL); INTON; @@ -849,7 +848,7 @@ evalcommand(union node *cmd, int flags, listsetvar(cmdenviron); commandname = argv[0]; argptr = argv + 1; - optptr = NULL; /* initialize nextopt */ + nextopt_optptr = NULL; /* initialize nextopt */ builtin_flags = flags; exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv); flushall(); Modified: user/luigi/ipfw3-head/bin/sh/eval.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/eval.h Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/eval.h Sun Dec 27 22:34:31 2009 (r201065) @@ -35,6 +35,7 @@ extern char *commandname; /* currently executing command */ extern int exitstatus; /* exit status of last command */ +extern int oexitstatus; /* saved exit status */ extern struct strlist *cmdenviron; /* environment for builtin command */ Modified: user/luigi/ipfw3-head/bin/sh/exec.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/exec.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/exec.c Sun Dec 27 22:34:31 2009 (r201065) @@ -109,7 +109,7 @@ STATIC void delete_cmd_entry(void); */ void -shellexec(char **argv, char **envp, const char *path, int index) +shellexec(char **argv, char **envp, const char *path, int idx) { char *cmdname; int e; @@ -120,7 +120,7 @@ shellexec(char **argv, char **envp, cons } else { e = ENOENT; while ((cmdname = padvance(&path, argv[0])) != NULL) { - if (--index < 0 && pathopt == NULL) { + if (--idx < 0 && pathopt == NULL) { tryexec(cmdname, argv, envp); if (errno != ENOENT && errno != ENOTDIR) e = errno; @@ -268,17 +268,17 @@ hashcmd(int argc __unused, char **argv _ STATIC void printentry(struct tblentry *cmdp, int verbose) { - int index; + int idx; const char *path; char *name; if (cmdp->cmdtype == CMDNORMAL) { - index = cmdp->param.index; + idx = cmdp->param.index; path = pathval(); do { name = padvance(&path, cmdp->cmdname); stunalloc(name); - } while (--index >= 0); + } while (--idx >= 0); out1str(name); } else if (cmdp->cmdtype == CMDBUILTIN) { out1fmt("builtin %s", cmdp->cmdname); @@ -314,7 +314,7 @@ find_command(const char *name, struct cm const char *path) { struct tblentry *cmdp; - int index; + int idx; int prev; char *fullname; struct stat statb; @@ -354,11 +354,11 @@ find_command(const char *name, struct cm } e = ENOENT; - index = -1; + idx = -1; loop: while ((fullname = padvance(&path, name)) != NULL) { stunalloc(fullname); - index++; + idx++; if (pathopt) { if (prefix("builtin", pathopt)) { if ((i = find_builtin(name, &spec)) < 0) @@ -377,8 +377,8 @@ loop: } } /* if rehash, don't redo absolute path names */ - if (fullname[0] == '/' && index <= prev) { - if (index < prev) + if (fullname[0] == '/' && idx <= prev) { + if (idx < prev) goto loop; TRACE(("searchexec \"%s\": no change\n", name)); goto success; @@ -415,7 +415,7 @@ loop: INTOFF; cmdp = cmdlookup(name, 1); cmdp->cmdtype = CMDNORMAL; - cmdp->param.index = index; + cmdp->param.index = idx; INTON; goto success; } @@ -494,18 +494,18 @@ void changepath(const char *newval) { const char *old, *new; - int index; + int idx; int firstchange; int bltin; old = pathval(); new = newval; firstchange = 9999; /* assume no change */ - index = 0; + idx = 0; bltin = -1; for (;;) { if (*old != *new) { - firstchange = index; + firstchange = idx; if ((*old == '\0' && *new == ':') || (*old == ':' && *new == '\0')) firstchange++; @@ -514,9 +514,9 @@ changepath(const char *newval) if (*new == '\0') break; if (*new == '%' && bltin < 0 && prefix("builtin", new + 1)) - bltin = index; + bltin = idx; if (*new == ':') { - index++; + idx++; } new++, old++; } @@ -724,15 +724,14 @@ typecmd_impl(int argc, char **argv, int { struct cmdentry entry; struct tblentry *cmdp; - char **pp; + const char *const *pp; struct alias *ap; int i; - int error = 0; - extern char *const parsekwd[]; + int error1 = 0; for (i = 1; i < argc; i++) { /* First look at the keywords */ - for (pp = (char **)parsekwd; *pp; pp++) + for (pp = parsekwd; *pp; pp++) if (**pp == *argv[i] && equal(*pp, argv[i])) break; @@ -793,7 +792,7 @@ typecmd_impl(int argc, char **argv, int if (cmd != TYPECMD_SMALLV) outfmt(out2, "%s: %s\n", argv[i], strerror(errno)); - error |= 127; + error1 |= 127; } } break; @@ -818,11 +817,11 @@ typecmd_impl(int argc, char **argv, int default: if (cmd != TYPECMD_SMALLV) outfmt(out2, "%s: not found\n", argv[i]); - error |= 127; + error1 |= 127; break; } } - return error; + return error1; } /* Modified: user/luigi/ipfw3-head/bin/sh/expand.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/expand.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/expand.c Sun Dec 27 22:34:31 2009 (r201065) @@ -855,7 +855,6 @@ varvalue(char *name, int quoted, int sub int num; char *p; int i; - extern int oexitstatus; char sep; char **ap; char const *syntax; @@ -979,7 +978,7 @@ ifsbreakup(char *string, struct arglist char *start; char *p; char *q; - char *ifs; + const char *ifs; const char *ifsspc; int had_param_ch = 0; Modified: user/luigi/ipfw3-head/bin/sh/histedit.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/histedit.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/histedit.c Sun Dec 27 22:34:31 2009 (r201065) @@ -164,19 +164,19 @@ int histcmd(int argc, char **argv) { int ch; - char *editor = NULL; + const char *editor = NULL; HistEvent he; int lflg = 0, nflg = 0, rflg = 0, sflg = 0; int i, retval; - char *firststr, *laststr; + const char *firststr, *laststr; int first, last, direction; - char *pat = NULL, *repl; + char *pat = NULL, *repl = NULL; static int active = 0; struct jmploc jmploc; struct jmploc *savehandler; char editfilestr[PATH_MAX]; char *volatile editfile; - FILE *efp; + FILE *efp = NULL; int oldhistnum; if (hist == NULL) Modified: user/luigi/ipfw3-head/bin/sh/input.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/input.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/input.c Sun Dec 27 22:34:31 2009 (r201065) @@ -93,7 +93,7 @@ struct parsefile { int plinno = 1; /* input line number */ -MKINIT int parsenleft; /* copy of parsefile->nleft */ +int parsenleft; /* copy of parsefile->nleft */ MKINIT int parselleft; /* copy of parsefile->lleft */ char *parsenextc; /* copy of parsefile->nextc */ MKINIT struct parsefile basepf; /* top level input file */ @@ -111,9 +111,9 @@ static int preadfd(void); INCLUDE "input.h" INCLUDE "error.h" -INIT { - extern char basebuf[]; +MKINIT char basebuf[]; +INIT { basepf.nextc = basepf.buf = basebuf; } Modified: user/luigi/ipfw3-head/bin/sh/jobs.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/jobs.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/jobs.c Sun Dec 27 22:34:31 2009 (r201065) @@ -92,7 +92,7 @@ STATIC struct job *getjob(char *); STATIC pid_t dowait(int, struct job *); STATIC pid_t waitproc(int, int *); STATIC void cmdtxt(union node *); -STATIC void cmdputs(char *); +STATIC void cmdputs(const char *); #if JOBS STATIC void setcurjob(struct job *); STATIC void deljob(struct job *); @@ -1083,7 +1083,7 @@ cmdtxt(union node *n) { union node *np; struct nodelist *lp; - char *p; + const char *p; int i; char s[2]; @@ -1212,9 +1212,10 @@ redir: STATIC void -cmdputs(char *s) +cmdputs(const char *s) { - char *p, *q; + const char *p; + char *q; char c; int subtype = 0; Modified: user/luigi/ipfw3-head/bin/sh/main.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/main.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/main.c Sun Dec 27 22:34:31 2009 (r201065) @@ -77,7 +77,7 @@ int rootpid; int rootshell; struct jmploc main_handler; -STATIC void read_profile(char *); +STATIC void read_profile(const char *); STATIC char *find_dot_file(char *); /* @@ -248,7 +248,7 @@ cmdloop(int top) */ STATIC void -read_profile(char *name) +read_profile(const char *name) { int fd; @@ -334,8 +334,6 @@ dotcmd(int argc, char **argv) int exitcmd(int argc, char **argv) { - extern int oexitstatus; - if (stoppedjobs()) return 0; if (argc > 1) Modified: user/luigi/ipfw3-head/bin/sh/miscbltin.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/miscbltin.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/miscbltin.c Sun Dec 27 22:34:31 2009 (r201065) @@ -93,7 +93,7 @@ readcmd(int argc __unused, char **argv _ char c; int rflag; char *prompt; - char *ifs; + const char *ifs; char *p; int startword; int status; @@ -254,7 +254,7 @@ readcmd(int argc __unused, char **argv _ int -umaskcmd(int argc __unused, char **argv) +umaskcmd(int argc __unused, char **argv __unused) { char *ap; int mask; Modified: user/luigi/ipfw3-head/bin/sh/mkbuiltins ============================================================================== --- user/luigi/ipfw3-head/bin/sh/mkbuiltins Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/mkbuiltins Sun Dec 27 22:34:31 2009 (r201065) @@ -88,7 +88,7 @@ tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJ awk '{ printf "#define %s %d\n", $1, NR-1}' echo ' struct builtincmd { - char *name; + const char *name; int code; int special; }; Modified: user/luigi/ipfw3-head/bin/sh/mkinit.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/mkinit.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/mkinit.c Sun Dec 27 22:34:31 2009 (r201065) @@ -102,9 +102,9 @@ struct block { */ struct event { - char *name; /* name of event (e.g. INIT) */ - char *routine; /* name of routine called on event */ - char *comment; /* comment describing routine */ + const char *name; /* name of event (e.g. INIT) */ + const char *routine; /* name of routine called on event */ + const char *comment; /* comment describing routine */ struct text code; /* code for handling event */ }; @@ -140,7 +140,7 @@ struct event event[] = { }; -char *curfile; /* current file */ +const char *curfile; /* current file */ int linno; /* current line */ char *header_files[200]; /* list of header files */ struct text defines; /* #define statements */ @@ -148,20 +148,20 @@ struct text decls; /* declarations */ int amiddecls; /* for formatting */ -void readfile(char *); -int match(char *, char *); -int gooddefine(char *); -void doevent(struct event *, FILE *, char *); +void readfile(const char *); +int match(const char *, const char *); +int gooddefine(const char *); +void doevent(struct event *, FILE *, const char *); void doinclude(char *); void dodecl(char *, FILE *); void output(void); -void addstr(char *, struct text *); +void addstr(const char *, struct text *); void addchar(int, struct text *); void writetext(struct text *, FILE *); -FILE *ckfopen(char *, char *); +FILE *ckfopen(const char *, const char *); void *ckmalloc(size_t); -char *savestr(char *); -void error(char *); +char *savestr(const char *); +void error(const char *); #define equal(s1, s2) (strcmp(s1, s2) == 0) @@ -170,9 +170,9 @@ main(int argc __unused, char *argv[]) { char **ap; - header_files[0] = "\"shell.h\""; - header_files[1] = "\"mystring.h\""; - header_files[2] = "\"init.h\""; + header_files[0] = savestr("\"shell.h\""); + header_files[1] = savestr("\"mystring.h\""); + header_files[2] = savestr("\"init.h\""); for (ap = argv + 1 ; *ap ; ap++) readfile(*ap); output(); @@ -186,7 +186,7 @@ main(int argc __unused, char *argv[]) */ void -readfile(char *fname) +readfile(const char *fname) { FILE *fp; char line[1024]; @@ -230,9 +230,9 @@ readfile(char *fname) int -match(char *name, char *line) +match(const char *name, const char *line) { - char *p, *q; + const char *p, *q; p = name, q = line; while (*p) { @@ -246,9 +246,9 @@ match(char *name, char *line) int -gooddefine(char *line) +gooddefine(const char *line) { - char *p; + const char *p; if (! match("#define", line)) return 0; /* not a define */ @@ -269,11 +269,11 @@ gooddefine(char *line) void -doevent(struct event *ep, FILE *fp, char *fname) +doevent(struct event *ep, FILE *fp, const char *fname) { char line[1024]; int indent; - char *p; + const char *p; sprintf(line, "\n /* from %s: */\n", fname); addstr(line, &ep->code); @@ -407,7 +407,7 @@ output(void) */ void -addstr(char *s, struct text *text) +addstr(const char *s, struct text *text) { while (*s) { if (--text->nleft < 0) @@ -452,7 +452,7 @@ writetext(struct text *text, FILE *fp) } FILE * -ckfopen(char *file, char *mode) +ckfopen(const char *file, const char *mode) { FILE *fp; @@ -474,7 +474,7 @@ ckmalloc(size_t nbytes) } char * -savestr(char *s) +savestr(const char *s) { char *p; @@ -484,7 +484,7 @@ savestr(char *s) } void -error(char *msg) +error(const char *msg) { if (curfile != NULL) fprintf(stderr, "%s:%d: ", curfile, linno); Modified: user/luigi/ipfw3-head/bin/sh/mksyntax.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/mksyntax.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/mksyntax.c Sun Dec 27 22:34:31 2009 (r201065) @@ -55,8 +55,8 @@ __FBSDID("$FreeBSD$"); struct synclass { - char *name; - char *comment; + const char *name; + const char *comment; }; /* Syntax classes */ @@ -101,16 +101,16 @@ static char writer[] = "\ static FILE *cfile; static FILE *hfile; -static char *syntax[513]; +static const char *syntax[513]; static int base; static int size; /* number of values which a char variable can have */ static int nbits; /* number of bits in a character */ static int digit_contig;/* true if digits are contiguous */ -static void filltable(char *); +static void filltable(const char *); static void init(void); -static void add(char *, char *); -static void print(char *); +static void add(const char *, const char *); +static void print(const char *); static void output_type_macros(void); static void digit_convert(void); @@ -259,7 +259,7 @@ main(int argc __unused, char **argv __un */ static void -filltable(char *dftval) +filltable(const char *dftval) { int i; @@ -293,7 +293,7 @@ init(void) */ static void -add(char *p, char *type) +add(const char *p, const char *type) { while (*p) syntax[*p++ + base] = type; @@ -306,7 +306,7 @@ add(char *p, char *type) */ static void -print(char *name) +print(const char *name) { int i; int col; @@ -338,7 +338,7 @@ print(char *name) * contiguous, we can test for them quickly. */ -static char *macro[] = { +static const char *macro[] = { "#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)", "#define is_eof(c)\t((c) == PEOF)", "#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))", @@ -351,7 +351,7 @@ static char *macro[] = { static void output_type_macros(void) { - char **pp; + const char **pp; if (digit_contig) macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)"; Modified: user/luigi/ipfw3-head/bin/sh/mystring.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/mystring.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/mystring.c Sun Dec 27 22:34:31 2009 (r201065) @@ -108,7 +108,7 @@ int number(const char *s) { if (! is_number(s)) - error("Illegal number: %s", (char *)s); + error("Illegal number: %s", s); return atoi(s); } Modified: user/luigi/ipfw3-head/bin/sh/options.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/options.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/options.c Sun Dec 27 22:34:31 2009 (r201065) @@ -64,7 +64,7 @@ char *arg0; /* value of $0 */ struct shparam shellparam; /* current positional parameters */ char **argptr; /* argument list for builtin commands */ char *shoptarg; /* set by nextopt (like getopt) */ -char *optptr; /* used by nextopt */ +char *nextopt_optptr; /* used by nextopt */ char *minusc; /* argument to -c option */ @@ -560,7 +560,7 @@ nextopt(const char *optstring) const char *q; char c; - if ((p = optptr) == NULL || *p == '\0') { + if ((p = nextopt_optptr) == NULL || *p == '\0') { p = *argptr; if (p == NULL || *p != '-' || *++p == '\0') return '\0'; @@ -581,6 +581,6 @@ nextopt(const char *optstring) shoptarg = p; p = NULL; } - optptr = p; + nextopt_optptr = p; return c; } Modified: user/luigi/ipfw3-head/bin/sh/options.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/options.h Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/options.h Sun Dec 27 22:34:31 2009 (r201065) @@ -102,7 +102,7 @@ extern char *arg0; /* $0 */ extern struct shparam shellparam; /* $@ */ extern char **argptr; /* argument list for builtin commands */ extern char *shoptarg; /* set by nextopt */ -extern char *optptr; /* used by nextopt */ +extern char *nextopt_optptr; /* used by nextopt */ void procargs(int, char **); void optschanged(void); Modified: user/luigi/ipfw3-head/bin/sh/parser.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/parser.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/parser.c Sun Dec 27 22:34:31 2009 (r201065) @@ -113,7 +113,7 @@ STATIC int xxreadtoken(void); STATIC int readtoken1(int, char const *, char *, int); STATIC int noexpand(char *); STATIC void synexpect(int); -STATIC void synerror(char *); +STATIC void synerror(const char *); STATIC void setprompt(int); @@ -1547,7 +1547,7 @@ synexpect(int token) STATIC void -synerror(char *msg) +synerror(const char *msg) { if (commandname) outfmt(&errout, "%s: %d: ", commandname, startlinno); @@ -1579,13 +1579,14 @@ getprompt(void *unused __unused) static char ps[PROMPTLEN]; char *fmt; int i, j, trim; + static char internal_error[] = ""; /* * Select prompt format. */ switch (whichprompt) { case 0: - fmt = ""; + fmt = nullstr; break; case 1: fmt = ps1val(); @@ -1594,7 +1595,7 @@ getprompt(void *unused __unused) fmt = ps2val(); break; default: - return ""; + return internal_error; } /* Modified: user/luigi/ipfw3-head/bin/sh/parser.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/parser.h Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/parser.h Sun Dec 27 22:34:31 2009 (r201065) @@ -73,6 +73,7 @@ extern int tokpushback; #define NEOF ((union node *)&tokpushback) extern int whichprompt; /* 1 == PS1, 2 == PS2 */ +extern const char *const parsekwd[]; union node *parsecmd(int); Modified: user/luigi/ipfw3-head/bin/sh/var.c ============================================================================== --- user/luigi/ipfw3-head/bin/sh/var.c Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/var.c Sun Dec 27 22:34:31 2009 (r201065) @@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$"); struct varinit { struct var *var; int flags; - char *text; + const char *text; void (*func)(const char *); }; @@ -94,27 +94,27 @@ STATIC struct var voptind; STATIC const struct varinit varinit[] = { #ifndef NO_HISTORY - { &vhistsize, VSTRFIXED|VTEXTFIXED|VUNSET, "HISTSIZE=", + { &vhistsize, VUNSET, "HISTSIZE=", sethistsize }, #endif - { &vifs, VSTRFIXED|VTEXTFIXED, "IFS= \t\n", + { &vifs, 0, "IFS= \t\n", NULL }, - { &vmail, VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL=", + { &vmail, VUNSET, "MAIL=", NULL }, - { &vmpath, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH=", + { &vmpath, VUNSET, "MAILPATH=", NULL }, - { &vpath, VSTRFIXED|VTEXTFIXED, "PATH=" _PATH_DEFPATH, + { &vpath, 0, "PATH=" _PATH_DEFPATH, changepath }, - { &vppid, VSTRFIXED|VTEXTFIXED|VUNSET, "PPID=", + { &vppid, VUNSET, "PPID=", NULL }, /* * vps1 depends on uid */ - { &vps2, VSTRFIXED|VTEXTFIXED, "PS2=> ", + { &vps2, 0, "PS2=> ", NULL }, - { &vps4, VSTRFIXED|VTEXTFIXED, "PS4=+ ", + { &vps4, 0, "PS4=+ ", NULL }, - { &voptind, VSTRFIXED|VTEXTFIXED, "OPTIND=1", + { &voptind, 0, "OPTIND=1", getoptsreset }, { NULL, 0, NULL, NULL } @@ -132,9 +132,9 @@ STATIC int localevar(const char *); #ifdef mkinit INCLUDE "var.h" +MKINIT char **environ; INIT { char **envp; - extern char **environ; initvar(); for (envp = environ ; *envp ; envp++) { @@ -164,8 +164,8 @@ initvar(void) vpp = hashvar(ip->text); vp->next = *vpp; *vpp = vp; - vp->text = ip->text; - vp->flags = ip->flags; + vp->text = __DECONST(char *, ip->text); + vp->flags = ip->flags | VSTRFIXED | VTEXTFIXED; vp->func = ip->func; } } @@ -176,7 +176,7 @@ initvar(void) vpp = hashvar("PS1="); vps1.next = *vpp; *vpp = &vps1; - vps1.text = geteuid() ? "PS1=$ " : "PS1=# "; + vps1.text = __DECONST(char *, geteuid() ? "PS1=$ " : "PS1=# "); vps1.flags = VSTRFIXED|VTEXTFIXED; } if ((vppid.flags & VEXPORT) == 0) { @@ -258,11 +258,11 @@ setvar(const char *name, const char *val STATIC int localevar(const char *s) { - static char *lnames[7] = { + static const char *lnames[7] = { "ALL", "COLLATE", "CTYPE", "MONETARY", "NUMERIC", "TIME", NULL }; - char **ss; + const char **ss; if (*s != 'L') return 0; @@ -469,9 +469,9 @@ environment(void) * VSTACK set since these are currently allocated on the stack. */ -#ifdef mkinit MKINIT void shprocvar(void); +#ifdef mkinit SHELLPROC { shprocvar(); } Modified: user/luigi/ipfw3-head/bin/sh/var.h ============================================================================== --- user/luigi/ipfw3-head/bin/sh/var.h Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/bin/sh/var.h Sun Dec 27 22:34:31 2009 (r201065) @@ -108,7 +108,6 @@ void listsetvar(struct strlist *); char *lookupvar(const char *); char *bltinlookup(const char *, int); char **environment(void); -void shprocvar(void); int showvarscmd(int, char **); int exportcmd(int, char **); int localcmd(int, char **); Modified: user/luigi/ipfw3-head/release/picobsd/build/mfs.mtree ============================================================================== --- user/luigi/ipfw3-head/release/picobsd/build/mfs.mtree Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/release/picobsd/build/mfs.mtree Sun Dec 27 22:34:31 2009 (r201065) @@ -58,6 +58,8 @@ var db .. + empty + .. run .. spool Modified: user/luigi/ipfw3-head/release/picobsd/build/picobsd ============================================================================== --- user/luigi/ipfw3-head/release/picobsd/build/picobsd Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/release/picobsd/build/picobsd Sun Dec 27 22:34:31 2009 (r201065) @@ -167,7 +167,7 @@ create_includes_and_libraries2() { # opt local no log "create_includes_and_libraries2() for ${SRC}" if [ ${OSVERSION} -ge 600000 ] ; then - no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITOUT_CDDL=1" + no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" else no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R" fi Modified: user/luigi/ipfw3-head/release/picobsd/floppy.tree/etc/master.passwd ============================================================================== --- user/luigi/ipfw3-head/release/picobsd/floppy.tree/etc/master.passwd Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/release/picobsd/floppy.tree/etc/master.passwd Sun Dec 27 22:34:31 2009 (r201065) @@ -1,3 +1,4 @@ +# $FreeBSD$ root:$1$xOOaGnKU$U9QdsCI40XXcCUMBN.7Az.:0:0::0:0:Charlie &:/root:/bin/sh toor:*:0:0::0:0:Bourne-again Superuser:/root: daemon:*:1:1::0:0:Owner of many system processes:/root:/nonexistent @@ -5,4 +6,5 @@ operator:*:2:20::0:0:System &:/usr/guest bin:*:3:7::0:0:Binaries Commands and Source,,,:/:/nonexistent tty:*:4:65533::0:0:Tty Sandbox:/:/nonexistent nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/nonexistent +_dhcp:*:65:65::0:0:dhcp programs:/var/empty:/usr/sbin/nologin user:*:1002:1002:Sample User:0:0:user:/home/user:/bin/sh Modified: user/luigi/ipfw3-head/sys/conf/options.sparc64 ============================================================================== --- user/luigi/ipfw3-head/sys/conf/options.sparc64 Sun Dec 27 22:26:29 2009 (r201064) +++ user/luigi/ipfw3-head/sys/conf/options.sparc64 Sun Dec 27 22:34:31 2009 (r201065) @@ -8,6 +8,8 @@ SUN4U opt_global.h ATKBD_DFLT_KEYMAP opt_atkbd.h +FIRE_DEBUG opt_fire.h + # Debug IOMMU inserts/removes using diagnostic accesses. This is very loud. IOMMU_DIAG opt_iommu.h Copied: user/luigi/ipfw3-head/sys/sparc64/pci/fire.c (from r201063, head/sys/sparc64/pci/fire.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw3-head/sys/sparc64/pci/fire.c Sun Dec 27 22:34:31 2009 (r201065, copy of r201063, head/sys/sparc64/pci/fire.c) @@ -0,0 +1,2122 @@ +/*- + * Copyright (c) 1999, 2000 Matthew R. Green + * Copyright (c) 2001 - 2003 by Thomas Moestl + * Copyright (c) 2009 by Marius Strobl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp + * from: FreeBSD: psycho.c 183152 2008-09-18 19:45:22Z marius + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for `Fire' JBus to PCI Express and `Oberon' Uranus to PCI Express + * bridges + */ + +#include "opt_fire.h" +#include "opt_ofw_pci.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "pcib_if.h" + +static bus_space_tag_t fire_alloc_bus_tag(struct fire_softc *sc, int type); +static const struct fire_desc *fire_get_desc(device_t dev); +static void fire_dmamap_sync(bus_dma_tag_t dt __unused, bus_dmamap_t map, + bus_dmasync_op_t op); +static int fire_get_intrmap(struct fire_softc *sc, u_int ino, + bus_addr_t *intrmapptr, bus_addr_t *intrclrptr); +static void fire_intr_assign(void *arg); +static void fire_intr_clear(void *arg); +static void fire_intr_disable(void *arg); +static void fire_intr_enable(void *arg); +static int fire_intr_register(struct fire_softc *sc, u_int ino); +static void fire_msiq_handler(void *cookie); +static void fire_set_intr(struct fire_softc *sc, u_int index, u_int ino, + driver_filter_t handler, void *arg); +static timecounter_get_t fire_get_timecount; + +/* Interrupt handlers */ +static driver_filter_t fire_dmc_pec; +static driver_filter_t fire_pcie; +static driver_filter_t fire_xcb; + +/* + * Methods + */ +static bus_activate_resource_t fire_activate_resource; +static pcib_alloc_msi_t fire_alloc_msi; +static pcib_alloc_msix_t fire_alloc_msix; +static bus_alloc_resource_t fire_alloc_resource; +static device_attach_t fire_attach; +static bus_deactivate_resource_t fire_deactivate_resource; +static bus_get_dma_tag_t fire_get_dma_tag; +static ofw_bus_get_node_t fire_get_node; +static pcib_map_msi_t fire_map_msi; +static pcib_maxslots_t fire_maxslots; +static device_probe_t fire_probe; +static pcib_read_config_t fire_read_config; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Dec 27 22:42:47 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62C071065670; Sun, 27 Dec 2009 22:42:47 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 528008FC1B; Sun, 27 Dec 2009 22:42:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBRMglkL069723; Sun, 27 Dec 2009 22:42:47 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBRMglhY069721; Sun, 27 Dec 2009 22:42:47 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912272242.nBRMglhY069721@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 27 Dec 2009 22:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201066 - user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2009 22:42:47 -0000 Author: luigi Date: Sun Dec 27 22:42:47 2009 New Revision: 201066 URL: http://svn.freebsd.org/changeset/base/201066 Log: add missing file Added: user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin/dhclient-script (contents, props changed) Added: user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin/dhclient-script ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin/dhclient-script Sun Dec 27 22:42:47 2009 (r201066) @@ -0,0 +1,384 @@ +#!/bin/sh +# +# $OpenBSD: dhclient-script,v 1.6 2004/05/06 18:22:41 claudio Exp $ +# $FreeBSD: user/luigi/ipfw3-head/sbin/dhclient/dhclient-script 179689 2008-06-09 20:03:35Z brooks $ +# +# Copyright (c) 2003 Kenneth R Westerback +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# + +ARP=/usr/sbin/arp +HOSTNAME=/bin/hostname +IFCONFIG='/sbin/ifconfig -n' + +LOCALHOST=127.0.0.1 + +if [ -x /usr/bin/logger ]; then + LOGGER="/usr/bin/logger -s -p user.notice -t dhclient" +else + LOGGER=echo +fi + +# +# Helper functions that implement common actions. +# + +check_hostname() { + current_hostname=`$HOSTNAME` + if [ -z "$current_hostname" ]; then + $LOGGER "New Hostname ($interface): $new_host_name" + $HOSTNAME $new_host_name + elif [ "$current_hostname" = "$old_host_name" -a \ + "$new_host_name" != "$old_host_name" ]; then + $LOGGER "New Hostname ($interface): $new_host_name" + $HOSTNAME $new_host_name + fi +} + +arp_flush() { + arp -an -i $interface | \ + sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' | \ + sh >/dev/null 2>&1 +} + +delete_old_address() { + eval "$IFCONFIG $interface inet -alias $old_ip_address $medium" +} + +add_new_address() { + eval "$IFCONFIG $interface \ + inet $new_ip_address \ + netmask $new_subnet_mask \ + broadcast $new_broadcast_address \ + $medium" + + $LOGGER "New IP Address ($interface): $new_ip_address" + $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" + $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" + $LOGGER "New Routers ($interface): $new_routers" +} + +delete_old_alias() { + if [ -n "$alias_ip_address" ]; then + $IFCONFIG $interface inet -alias $alias_ip_address > /dev/null 2>&1 + #route delete $alias_ip_address $LOCALHOST > /dev/null 2>&1 + fi +} + +add_new_alias() { + if [ -n "$alias_ip_address" ]; then + $IFCONFIG $interface inet alias $alias_ip_address netmask \ + $alias_subnet_mask + #route add $alias_ip_address $LOCALHOST + fi +} + +fill_classless_routes() { + set $1 + while [ $# -ge 5 ]; do + if [ $1 -eq 0 ]; then + route="default" + elif [ $1 -le 8 ]; then + route="$2.0.0.0/$1" + shift + elif [ $1 -le 16 ]; then + route="$2.$3.0.0/$1" + shift; shift + elif [ $1 -le 24 ]; then + route="$2.$3.$4.0/$1" + shift; shift; shift + else + route="$2.$3.$4.$5/$1" + shift; shift; shift; shift + fi + shift + router="$1.$2.$3.$4" + classless_routes="$classless_routes $route $router" + shift; shift; shift; shift + done +} + +delete_old_routes() { + #route delete "$old_ip_address" $LOCALHOST >/dev/null 2>&1 + if [ -n "$old_classless_routes" ]; then + fill_classless_routes "$old_classless_routes" + set $classless_routes + while [ $# -gt 1 ]; do + route delete "$1" "$2" + shift; shift + done + return 0; + fi + + # If we supported multiple default routes, we'd be removing each + # one here. We don't so just delete the default route if it's + # through our interface. + if is_default_interface; then + route delete default >/dev/null 2>&1 + fi + + if [ -n "$old_static_routes" ]; then + set $old_static_routes + while [ $# -gt 1 ]; do + route delete "$1" "$2" + shift; shift + done + fi + + arp_flush +} + +add_new_routes() { + #route add $new_ip_address $LOCALHOST >/dev/null 2>&1 + + # RFC 3442: If the DHCP server returns both a Classless Static + # Routes option and a Router option, the DHCP client MUST ignore + # the Router option. + # + # DHCP clients that support this option (Classless Static Routes) + # MUST NOT install the routes specified in the Static Routes + # option (option code 33) if both a Static Routes option and the + # Classless Static Routes option are provided. + + if [ -n "$new_classless_routes" ]; then + fill_classless_routes "$new_classless_routes" + $LOGGER "New Classless Static Routes ($interface): $classless_routes" + set $classless_routes + while [ $# -gt 1 ]; do + if [ "0.0.0.0" = "$2" ]; then + route add "$1" -iface "$interface" + else + route add "$1" "$2" + fi + shift; shift + done + return + fi + + for router in $new_routers; do + if is_default_interface; then + + if [ "$new_ip_address" = "$router" ]; then + route add default -iface $router >/dev/null 2>&1 + else + route add default $router >/dev/null 2>&1 + fi + fi + # 2nd and subsequent default routers error out, so explicitly + # stop processing the list after the first one. + break + done + + if [ -n "$new_static_routes" ]; then + $LOGGER "New Static Routes ($interface): $new_static_routes" + set $new_static_routes + while [ $# -gt 1 ]; do + route add $1 $2 + shift; shift + done + fi +} + +add_new_resolv_conf() { + # XXX Old code did not create/update resolv.conf unless both + # $new_domain_name and $new_domain_name_servers were provided. PR + # #3135 reported some ISP's only provide $new_domain_name_servers and + # thus broke the script. This code creates the resolv.conf if either + # are provided. + + local tmpres=/var/run/resolv.conf.${interface} + rm -f $tmpres + + if [ -n "$new_domain_name" ]; then + echo "search $new_domain_name" >>$tmpres + fi + + if [ -n "$new_domain_name_servers" ]; then + for nameserver in $new_domain_name_servers; do + echo "nameserver $nameserver" >>$tmpres + done + fi + + if [ -f $tmpres ]; then + if [ -f /etc/resolv.conf.tail ]; then + cat /etc/resolv.conf.tail >>$tmpres + fi + + # When resolv.conf is not changed actually, we don't + # need to update it. + # If /usr is not mounted yet, we cannot use cmp, then + # the following test fails. In such case, we simply + # ignore an error and do update resolv.conf. + if cmp -s $tmpres /etc/resolv.conf; then + rm -f $tmpres + return 0 + fi 2>/dev/null + + # In case (e.g. during OpenBSD installs) /etc/resolv.conf + # is a symbolic link, take care to preserve the link and write + # the new data in the correct location. + + if [ -f /etc/resolv.conf ]; then + cat /etc/resolv.conf > /etc/resolv.conf.save + fi + cat $tmpres > /etc/resolv.conf + rm -f $tmpres + + # Try to ensure correct ownership and permissions. + chown -RL root:wheel /etc/resolv.conf + chmod -RL 644 /etc/resolv.conf + + return 0 + fi + + return 1 +} + +# Must be used on exit. Invokes the local dhcp client exit hooks, if any. +exit_with_hooks() { + exit_status=$1 + if [ -f /etc/dhclient-exit-hooks ]; then + . /etc/dhclient-exit-hooks + fi + # probably should do something with exit status of the local script + exit $exit_status +} + +# Get the interface with the current ipv4 default route on it using only +# commands that are available prior to /usr being mounted. +is_default_interface() +{ + routeget="`route -n get -inet default`" + oldifs="$IFS" + IFS=" +" + defif= + for line in $routeget ; do + case $line in + *interface:*) + defif=${line##*: } + ;; + esac + done + IFS=${oldifs} + + if [ -z "$defif" -o "$defif" = "$interface" ]; then + return 0 + else + return 1 + fi +} + +# +# Start of active code. +# + +# Invoke the local dhcp client enter hooks, if they exist. +if [ -f /etc/dhclient-enter-hooks ]; then + exit_status=0 + . /etc/dhclient-enter-hooks + # allow the local script to abort processing of this state + # local script must set exit_status variable to nonzero. + if [ $exit_status -ne 0 ]; then + exit $exit_status + fi +fi + +case $reason in +MEDIUM) + eval "$IFCONFIG $interface $medium" + eval "$IFCONFIG $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1 + sleep 1 + ;; + +PREINIT) + delete_old_alias + $IFCONFIG $interface inet alias 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up + ;; + +ARPCHECK|ARPSEND) + ;; + +BOUND|RENEW|REBIND|REBOOT) + check_hostname + if [ -n "$old_ip_address" ]; then + if [ "$old_ip_address" != "$alias_ip_address" ]; then + delete_old_alias + fi + if [ "$old_ip_address" != "$new_ip_address" ]; then + delete_old_address + delete_old_routes + fi + fi + if [ "$reason" = BOUND ] || \ + [ "$reason" = REBOOT ] || \ + [ -z "$old_ip_address" ] || \ + [ "$old_ip_address" != "$new_ip_address" ]; then + add_new_address + add_new_routes + fi + if [ "$new_ip_address" != "$alias_ip_address" ]; then + add_new_alias + fi + if is_default_interface; then + add_new_resolv_conf + fi + ;; + +EXPIRE|FAIL) + delete_old_alias + if [ -n "$old_ip_address" ]; then + delete_old_address + delete_old_routes + fi + if [ -x $ARP ]; then + $ARP -d -a -i $interface + fi + # XXX Why add alias we just deleted above? + add_new_alias + if is_default_interface; then + if [ -f /etc/resolv.conf.save ]; then + cat /etc/resolv.conf.save > /etc/resolv.conf + fi + fi + ;; + +TIMEOUT) + delete_old_alias + add_new_address + sleep 1 + if [ -n "$new_routers" ]; then + $LOGGER "New Routers ($interface): $new_routers" + set "$new_routers" + if ping -q -c 1 -t 1 "$1"; then + if [ "$new_ip_address" != "$alias_ip_address" ]; then + add_new_alias + fi + add_new_routes + if ! is_default_interface; then + exit_with_hooks 0 + fi + if add_new_resolv_conf; then + exit_with_hooks 0 + fi + fi + fi + eval "$IFCONFIG $interface inet -alias $new_ip_address $medium" + delete_old_routes + exit_with_hooks 1 + ;; +esac + +exit_with_hooks 0 From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 00:01:28 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 334281065676 for ; Mon, 28 Dec 2009 00:01:28 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mx1.freebsd.org (Postfix) with ESMTP id BC70C8FC13 for ; Mon, 28 Dec 2009 00:01:27 +0000 (UTC) Received: from vampire.homelinux.org (dslb-088-066-032-020.pools.arcor-ip.net [88.66.32.20]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0LzWOk-1O1qAG2LVi-014oQq; Mon, 28 Dec 2009 01:01:26 +0100 Received: (qmail 26633 invoked from network); 28 Dec 2009 00:01:26 -0000 Received: from f8x64.laiers.local (192.168.4.188) by ns1.laiers.local with SMTP; 28 Dec 2009 00:01:26 -0000 From: Max Laier Organization: FreeBSD To: Julian Elischer Date: Mon, 28 Dec 2009 01:01:25 +0100 User-Agent: KMail/1.12.4 (FreeBSD/8.0-RELEASE; KDE/4.3.4; amd64; ; ) References: <200912271917.nBRJH3WH064688@svn.freebsd.org> <4B37C66D.9040505@elischer.org> In-Reply-To: <4B37C66D.9040505@elischer.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200912280101.26021.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1+bb6HOpavjV/n225NjCgyHUPjEK1m1GpRr1ds YkXOjjNhkINzD2M/s2eyLINvq5arTa8qn8d77IMbGdnP4bs8wq cDdBsPJWmppaf1kUBY8Xg== Cc: Luigi Rizzo , src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r201057 - in user/luigi/ipfw3-head/sys/netinet: . ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 00:01:28 -0000 On Sunday 27 December 2009 21:41:17 Julian Elischer wrote: > Luigi Rizzo wrote: > > Author: luigi > > Date: Sun Dec 27 19:17:03 2009 > > New Revision: 201057 > > URL: http://svn.freebsd.org/changeset/base/201057 > > > > Log: > > Historically, BSD keeps ip_len and ip_off in host format when doing > > layer 3 processing. This often requires to translate the format > > back and forth. > > [...] > > > Eventually, I would like these fields to remain in network format > > across the lifetime of a packet, but this may take a long time, > > so let's see if we can find ways to at least make the switch easier. > > I think I'd go for this sooner than later. It's always annoyed me. +1 From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 01:16:32 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC33D1065692; Mon, 28 Dec 2009 01:16:32 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C4808FC1C; Mon, 28 Dec 2009 01:16:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBS1GWFO073777; Mon, 28 Dec 2009 01:16:32 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBS1GWet073775; Mon, 28 Dec 2009 01:16:32 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912280116.nBS1GWet073775@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 28 Dec 2009 01:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201074 - user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 01:16:32 -0000 Author: luigi Date: Mon Dec 28 01:16:32 2009 New Revision: 201074 URL: http://svn.freebsd.org/changeset/base/201074 Log: add missing keyword Modified: user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin/dhclient-script (contents, props changed) Modified: user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin/dhclient-script ============================================================================== --- user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin/dhclient-script Mon Dec 28 01:02:45 2009 (r201073) +++ user/luigi/ipfw3-head/release/picobsd/floppy.tree/sbin/dhclient-script Mon Dec 28 01:16:32 2009 (r201074) @@ -1,7 +1,7 @@ #!/bin/sh # # $OpenBSD: dhclient-script,v 1.6 2004/05/06 18:22:41 claudio Exp $ -# $FreeBSD: user/luigi/ipfw3-head/sbin/dhclient/dhclient-script 179689 2008-06-09 20:03:35Z brooks $ +# $FreeBSD$ # # Copyright (c) 2003 Kenneth R Westerback # From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 01:17:24 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAD3D1065676; Mon, 28 Dec 2009 01:17:24 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAF398FC13; Mon, 28 Dec 2009 01:17:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBS1HObY073832; Mon, 28 Dec 2009 01:17:24 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBS1HOgW073830; Mon, 28 Dec 2009 01:17:24 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912280117.nBS1HOgW073830@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 28 Dec 2009 01:17:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201075 - user/luigi/ipfw3-head/release/picobsd/build X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 01:17:25 -0000 Author: luigi Date: Mon Dec 28 01:17:24 2009 New Revision: 201075 URL: http://svn.freebsd.org/changeset/base/201075 Log: merge from HEAD Modified: user/luigi/ipfw3-head/release/picobsd/build/picobsd Modified: user/luigi/ipfw3-head/release/picobsd/build/picobsd ============================================================================== --- user/luigi/ipfw3-head/release/picobsd/build/picobsd Mon Dec 28 01:16:32 2009 (r201074) +++ user/luigi/ipfw3-head/release/picobsd/build/picobsd Mon Dec 28 01:17:24 2009 (r201075) @@ -568,10 +568,17 @@ do_links() { # rootdir varname # find_progs is a helper function to locate the named programs # or libraries in ${o_objdir} or ${_SHLIBDIRPREFIX}, # and return the full pathnames. -# Sets ${u_progs} to the list of programs, and ${u_libs} +# Called as "find_progs [-L libpath] [-P binpath] prog1 prog2 ... " +# On return it sets ${u_progs} to the list of programs, and ${u_libs} # to the list of shared libraries used. +# +# '-L path' can be used to specify a search path for libraries +# (which searches in $path/lib:$path/usr/lib:$path/usr/local/lib +# '-P binpath' can be used to specify a search path for programs +# (which searches in a lot of places in the subtree) +# -L must be the first, followed by -P # -# You can use it e.g. in a local configuration file by writing +# You can use it e.g. in a local confign file by writing # # do_copyfiles_user() { # local dst=$1 @@ -580,41 +587,61 @@ do_links() { # rootdir varname # cp -p ${u_libs} ${dst}/lib # mkdir -p ${dst}/libexec # find_progs ld-elf.so.1 -# cp -p ${u_progs} ${dst}/libexec +# cp -p ${u_progs} ${dst}/libexec # ignore errors # } find_progs() { # programs local i + local oo=${o_objdir:-${_SHLIBDIRPREFIX}} # default objdir + local lp=$oo/lib # default lib.prefix + local o="" # additional objdir + if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path + o=$2; shift; shift + lp="$lp:$o/lib:$o/usr/lib:$o/usr/local/lib" + o="-P $o" + fi + u_libs="" u_progs="`find_progs_helper $*`" - local o=${o_objdir:-${_SHLIBDIRPREFIX}} - log "looking for libs for $u_progs in $_SHLIBDIRPREFIX" + log "looking for libs for <$u_progs> in $lp" [ -z "${u_progs}" ] && return 1 # not found, error - i="`LD_LIBRARY_PATH=$o/lib ldd ${u_progs} | grep -v '^/' | awk '{print $1}' | sort | uniq`" - u_libs="`find_progs_helper $i`" + i="`( LD_LIBRARY_PATH=$lp ldd ${u_progs} ) | \ + grep -v '^/' | awk '{print $1}' | sort | uniq`" + u_libs="`find_progs_helper $o $i`" return 0 } find_progs_helper() { # programs + local dir=${o_objdir:-${_SHLIBDIRPREFIX}/..} + local ldir="" + if [ x"$1" = "x-P" -a -d "$2" ] ; then # set path + ldir=$2; shift; shift + fi local progs="$*" - local i o places names - local subdirs="bin sbin usr.bin usr.sbin libexec lib \ + local subdirs=". local/bin local/sbin local/lib local/libexec \ + bin sbin usr.bin usr.sbin libexec lib \ gnu/usr.bin gnu/lib \ secure/usr.bin secure/usr.sbin secure/libexec secure/lib" - names="" # files to search - o="" + local names="" # files to search + local o="" + local i for i in $progs ; do - # plain programs come out verbatim + # full pathnames are just listed [ -f "$i" ] && echo $i && continue names="${names} ${o} -name $i" o="-o" done [ -z "${names}" ] && return 0 - places="" # places to search - o=${o_objdir:-${_SHLIBDIRPREFIX}/..} + local places="" # places to search for i in $subdirs ; do - [ -d "${o}/${i}" ] && places="${places} ${o}/${i}" + [ -d "${dir}/${i}" ] && places="${places} ${dir}/${i}" done - find ${places} -type f \( ${names} \) + if [ -n "${ldir}" ] ; then + for i in $subdirs ; do + [ -d "${ldir}/${i}" ] && places="${places} ${ldir}/${i}" + done + fi + # use maxdepth 3 because some libs are way down + find ${places} -maxdepth 3 -type f \( ${names} \) } # Populate the memory filesystem with binaries and non-variable From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 01:53:53 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50839106568D; Mon, 28 Dec 2009 01:53:53 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40BCD8FC20; Mon, 28 Dec 2009 01:53:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBS1rreD074628; Mon, 28 Dec 2009 01:53:53 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBS1rriF074626; Mon, 28 Dec 2009 01:53:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912280153.nBS1rriF074626@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 28 Dec 2009 01:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201078 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 01:53:53 -0000 Author: luigi Date: Mon Dec 28 01:53:52 2009 New Revision: 201078 URL: http://svn.freebsd.org/changeset/base/201078 Log: remove a useless conversion of ip_len to net format Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c Mon Dec 28 01:50:23 2009 (r201077) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c Mon Dec 28 01:53:52 2009 (r201078) @@ -298,11 +298,11 @@ ipfw_nat(struct ip_fw_args *args, struct struct udphdr *uh; u_short cksum; - ip->ip_len = ntohs(ip->ip_len); + /* XXX check if ip_len can stay in net format */ cksum = in_pseudo( ip->ip_src.s_addr, ip->ip_dst.s_addr, - htons(ip->ip_p + ip->ip_len - (ip->ip_hl << 2)) + htons(ip->ip_p + ntohs(ip->ip_len) - (ip->ip_hl << 2)) ); switch (ip->ip_p) { @@ -329,7 +329,6 @@ ipfw_nat(struct ip_fw_args *args, struct in_delayed_cksum(mcl); mcl->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } - ip->ip_len = htons(ip->ip_len); } if (args->eh == NULL) { SET_HOST_IPLEN(ip); From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 09:18:15 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59E0B1065672; Mon, 28 Dec 2009 09:18:15 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A57F8FC16; Mon, 28 Dec 2009 09:18:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBS9IFpa084598; Mon, 28 Dec 2009 09:18:15 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBS9IFZV084596; Mon, 28 Dec 2009 09:18:15 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912280918.nBS9IFZV084596@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 28 Dec 2009 09:18:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201113 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 09:18:15 -0000 Author: luigi Date: Mon Dec 28 09:18:15 2009 New Revision: 201113 URL: http://svn.freebsd.org/changeset/base/201113 Log: readability fixes -- put braces around some large for() blocks, localize variables so the compiler does not think they are uninitialized, do not insist on precise allocation size if we have more than we need. Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Mon Dec 28 06:59:35 2009 (r201112) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Mon Dec 28 09:18:15 2009 (r201113) @@ -565,13 +565,6 @@ set_ticks(struct mbuf *m, struct dn_flow ret = div64( (m->m_pkthdr.len * 8 + q->extra_bits) * hz - q->numbytes + p->bandwidth - 1 , p->bandwidth); -#if 0 - printf("%s %d extra_bits %d numb %d ret %d\n", - __FUNCTION__, __LINE__, - (int)(q->extra_bits & 0xffffffff), - (int)(q->numbytes & 0xffffffff), - (int)(ret & 0xffffffff)); -#endif if (ret < 0) ret = 0; return ret; @@ -944,8 +937,8 @@ dummynet_task(void *context, int pending } /* Sweep pipes trying to expire idle flow_queues. */ - for (i = 0; i < HASHSIZE; i++) - SLIST_FOREACH(pipe, &pipehash[i], next) + for (i = 0; i < HASHSIZE; i++) { + SLIST_FOREACH(pipe, &pipehash[i], next) { if (pipe->idle_heap.elements > 0 && DN_KEY_LT(pipe->idle_heap.p[0].key, pipe->V)) { struct dn_flow_queue *q = @@ -956,6 +949,8 @@ dummynet_task(void *context, int pending q->S = q->F + 1; pipe->sum -= q->fs->weight; } + } + } DUMMYNET_UNLOCK(); @@ -968,20 +963,20 @@ dummynet_task(void *context, int pending static void dummynet_send(struct mbuf *m) { - struct dn_pkt_tag *pkt; struct mbuf *n; - struct ip *ip; - int dst; for (; m != NULL; m = n) { + struct ifnet *ifp; + int dst; + n = m->m_nextpkt; m->m_nextpkt = NULL; if (m_tag_first(m) == NULL) { - pkt = NULL; /* probably unnecessary */ dst = DIR_DROP; } else { - pkt = dn_tag_get(m); + struct dn_pkt_tag *pkt = dn_tag_get(m); dst = pkt->dn_dir; + ifp = pkt->ifp; } switch (dst) { @@ -989,8 +984,8 @@ dummynet_send(struct mbuf *m) ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); break ; case DIR_IN : - ip = mtod(m, struct ip *); - SET_NET_IPLEN(ip); + /* put header in network format for ip_input() */ + SET_NET_IPLEN(mtod(m, struct ip *)); netisr_dispatch(NETISR_IP, m); break; #ifdef INET6 @@ -1004,7 +999,7 @@ dummynet_send(struct mbuf *m) #endif case DIR_FWD | PROTO_IFB: /* DN_TO_IFB_FWD: */ if (bridge_dn_p != NULL) - ((*bridge_dn_p)(m, pkt->ifp)); + ((*bridge_dn_p)(m, ifp)); else printf("dummynet: if_bridge not loaded\n"); @@ -1024,7 +1019,7 @@ dummynet_send(struct mbuf *m) ether_demux(m->m_pkthdr.rcvif, m); break; case DIR_OUT | PROTO_LAYER2: /* N_TO_ETH_OUT: */ - ether_output_frame(pkt->ifp, m); + ether_output_frame(ifp, m); break; case DIR_DROP: @@ -1033,7 +1028,7 @@ dummynet_send(struct mbuf *m) break; default: - printf("dummynet: bad switch %d!\n", pkt->dn_dir); + printf("dummynet: bad switch %d!\n", dst); dn_free_pkt(m); break; } @@ -1053,8 +1048,8 @@ expire_queues(struct dn_flow_set *fs) if (fs->last_expired == time_uptime) return 0 ; fs->last_expired = time_uptime ; - for (i = 0 ; i <= fs->rq_size ; i++) /* last one is overflow */ - for (prev=NULL, q = fs->rq[i] ; q != NULL ; ) + for (i = 0 ; i <= fs->rq_size ; i++) { /* last one is overflow */ + for (prev=NULL, q = fs->rq[i] ; q != NULL ; ) { if (!QUEUE_IS_IDLE(q)) { prev = q ; q = q->next ; @@ -1068,6 +1063,8 @@ expire_queues(struct dn_flow_set *fs) fs->rq_elements-- ; free(old_q, M_DUMMYNET); } + } + } return initial_elements - fs->rq_elements ; } @@ -1811,13 +1808,15 @@ config_pipe(struct dn_pipe *p) pipe->idle_heap.size = pipe->idle_heap.elements = 0; pipe->idle_heap.offset = offsetof(struct dn_flow_queue, heap_pos); - } else + } else { /* Flush accumulated credit for all queues. */ - for (i = 0; i <= pipe->fs.rq_size; i++) + for (i = 0; i <= pipe->fs.rq_size; i++) { for (q = pipe->fs.rq[i]; q; q = q->next) { q->numbytes = p->burst + (io_fast ? p->bandwidth : 0); } + } + } pipe->bandwidth = p->bandwidth; pipe->burst = p->burst; @@ -1927,14 +1926,16 @@ config_pipe(struct dn_pipe *p) static void fs_remove_from_heap(struct dn_heap *h, struct dn_flow_set *fs) { - int i = 0, found = 0 ; - for (; i < h->elements ;) + int i, found; + + for (i = found = 0 ; i < h->elements ;) { if ( ((struct dn_flow_queue *)h->p[i].object)->fs == fs) { h->elements-- ; h->p[i] = h->p[h->elements] ; found++ ; } else i++ ; + } if (found) heapify(h); } @@ -1945,17 +1946,16 @@ fs_remove_from_heap(struct dn_heap *h, s static void pipe_remove_from_heap(struct dn_heap *h, struct dn_pipe *p) { - if (h->elements > 0) { - int i = 0 ; + int i; + for (i=0; i < h->elements ; i++ ) { - if (h->p[i].object == p) { /* found it */ - h->elements-- ; - h->p[i] = h->p[h->elements] ; - heapify(h); - break ; - } + if (h->p[i].object == p) { /* found it */ + h->elements-- ; + h->p[i] = h->p[h->elements] ; + heapify(h); + break ; + } } - } } /* @@ -2015,14 +2015,16 @@ delete_pipe(struct dn_pipe *p) SLIST_REMOVE(&pipehash[HASH(pipe->pipe_nr)], pipe, dn_pipe, next); /* Remove all references to this pipe from flow_sets. */ - for (i = 0; i < HASHSIZE; i++) - SLIST_FOREACH(fs, &flowsethash[i], next) + for (i = 0; i < HASHSIZE; i++) { + SLIST_FOREACH(fs, &flowsethash[i], next) { if (fs->pipe == pipe) { printf("dummynet: ++ ref to pipe %d from fs %d\n", p->pipe_nr, fs->fs_nr); fs->pipe = NULL ; purge_flow_set(fs, 0); } + } + } fs_remove_from_heap(&ready_heap, &(pipe->fs)); purge_pipe(pipe); /* remove all data associated to this pipe */ /* remove reference to here from extract_heap and wfq_ready_heap */ @@ -2071,7 +2073,7 @@ dn_copy_set(struct dn_flow_set *set, cha DUMMYNET_LOCK_ASSERT(); - for (i = 0 ; i <= set->rq_size ; i++) + for (i = 0 ; i <= set->rq_size ; i++) { for (q = set->rq[i] ; q ; q = q->next, qp++ ) { if (q->hash_slot != i) printf("dummynet: ++ at %d: wrong slot (have %d, " @@ -2086,6 +2088,7 @@ dn_copy_set(struct dn_flow_set *set, cha qp->head = qp->tail = NULL ; qp->fs = NULL ; } + } if (copied != set->rq_elements) printf("dummynet: ++ wrong count, have %d should be %d\n", copied, set->rq_elements); @@ -2135,7 +2138,7 @@ dummynet_get(struct sockopt *sopt) DUMMYNET_UNLOCK(); buf = malloc(size, M_TEMP, M_WAITOK); DUMMYNET_LOCK(); - if (size == dn_calc_size()) + if (size >= dn_calc_size()) break; free(buf, M_TEMP); buf = NULL; @@ -2145,7 +2148,7 @@ dummynet_get(struct sockopt *sopt) return ENOBUFS ; } bp = buf; - for (i = 0; i < HASHSIZE; i++) + for (i = 0; i < HASHSIZE; i++) { SLIST_FOREACH(pipe, &pipehash[i], next) { struct dn_pipe *pipe_bp = (struct dn_pipe *)bp; @@ -2174,8 +2177,9 @@ dummynet_get(struct sockopt *sopt) bp += sizeof(*pipe) ; bp = dn_copy_set(&(pipe->fs), bp); } + } - for (i = 0; i < HASHSIZE; i++) + for (i = 0; i < HASHSIZE; i++) { SLIST_FOREACH(fs, &flowsethash[i], next) { struct dn_flow_set *fs_bp = (struct dn_flow_set *)bp; @@ -2187,6 +2191,7 @@ dummynet_get(struct sockopt *sopt) bp += sizeof(*fs); bp = dn_copy_set(fs, bp); } + } DUMMYNET_UNLOCK(); From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 10:02:07 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5D341065670; Mon, 28 Dec 2009 10:02:06 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D7598FC19; Mon, 28 Dec 2009 10:02:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBSA26Hn085742; Mon, 28 Dec 2009 10:02:06 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBSA26YP085740; Mon, 28 Dec 2009 10:02:06 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912281002.nBSA26YP085740@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 28 Dec 2009 10:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201119 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 10:02:07 -0000 Author: luigi Date: Mon Dec 28 10:02:06 2009 New Revision: 201119 URL: http://svn.freebsd.org/changeset/base/201119 Log: when doing a lookup, keys must be in big endian format because this is what the radix code expects Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Mon Dec 28 09:41:13 2009 (r201118) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Mon Dec 28 10:02:06 2009 (r201119) @@ -1355,27 +1355,29 @@ do { \ case O_IP_SRC_LOOKUP: case O_IP_DST_LOOKUP: if (is_ipv4) { - uint32_t a = + uint32_t key = (cmd->opcode == O_IP_DST_LOOKUP) ? dst_ip.s_addr : src_ip.s_addr; uint32_t v = 0; if (cmdlen > F_INSN_SIZE(ipfw_insn_u32)) { - /* generic lookup */ + /* generic lookup. The key must be + * in 32bit big-endian format. + */ v = ((ipfw_insn_u32 *)cmd)->d[1]; if (v == 0) - a = dst_ip.s_addr; + key = dst_ip.s_addr; else if (v == 1) - a = src_ip.s_addr; + key = src_ip.s_addr; else if (offset != 0) break; else if (proto != IPPROTO_TCP && proto != IPPROTO_UDP) break; else if (v == 2) - a = dst_port; + key = htonl(dst_port); else if (v == 3) - a = src_port; + key = htons(src_port); else if (v == 4 || v == 5) { check_uidgid( (ipfw_insn_u32 *)cmd, @@ -1384,14 +1386,15 @@ do { \ src_ip, src_port, &ucred_cache, &ucred_lookup, args->inp); if (v == 4 /* O_UID */) - a = ucred_cache->cr_uid; + key = ucred_cache->cr_uid; else if (v == 5 /* O_JAIL */) - a = ucred_cache->cr_prison->pr_id; + key = ucred_cache->cr_prison->pr_id; + key = htonl(key); } else break; } - match = ipfw_lookup_table(chain, cmd->arg1, a, - &v); + match = ipfw_lookup_table(chain, + cmd->arg1, key, &v); if (!match) break; if (cmdlen == F_INSN_SIZE(ipfw_insn_u32)) From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 17:35:08 2009 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F7CD106566B for ; Mon, 28 Dec 2009 17:35:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx10.syd.optusnet.com.au (fallbackmx10.syd.optusnet.com.au [211.29.132.251]) by mx1.freebsd.org (Postfix) with ESMTP id 260C18FC0C for ; Mon, 28 Dec 2009 17:35:07 +0000 (UTC) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by fallbackmx10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id nBSFcJqt024561 for ; Tue, 29 Dec 2009 02:38:19 +1100 Received: from c220-239-235-55.carlnfd3.nsw.optusnet.com.au (c220-239-235-55.carlnfd3.nsw.optusnet.com.au [220.239.235.55]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id nBSFcFYl020603 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 29 Dec 2009 02:38:16 +1100 Date: Tue, 29 Dec 2009 02:38:15 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Luigi Rizzo In-Reply-To: <200912272213.nBRMDJAC069043@svn.freebsd.org> Message-ID: <20091229021846.U46429@delplex.bde.org> References: <200912272213.nBRMDJAC069043@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r201063 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 17:35:08 -0000 On Sun, 27 Dec 2009, Luigi Rizzo wrote: > Log: > use a less obfuscated construct to call the hook/unhook functions > > Modified: > user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Better unobfuscation: > Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c > ============================================================================== > --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 21:58:48 2009 (r201062) > +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 22:13:19 2009 (r201063) > @@ -329,18 +329,17 @@ ipfw_divert(struct mbuf **m0, int incomi > static int > ipfw_hook(int onoff, int pf) > { > + const int arg = PFIL_IN | PFIL_OUT | PFIL_WAITOK; Don't add this obfuscation (a constant used only once stored in a variable used only once, just to avoid 2 long lines (1 after my change). > struct pfil_head *pfh; > - int (*fn)(int (*pfil_func)(void *, struct mbuf **, > - struct ifnet *, int, struct inpcb *), > - void *, int, struct pfil_head *); > - OK. There is an even more negative need for a variable to hold this constant that is only used once, since declaring the variable is messy and initializing it at best wastes space. > > pfh = pfil_head_get(PFIL_TYPE_AF, pf); > if (pfh == NULL) > return ENOENT; > > - fn = (onoff) ? pfil_add_hook : pfil_remove_hook; > - (void)fn(ipfw_check_hook, NULL, PFIL_IN | PFIL_OUT | PFIL_WAITOK, pfh); > + if (onoff) > + (void)pfil_add_hook(ipfw_check_hook, NULL, arg, pfh); > + else > + (void)pfil_remove_hook(ipfw_check_hook, NULL, arg, pfh); Instead, change this to: (void)(onoff ? pfil_add_hook : pfil_remove_hook)(ipfw_check_hook, NULL, PFIL_IN | PFIL_OUT | PFIL_WAITOK, pfh); The cast to (void) may be a style bug. Is success guaranteed? Bruce From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 18:32:50 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68D781065672; Mon, 28 Dec 2009 18:32:50 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58B608FC08; Mon, 28 Dec 2009 18:32:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBSIWoC4098068; Mon, 28 Dec 2009 18:32:50 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBSIWoJW098066; Mon, 28 Dec 2009 18:32:50 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912281832.nBSIWoJW098066@svn.freebsd.org> From: Doug Barton Date: Mon, 28 Dec 2009 18:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201136 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 18:32:50 -0000 Author: dougb Date: Mon Dec 28 18:32:50 2009 New Revision: 201136 URL: http://svn.freebsd.org/changeset/base/201136 Log: Initial support for having portmaster update the terminal window with its status. One port and multiport are working, -a still needs work. Idea, terminal escape sequences and testing by: ehaupt Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Mon Dec 28 17:57:37 2009 (r201135) +++ user/dougb/portmaster/portmaster Mon Dec 28 18:32:50 2009 (r201136) @@ -1093,6 +1093,8 @@ check_for_updates () { # No need for check_exclude here because it is already # run in the places that call check_for_updates(). check_interactive $iport $port_ver || return 0 + [ -n "$CONFIG_ONLY" ] && num_of_deps=$(( $num_of_deps + 1 )) + dep_of_deps=$(( $dep_of_deps + 1 )) update_port $iport $port_ver || return 1 return 0 } @@ -1646,6 +1648,10 @@ check_fetch_only () { safe_exit } +term_printf () { + printf "\033]0;${0##*/}: ${PM_PARENT_PORT}${1}\007" +} + update_port () { local update_to @@ -1653,7 +1659,12 @@ update_port () { echo "===>>> Launching child to update ${1#$pd/}${update_to}" - [ -n "$PM_DEPTH" ] && echo " $PM_DEPTH >> ${1#$pd/}" + if [ -n "$PM_DEPTH" ]; then + echo " $PM_DEPTH >> ${1#$pd/}" + term_printf " >> ${1#$pd/} (${dep_of_deps}/${num_of_deps})" + else +#echo '' ; echo "Debug> NO PM_DEPTH HERE" ; echo '' + fi [ -n "$doing_dep_check" -o \ \( -n "$UPDATE_ALL" -a -n "$CONFIG_ONLY" \) ] && @@ -1836,6 +1847,9 @@ dependency_check () { check_for_updates $iport $origin || fail 'Update failed' else check_interactive $origin || continue + [ -n "$CONFIG_ONLY" ] && + num_of_deps=$(( $num_of_deps + 1 )) + dep_of_deps=$(( $dep_of_deps + 1 )) update_port $origin fi done @@ -1881,18 +1895,29 @@ post_config () { unset CONFIG_SEEN_LIST CONFIG_ONLY + dep_of_deps=0 + if [ -n "$PM_BUILD_ONLY_LIST" ]; then unset run_dl_g PM_BUILD_ONLY_LIST=pm_bol fi } +init_parent_port () { + PM_PARENT_PORT=$1 + num_of_deps=0 + dep_of_deps=0 + export PM_PARENT_PORT num_of_deps dep_of_deps + + term_printf +} + multiport () { # Global PM_MULTI_PORTS=':' ; PM_MULTI_BUILT=':' export PM_MULTI_PORTS PM_MULTI_BUILT - local port worklist_temp worklist portlist + local port worklist_temp worklist portlist numports num # Expand globs and check that the directories exist for port in $@; do @@ -1921,6 +1946,7 @@ multiport () { esac done + numports=0 for port in $worklist_temp; do check_exclude $port || continue check_interactive $port || continue @@ -1928,6 +1954,7 @@ multiport () { worklist="$worklist $port" portlist="${portlist}\t${port}\n" PM_MULTI_PORTS="${PM_MULTI_PORTS}${port}:" + numports=$(( $numports + 1 )) done echo "===>>> Working on multiple ports:" @@ -1945,9 +1972,12 @@ multiport () { done fi + num=1 for port in $worklist; do + init_parent_port "$port ${num}/${numports}" ($0 $ARGS $port) || fail "Update for $port failed" . $IPC_SAVE + num=$(( $num + 1 )) done check_fetch_only @@ -1955,6 +1985,7 @@ multiport () { fi export PM_BUILDING=pmbuildingmultiport + num=1 for port in $worklist; do case "$PM_MULTI_BUILT" in *:${port}:*) continue ;; esac @@ -1962,11 +1993,15 @@ multiport () { */*) ;; # Ok to proceed *) # If an installed version does not exist at this # point it probably got updated as a dependency - [ -d "$pdb/$port" ] || continue - ;; + if [ ! -d "$pdb/$port" ]; then + numports=$(( $numports - 1 )) + continue + fi ;; esac + init_parent_port "$port ${num}/${numports}" ($0 $ARGS $port) || fail "Update for $port failed" . $IPC_SAVE + num=$(( $num + 1 )) done safe_exit } @@ -2084,6 +2119,8 @@ all_config () { } [ -n "$DI_FILES" ] && (read_distinfos)& + init_parent_port All + ports_by_category echo "===>>> Starting check of installed ports for available updates" @@ -2284,6 +2321,7 @@ pm_cd $pd/$portdir || no_valid_port if [ -z "$PM_DEPTH" ]; then PM_DEPTH=${upg_port:-$portdir} + [ -z "$PM_PARENT_PORT" ] && init_parent_port $portdir else PM_DEPTH="$PM_DEPTH >> ${upg_port:-$portdir}" fi @@ -2448,6 +2486,8 @@ elif [ -z "$NO_RECURSIVE_CONFIG" -a "$$" echo '' fi +[ "$$" -eq "$PM_PARENT_PID" ] && term_printf + if [ -n "$NO_ACTION" -a -z "$CONFIG_ONLY" ]; then [ -n "$PM_VERBOSE" ] && echo "===>>> Build canceled due to -n flag" safe_exit From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 20:26:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9A8A106568F for ; Mon, 28 Dec 2009 20:26:37 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id B950A8FC17 for ; Mon, 28 Dec 2009 20:26:37 +0000 (UTC) Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 50D8EC93D5; Mon, 28 Dec 2009 15:09:46 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Mon, 28 Dec 2009 15:09:46 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=ZbiAiBWs4fahWmjxcaOLqsfqO0w=; b=WQKkcfJzfQJURbvm4gBcUFjqATnInvqGw32NUAOwkibeoeLvug98E4bglHKNAzIzAh7WSEBAi6OCKmPhfYx+P0MKpltwS69MaTZnYiU63WMYOJhauIAOEF6YjOUf2LQ6R74dKDMXRddzBY2CdRYGjaFzZN9xFquxJoma9KYwLGg= X-Sasl-enc: 9W6WUYNS0U5mPuhoVXj1ZtYmh3NnpgskyQLDQxebxECc 1262030986 Received: from [192.168.123.18] (cpc2-dals7-0-0-cust253.hari.cable.virginmedia.com [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 902722CD34; Mon, 28 Dec 2009 15:09:45 -0500 (EST) Message-ID: <4B391088.1030107@incunabulum.net> Date: Mon, 28 Dec 2009 20:09:44 +0000 From: Bruce Simpson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-GB; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: Julian Elischer References: <200912271917.nBRJH3WH064688@svn.freebsd.org> <4B37C66D.9040505@elischer.org> In-Reply-To: <4B37C66D.9040505@elischer.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Luigi Rizzo , src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r201057 - in user/luigi/ipfw3-head/sys/netinet: . ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 20:26:38 -0000 On 27/12/2009 20:41, Julian Elischer wrote: > Luigi Rizzo wrote: >> Author: luigi >> Date: Sun Dec 27 19:17:03 2009 >> New Revision: 201057 >> URL: http://svn.freebsd.org/changeset/base/201057 >> >> Log: >> Historically, BSD keeps ip_len and ip_off in host format when doing >> layer 3 processing. This often requires to translate the format >> back and forth. > > [...] > >> Eventually, I would like these fields to remain in network format >> across the lifetime of a packet, but this may take a long time, >> so let's see if we can find ways to at least make the switch easier. > > > I think I'd go for this sooner than later. It's always annoyed me. +1. It is a bit of a kicker for portability with other BSDs, and I wonder how much we actually gain with using host endian in IPv4, as opposed to tripping over it all the time. From owner-svn-src-user@FreeBSD.ORG Mon Dec 28 23:33:08 2009 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74CB61065693 for ; Mon, 28 Dec 2009 23:33:08 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 3A7458FC19 for ; Mon, 28 Dec 2009 23:33:08 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id C497C73098; Tue, 29 Dec 2009 00:21:51 +0100 (CET) Date: Tue, 29 Dec 2009 00:21:51 +0100 From: Luigi Rizzo To: Bruce Evans Message-ID: <20091228232151.GA39294@onelab2.iet.unipi.it> References: <200912272213.nBRMDJAC069043@svn.freebsd.org> <20091229021846.U46429@delplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091229021846.U46429@delplex.bde.org> User-Agent: Mutt/1.4.2.3i Cc: Luigi Rizzo , src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r201063 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 23:33:08 -0000 On Tue, Dec 29, 2009 at 02:38:15AM +1100, Bruce Evans wrote: > On Sun, 27 Dec 2009, Luigi Rizzo wrote: > > >Log: > > use a less obfuscated construct to call the hook/unhook functions > > > >Modified: > > user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c > > Better unobfuscation: > > >Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c > >============================================================================== > >--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 > >21:58:48 2009 (r201062) > >+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 > >22:13:19 2009 (r201063) > >@@ -329,18 +329,17 @@ ipfw_divert(struct mbuf **m0, int incomi > >static int > >ipfw_hook(int onoff, int pf) > >{ > >+ const int arg = PFIL_IN | PFIL_OUT | PFIL_WAITOK; > > Don't add this obfuscation (a constant used only once stored in a variable > used only once, just to avoid 2 long lines (1 after my change). It is not just that. I want to tell humans reading the code that the value used in the two calls is exactly the same, beyond any chance of misspelling or misreading the two long lines. Then whether or not to store it in a variable is compiler's business, same as if i use the constant FOO ( #define FOO 0x11122334455667788LL ) 20 times in a piece of code. cheers luigi From owner-svn-src-user@FreeBSD.ORG Tue Dec 29 13:14:14 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D6E6106566B; Tue, 29 Dec 2009 13:14:14 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D22F8FC0C; Tue, 29 Dec 2009 13:14:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBTDEExk025179; Tue, 29 Dec 2009 13:14:14 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBTDEEOG025172; Tue, 29 Dec 2009 13:14:14 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200912291314.nBTDEEOG025172@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 29 Dec 2009 13:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201195 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 13:14:14 -0000 Author: edwin Date: Tue Dec 29 13:14:13 2009 New Revision: 201195 URL: http://svn.freebsd.org/changeset/base/201195 Log: Be able to process strict dates (d/m), all dates (*/m, d/*) and dow per month or year. Modified: user/edwin/calendar/calendar.c user/edwin/calendar/calendar.h user/edwin/calendar/dates.c user/edwin/calendar/day.c user/edwin/calendar/io.c user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/calendar.c ============================================================================== --- user/edwin/calendar/calendar.c Tue Dec 29 12:47:47 2009 (r201194) +++ user/edwin/calendar/calendar.c Tue Dec 29 13:14:13 2009 (r201195) @@ -131,7 +131,6 @@ main(int argc, char *argv[]) settimes(f_time, f_dayBefore, f_dayAfter, &tp1, &tp2); generatedates(&tp1, &tp2); - dumpdates(); if (doall) while ((pw = getpwent()) != NULL) { Modified: user/edwin/calendar/calendar.h ============================================================================== --- user/edwin/calendar/calendar.h Tue Dec 29 12:47:47 2009 (r201194) +++ user/edwin/calendar/calendar.h Tue Dec 29 13:14:13 2009 (r201195) @@ -74,6 +74,7 @@ extern int debug; /* show parsing of th extern int f_dayAfter; /* days after current date */ extern int f_dayBefore; /* days before current date */ extern int Friday; /* day before weekend */ +extern int year1, year2; /* events.c */ /* @@ -118,7 +119,7 @@ void settimes(time_t,int, int, struct tm time_t Mktime(char *); /* parsedata.c */ -int parsedaymonth(char *, int *, int *, int *); +int parsedaymonth(char *, int *, int *, int *, int *); /* io.c */ void cal(void); @@ -131,5 +132,11 @@ int easter(int); /* dates.c */ extern int cumdaytab[][14]; +extern int mondaytab[][14]; +extern int debug_remember; void generatedates(struct tm *tp1, struct tm *tp2); void dumpdates(void); +int remember_ymd(int y, int m, int d); +int remember_yd(int y, int d, int *rm, int *rd); +int first_dayofweek_of_year(int y); +int first_dayofweek_of_month(int y, int m); Modified: user/edwin/calendar/dates.c ============================================================================== --- user/edwin/calendar/dates.c Tue Dec 29 12:47:47 2009 (r201194) +++ user/edwin/calendar/dates.c Tue Dec 29 13:14:13 2009 (r201195) @@ -29,11 +29,12 @@ struct cal_day { int julianday; /* 000 .. 366 */ int dayofweek; /* 0 .. 6 */ struct cal_day *nextday; - struct cal_month *month; - struct cal_year *year; + struct cal_month *month; /* points back */ + struct cal_year *year; /* points back */ struct event *events; } cal_day; +int debug_remember = 0; struct cal_year *hyear = NULL; /* 1-based month, 0-based days, cumulative */ @@ -224,3 +225,115 @@ dumpdates(void) y = y->nextyear; } } + +int +remember_ymd(int yy, int mm, int dd) +{ + struct cal_year *y; + struct cal_month *m; + struct cal_day *d; + + if (debug_remember) + printf("remember_ymd: %d - %d - %d\n", yy, mm, dd); + + y = hyear; + while (y != NULL) { + if (y->year != yy) { + y = y->nextyear; + continue; + } + m = y->months; + while (m != NULL) { + if (m->month != mm) { + m = m->nextmonth; + continue; + } + d = m->days; + while (d != NULL) { + if (d->dayofmonth == dd) + return (1); + d = d->nextday; + continue;; + } + return (0); + } + return (0); + } + return (0); +} + +int +remember_yd(int yy, int dd, int *rm, int *rd) +{ + struct cal_year *y; + struct cal_month *m; + struct cal_day *d; + + if (debug_remember) + printf("remember_yd: %d - %d\n", yy, dd); + + y = hyear; + while (y != NULL) { + if (y->year != yy) { + y = y->nextyear; + continue; + } + m = y->months; + while (m != NULL) { + d = m->days; + while (d != NULL) { + if (d->julianday == dd) { + *rm = m->month; + *rd = d->dayofmonth; + return (1); + } + d = d->nextday; + } + m = m->nextmonth; + } + return (0); + } + return (0); +} + +int +first_dayofweek_of_year(int yy) +{ + struct cal_year *y; + + y = hyear; + while (y != NULL) { + if (y->year == yy) + return (y->firstdayofweek); + y = y->nextyear; + } + + /* Should not happen */ + return (-1); +} + +int +first_dayofweek_of_month(int yy, int mm) +{ + struct cal_year *y; + struct cal_month *m; + + y = hyear; + while (y != NULL) { + if (y->year != yy) { + y = y->nextyear; + continue; + } + m = y->months; + while (m != NULL) { + if (m->month == mm) + return (m->firstdayofweek); + m = m->nextmonth; + } + /* Should not happen */ + return (-1); + } + + /* Should not happen */ + return (-1); +} Modified: user/edwin/calendar/day.c ============================================================================== --- user/edwin/calendar/day.c Tue Dec 29 12:47:47 2009 (r201194) +++ user/edwin/calendar/day.c Tue Dec 29 13:14:13 2009 (r201195) @@ -47,6 +47,7 @@ struct tm tp1, tp2; time_t time1, time2; const struct tm tm0; char dayname[10]; +int year1, year2; void @@ -63,8 +64,10 @@ settimes(time_t now, int before, int aft time1 = now - SECSPERDAY * f_dayBefore; localtime_r(&time1, tp1); + year1 = 1900 + tp1->tm_year; time2 = now + SECSPERDAY * f_dayAfter; localtime_r(&time2, tp2); + year2 = 1900 + tp2->tm_year; header[5].iov_base = dayname; Modified: user/edwin/calendar/io.c ============================================================================== --- user/edwin/calendar/io.c Tue Dec 29 12:47:47 2009 (r201194) +++ user/edwin/calendar/io.c Tue Dec 29 13:14:13 2009 (r201195) @@ -91,6 +91,7 @@ cal(void) int count, i; int month[MAXCOUNT]; int day[MAXCOUNT]; + int year[MAXCOUNT]; int flags; static int d_first = -1; char buf[2048 + 1]; @@ -168,16 +169,16 @@ cal(void) pp--; p = *pp; *pp = '\0'; - if ((count = parsedaymonth(buf, month, day, &flags)) == 0) + if ((count = parsedaymonth(buf, year, month, day, &flags)) == 0) continue; + printf("%s - count: %d\n", buf, count); *pp = p; /* Find the last tab */ while (pp[1] == '\t') pp++; if (d_first < 0) - d_first = - (*nl_langinfo(D_MD_ORDER) == 'd'); + d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); for (i = 0; i < count; i++) { tm.tm_mon = month[i] - 1; Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Tue Dec 29 12:47:47 2009 (r201194) +++ user/edwin/calendar/parsedata.c Tue Dec 29 13:14:13 2009 (r201195) @@ -125,7 +125,7 @@ determinestyle(char *date, int *flags, } /* - * After this, leave by goto-ing to "allfine" or "fail" to restore the + * AFTER this, leave by goto-ing to "allfine" or "fail" to restore the * original data in `date'. */ pold = *p; @@ -241,6 +241,42 @@ allfine: } +static void +remember(int index, int *y, int *m, int *d, int yy, int mm, int dd) +{ + + y[index] = yy; + m[index] = mm; + d[index] = dd; +} + +void +debug_determinestyle(int dateonly, char *date, int flags, char *month, + int imonth, char *dayofmonth, int idayofmonth, char *dayofweek, + int idayofweek, char *modifieroffset, char *modifierindex, char *specialday) +{ + + if (dateonly != 0) { + printf("-------\ndate: |%s|\n", date); + if (dateonly == 1) + return; + } + printf("flags: %x - %s\n", flags, showflags(flags)); + if (modifieroffset[0] != '\0') + printf("modifieroffset: |%s|\n", modifieroffset); + if (modifierindex[0] != '\0') + printf("modifierindex: |%s|\n", modifierindex); + if (month[0] != '\0') + printf("month: |%s| (%d)\n", month, imonth); + if (dayofmonth[0] != '\0') + printf("dayofmonth: |%s| (%d)\n", dayofmonth, idayofmonth); + if (dayofweek[0] != '\0') + printf("dayofweek: |%s| (%d)\n", dayofweek, idayofweek); + if (specialday[0] != '\0') + printf("specialday: |%s|\n", specialday); +} + + /* * Possible date formats include any combination of: * 3-charmonth (January, Jan, Jan) @@ -252,11 +288,13 @@ allfine: * along with the matched line. */ int -parsedaymonth(char *date, int *monthp, int *dayp, int *flags) +parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags) { char month[100], dayofmonth[100], dayofweek[100], modifieroffset[100]; char modifierindex[100], specialday[100]; - int idayofweek, imonth, idayofmonth; + int idayofweek, imonth, idayofmonth, year, index; + + int *mondays, d, m, dow, rm, rd; /* * CONVENTION @@ -271,7 +309,9 @@ parsedaymonth(char *date, int *monthp, i *flags = 0; if (debug) - printf("-------\ndate: |%s|\n", date); + debug_determinestyle(1, date, *flags, month, imonth, + dayofmonth, idayofmonth, dayofweek, idayofweek, + modifieroffset, modifierindex, specialday); if (determinestyle(date, flags, month, &imonth, dayofmonth, &idayofmonth, dayofweek, &idayofweek, modifieroffset, modifierindex, specialday) == 0) { @@ -280,27 +320,92 @@ parsedaymonth(char *date, int *monthp, i return (0); } - if (debug) { - printf("flags: %x - %s\n", *flags, showflags(*flags)); - if (modifieroffset[0] != '\0') - printf("modifieroffset: |%s|\n", modifieroffset); - if (modifierindex[0] != '\0') - printf("modifierindex: |%s|\n", modifierindex); - if (month[0] != '\0') - printf("month: |%s| (%d)\n", month, imonth); - if (dayofmonth[0] != '\0') - printf("dayofmonth: |%s| (%d)\n", dayofmonth, - idayofmonth); - if (dayofweek[0] != '\0') - printf("dayofweek: |%s| (%d)\n", dayofweek, idayofweek); - if (specialday[0] != '\0') - printf("specialday: |%s|\n", specialday); - } + if (debug) + debug_determinestyle(0, date, *flags, month, imonth, + dayofmonth, idayofmonth, dayofweek, idayofweek, + modifieroffset, modifierindex, specialday); + + index = 0; + for (year = year1; year <= year2; year++) { + mondays = mondaytab[isleap(year)]; + + /* Same day every year */ + if (*flags == (F_MONTH | F_DAYOFMONTH)) { + if (!remember_ymd(year, imonth, idayofmonth)) + continue; + remember(index++, yearp, monthp, dayp, + year, imonth, idayofmonth); + continue; + } + + /* Same day every month */ + if (*flags == (F_ALLMONTH | F_DAYOFMONTH)) { + for (m = 1; m <= 12; m++) { + if (!remember_ymd(year, m, idayofmonth)) + continue; + remember(index++, yearp, monthp, dayp, + year, m, idayofmonth); + } + continue; + } + + /* Every day of a month */ + if (*flags == (F_ALLDAY | F_MONTH)) { + for (d = 1; d <= mondays[imonth]; d++) { + if (!remember_ymd(year, imonth, d)) + continue; + remember(index++, yearp, monthp, dayp, + year, imonth, d); + } + continue; + } + + /* One day of every month */ + if (*flags == (F_ALLMONTH | F_DAYOFWEEK)) { + for (m = 1; m <= 12; m++) { + if (!remember_ymd(year, m, idayofmonth)) + continue; + remember(index++, yearp, monthp, dayp, + year, m, idayofmonth); + } + continue; + } + + /* Every dayofweek of the year */ + if (*flags == (F_DAYOFWEEK | F_VARIABLE)) { + dow = first_dayofweek_of_year(year); + d = (idayofweek - dow + 8) % 7; + while (d <= 366) { + if (remember_yd(year, d, &rm, &rd)) + remember(index++, yearp, monthp, dayp, + year, rm, rd); + d += 7; + } + continue; + } + + /* Every dayofweek of the month */ + if (*flags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { + dow = first_dayofweek_of_month(year, imonth); + d = (idayofweek - dow + 8) % 7; + while (d <= mondays[imonth]) { + if (remember_ymd(year, imonth, d)) + remember(index++, yearp, monthp, dayp, + year, imonth, rd); + d += 7; + } + continue; + + } + + printf("Unprocessed:\n"); + debug_determinestyle(2, date, *flags, month, imonth, + dayofmonth, idayofmonth, dayofweek, idayofweek, + modifieroffset, modifierindex, specialday); - if ((*flags & !F_VARIABLE) == (F_MONTH | F_DAYOFMONTH)) { } - return (0); + return (index); #ifdef NOTDEF if (!(v1 = getfield(date, &flags))) From owner-svn-src-user@FreeBSD.ORG Tue Dec 29 15:48:52 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6786106566B; Tue, 29 Dec 2009 15:48:52 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A186F8FC12; Tue, 29 Dec 2009 15:48:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBTFmq5d028709; Tue, 29 Dec 2009 15:48:52 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBTFmq7V028689; Tue, 29 Dec 2009 15:48:52 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912291548.nBTFmq7V028689@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 29 Dec 2009 15:48:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201203 - in user/luigi/ipfw3-head: bin/pkill cddl/contrib/opensolaris/cmd/zpool contrib/top lib/libarchive lib/libc/gen lib/libexpat lib/libgssapi lib/librpcsec_gss lib/libulog libexec... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 15:48:52 -0000 Author: luigi Date: Tue Dec 29 15:48:51 2009 New Revision: 201203 URL: http://svn.freebsd.org/changeset/base/201203 Log: merge r201064-201149. Also, modify ipfw and dummynet so they use ip_len and ip_off in network format (this removes the differences between layer2 and layer3 processing) Added: user/luigi/ipfw3-head/lib/libarchive/archive_crc32.h - copied unchanged from r201149, head/lib/libarchive/archive_crc32.h user/luigi/ipfw3-head/lib/libarchive/archive_entry_xattr.c - copied unchanged from r201149, head/lib/libarchive/archive_entry_xattr.c Modified: user/luigi/ipfw3-head/bin/pkill/pkill.c user/luigi/ipfw3-head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c user/luigi/ipfw3-head/lib/libarchive/Makefile user/luigi/ipfw3-head/lib/libarchive/archive.h user/luigi/ipfw3-head/lib/libarchive/archive_check_magic.c user/luigi/ipfw3-head/lib/libarchive/archive_endian.h user/luigi/ipfw3-head/lib/libarchive/archive_entry.c user/luigi/ipfw3-head/lib/libarchive/archive_entry.h user/luigi/ipfw3-head/lib/libarchive/archive_entry_link_resolver.c user/luigi/ipfw3-head/lib/libarchive/archive_entry_private.h user/luigi/ipfw3-head/lib/libarchive/archive_entry_stat.c user/luigi/ipfw3-head/lib/libarchive/archive_platform.h user/luigi/ipfw3-head/lib/libarchive/archive_private.h user/luigi/ipfw3-head/lib/libarchive/archive_read.c user/luigi/ipfw3-head/lib/libarchive/archive_read_disk_entry_from_file.c user/luigi/ipfw3-head/lib/libarchive/archive_read_disk_private.h user/luigi/ipfw3-head/lib/libarchive/archive_read_disk_set_standard_lookup.c user/luigi/ipfw3-head/lib/libarchive/archive_read_open_fd.c user/luigi/ipfw3-head/lib/libarchive/archive_read_open_file.c user/luigi/ipfw3-head/lib/libarchive/archive_read_open_filename.c user/luigi/ipfw3-head/lib/libarchive/archive_read_private.h user/luigi/ipfw3-head/lib/libarchive/archive_read_support_compression_bzip2.c user/luigi/ipfw3-head/lib/libarchive/archive_read_support_compression_compress.c user/luigi/ipfw3-head/lib/libarchive/archive_read_support_compression_gzip.c user/luigi/ipfw3-head/lib/libarchive/archive_read_support_compression_program.c user/luigi/ipfw3-head/lib/libarchive/archive_read_support_format_ar.c user/luigi/ipfw3-head/lib/libarchive/archive_read_support_format_raw.c user/luigi/ipfw3-head/lib/libarchive/archive_read_support_format_zip.c user/luigi/ipfw3-head/lib/libarchive/archive_string.c user/luigi/ipfw3-head/lib/libarchive/archive_string.h user/luigi/ipfw3-head/lib/libarchive/archive_util.3 user/luigi/ipfw3-head/lib/libarchive/archive_util.c user/luigi/ipfw3-head/lib/libarchive/archive_virtual.c user/luigi/ipfw3-head/lib/libarchive/archive_write.3 user/luigi/ipfw3-head/lib/libarchive/archive_write.c user/luigi/ipfw3-head/lib/libarchive/archive_write_disk_private.h user/luigi/ipfw3-head/lib/libarchive/archive_write_disk_set_standard_lookup.c user/luigi/ipfw3-head/lib/libarchive/archive_write_open_fd.c user/luigi/ipfw3-head/lib/libarchive/archive_write_set_compression_bzip2.c user/luigi/ipfw3-head/lib/libarchive/archive_write_set_compression_compress.c user/luigi/ipfw3-head/lib/libarchive/archive_write_set_compression_gzip.c user/luigi/ipfw3-head/lib/libarchive/archive_write_set_compression_none.c user/luigi/ipfw3-head/lib/libarchive/archive_write_set_compression_program.c user/luigi/ipfw3-head/lib/libarchive/archive_write_set_compression_xz.c user/luigi/ipfw3-head/lib/libarchive/archive_write_set_format_ar.c user/luigi/ipfw3-head/lib/libarchive/config_freebsd.h user/luigi/ipfw3-head/lib/libarchive/filter_fork.h user/luigi/ipfw3-head/lib/libarchive/libarchive-formats.5 user/luigi/ipfw3-head/lib/libarchive/tar.5 user/luigi/ipfw3-head/lib/libc/gen/sem.c user/luigi/ipfw3-head/lib/libexpat/libbsdxml.3 user/luigi/ipfw3-head/lib/libgssapi/gss_mech_switch.c user/luigi/ipfw3-head/lib/librpcsec_gss/rpcsec_gss_conf.c user/luigi/ipfw3-head/lib/librpcsec_gss/svc_rpcsec_gss.c user/luigi/ipfw3-head/lib/libulog/ulog_getutxent.c user/luigi/ipfw3-head/libexec/rpc.rusersd/Makefile user/luigi/ipfw3-head/libexec/rpc.rusersd/rusers_proc.c user/luigi/ipfw3-head/libexec/rpc.rusersd/rusersd.c user/luigi/ipfw3-head/release/picobsd/qemu/PICOBSD user/luigi/ipfw3-head/release/picobsd/qemu/config user/luigi/ipfw3-head/sbin/fsck_ffs/gjournal.c user/luigi/ipfw3-head/sbin/ggate/ggated/ggated.c user/luigi/ipfw3-head/sbin/natd/natd.c user/luigi/ipfw3-head/sbin/routed/if.c user/luigi/ipfw3-head/sbin/umount/Makefile user/luigi/ipfw3-head/sbin/umount/umount.c user/luigi/ipfw3-head/share/man/man4/ifmib.4 user/luigi/ipfw3-head/share/man/man4/termios.4 user/luigi/ipfw3-head/share/man/man4/tty.4 user/luigi/ipfw3-head/share/man/man4/u3g.4 user/luigi/ipfw3-head/share/man/man4/ucom.4 user/luigi/ipfw3-head/sys/boot/ofw/libofw/ofw_disk.c user/luigi/ipfw3-head/sys/cam/ata/ata_all.c user/luigi/ipfw3-head/sys/cam/ata/ata_da.c user/luigi/ipfw3-head/sys/cddl/boot/zfs/zfsimpl.h user/luigi/ipfw3-head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c user/luigi/ipfw3-head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h user/luigi/ipfw3-head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c user/luigi/ipfw3-head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/luigi/ipfw3-head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h user/luigi/ipfw3-head/sys/dev/ksyms/ksyms.c user/luigi/ipfw3-head/sys/dev/led/led.c user/luigi/ipfw3-head/sys/dev/md/md.c user/luigi/ipfw3-head/sys/dev/sound/pcm/channel.c user/luigi/ipfw3-head/sys/dev/sound/pcm/sndstat.c user/luigi/ipfw3-head/sys/dev/usb/quirk/usb_quirk.c user/luigi/ipfw3-head/sys/dev/xen/blkfront/blkfront.c user/luigi/ipfw3-head/sys/geom/gate/g_gate.c user/luigi/ipfw3-head/sys/geom/geom_dev.c user/luigi/ipfw3-head/sys/ia64/ia64/sscdisk.c user/luigi/ipfw3-head/sys/kern/kern_conf.c user/luigi/ipfw3-head/sys/kern/kern_jail.c user/luigi/ipfw3-head/sys/kern/sched_ule.c user/luigi/ipfw3-head/sys/kern/uipc_accf.c user/luigi/ipfw3-head/sys/kern/vfs_mount.c user/luigi/ipfw3-head/sys/kern/vfs_subr.c user/luigi/ipfw3-head/sys/netgraph/atm/uni/ng_uni.c user/luigi/ipfw3-head/sys/netgraph/ng_base.c user/luigi/ipfw3-head/sys/netgraph/ng_ipfw.c user/luigi/ipfw3-head/sys/netgraph/ng_ipfw.h user/luigi/ipfw3-head/sys/netinet/ip_encap.c user/luigi/ipfw3-head/sys/netinet/ip_output.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_log.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_nat.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h user/luigi/ipfw3-head/sys/netinet/libalias/alias_mod.c user/luigi/ipfw3-head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c user/luigi/ipfw3-head/sys/sparc64/pci/schizo.c user/luigi/ipfw3-head/sys/sys/ata.h user/luigi/ipfw3-head/sys/sys/file.h user/luigi/ipfw3-head/sys/vm/uma_core.c user/luigi/ipfw3-head/tools/regression/geom/ConfCmp/ConfCmp.c user/luigi/ipfw3-head/usr.bin/finger/Makefile user/luigi/ipfw3-head/usr.bin/finger/extern.h user/luigi/ipfw3-head/usr.bin/finger/finger.c user/luigi/ipfw3-head/usr.bin/finger/finger.h user/luigi/ipfw3-head/usr.bin/finger/lprint.c user/luigi/ipfw3-head/usr.bin/finger/net.c user/luigi/ipfw3-head/usr.bin/finger/sprint.c user/luigi/ipfw3-head/usr.bin/finger/util.c user/luigi/ipfw3-head/usr.sbin/cpucontrol/cpucontrol.c user/luigi/ipfw3-head/usr.sbin/pmcstat/pmcstat_log.c user/luigi/ipfw3-head/usr.sbin/ppp/ppp.8.m4 user/luigi/ipfw3-head/usr.sbin/rpc.umntall/mounttab.c user/luigi/ipfw3-head/usr.sbin/service/service.8 user/luigi/ipfw3-head/usr.sbin/service/service.sh user/luigi/ipfw3-head/usr.sbin/ypserv/yp_main.c Directory Properties: user/luigi/ipfw3-head/ (props changed) user/luigi/ipfw3-head/cddl/contrib/opensolaris/ (props changed) user/luigi/ipfw3-head/contrib/bind9/ (props changed) user/luigi/ipfw3-head/contrib/cpio/ (props changed) user/luigi/ipfw3-head/contrib/csup/ (props changed) user/luigi/ipfw3-head/contrib/ee/ (props changed) user/luigi/ipfw3-head/contrib/expat/ (props changed) user/luigi/ipfw3-head/contrib/file/ (props changed) user/luigi/ipfw3-head/contrib/gdb/ (props changed) user/luigi/ipfw3-head/contrib/gdtoa/ (props changed) user/luigi/ipfw3-head/contrib/less/ (props changed) user/luigi/ipfw3-head/contrib/libpcap/ (props changed) user/luigi/ipfw3-head/contrib/ncurses/ (props changed) user/luigi/ipfw3-head/contrib/netcat/ (props changed) user/luigi/ipfw3-head/contrib/ntp/ (props changed) user/luigi/ipfw3-head/contrib/openbsm/ (props changed) user/luigi/ipfw3-head/contrib/openpam/ (props changed) user/luigi/ipfw3-head/contrib/pf/ (props changed) user/luigi/ipfw3-head/contrib/sendmail/ (props changed) user/luigi/ipfw3-head/contrib/tcpdump/ (props changed) user/luigi/ipfw3-head/contrib/tcsh/ (props changed) user/luigi/ipfw3-head/contrib/top/ (props changed) user/luigi/ipfw3-head/contrib/top/install-sh (props changed) user/luigi/ipfw3-head/contrib/wpa/ (props changed) user/luigi/ipfw3-head/crypto/openssh/ (props changed) user/luigi/ipfw3-head/crypto/openssl/ (props changed) user/luigi/ipfw3-head/lib/libc/ (props changed) user/luigi/ipfw3-head/lib/libc/stdtime/ (props changed) user/luigi/ipfw3-head/lib/libutil/ (props changed) user/luigi/ipfw3-head/sbin/ (props changed) user/luigi/ipfw3-head/sbin/ipfw/ (props changed) user/luigi/ipfw3-head/share/zoneinfo/ (props changed) user/luigi/ipfw3-head/sys/ (props changed) user/luigi/ipfw3-head/sys/amd64/include/xen/ (props changed) user/luigi/ipfw3-head/sys/cddl/contrib/opensolaris/ (props changed) user/luigi/ipfw3-head/sys/contrib/dev/acpica/ (props changed) user/luigi/ipfw3-head/sys/contrib/pf/ (props changed) user/luigi/ipfw3-head/sys/dev/xen/xenpci/ (props changed) user/luigi/ipfw3-head/usr.bin/csup/ (props changed) user/luigi/ipfw3-head/usr.bin/procstat/ (props changed) user/luigi/ipfw3-head/usr.sbin/zic/ (props changed) Modified: user/luigi/ipfw3-head/bin/pkill/pkill.c ============================================================================== --- user/luigi/ipfw3-head/bin/pkill/pkill.c Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/bin/pkill/pkill.c Tue Dec 29 15:48:51 2009 (r201203) @@ -113,14 +113,14 @@ static int cflags = REG_EXTENDED; static kvm_t *kd; static pid_t mypid; -static struct listhead euidlist = SLIST_HEAD_INITIALIZER(list); -static struct listhead ruidlist = SLIST_HEAD_INITIALIZER(list); -static struct listhead rgidlist = SLIST_HEAD_INITIALIZER(list); -static struct listhead pgrplist = SLIST_HEAD_INITIALIZER(list); -static struct listhead ppidlist = SLIST_HEAD_INITIALIZER(list); -static struct listhead tdevlist = SLIST_HEAD_INITIALIZER(list); -static struct listhead sidlist = SLIST_HEAD_INITIALIZER(list); -static struct listhead jidlist = SLIST_HEAD_INITIALIZER(list); +static struct listhead euidlist = SLIST_HEAD_INITIALIZER(euidlist); +static struct listhead ruidlist = SLIST_HEAD_INITIALIZER(ruidlist); +static struct listhead rgidlist = SLIST_HEAD_INITIALIZER(rgidlist); +static struct listhead pgrplist = SLIST_HEAD_INITIALIZER(pgrplist); +static struct listhead ppidlist = SLIST_HEAD_INITIALIZER(ppidlist); +static struct listhead tdevlist = SLIST_HEAD_INITIALIZER(tdevlist); +static struct listhead sidlist = SLIST_HEAD_INITIALIZER(sidlist); +static struct listhead jidlist = SLIST_HEAD_INITIALIZER(jidlist); static void usage(void) __attribute__((__noreturn__)); static int killact(const struct kinfo_proc *); Modified: user/luigi/ipfw3-head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- user/luigi/ipfw3-head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Dec 29 15:48:51 2009 (r201203) @@ -3488,6 +3488,8 @@ zpool_do_upgrade(int argc, char **argv) (void) printf(gettext(" 11 Improved scrub performance\n")); (void) printf(gettext(" 12 Snapshot properties\n")); (void) printf(gettext(" 13 snapused property\n")); + (void) printf(gettext(" 14 passthrough-x aclinherit " + "support\n")); (void) printf(gettext("For more information on a particular " "version, including supported releases, see:\n\n")); (void) printf("http://www.opensolaris.org/os/community/zfs/" Modified: user/luigi/ipfw3-head/lib/libarchive/Makefile ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/Makefile Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/Makefile Tue Dec 29 15:48:51 2009 (r201203) @@ -34,6 +34,7 @@ SRCS= archive_check_magic.c \ archive_entry_stat.c \ archive_entry_strmode.c \ archive_entry_link_resolver.c \ + archive_entry_xattr.c \ archive_read.c \ archive_read_data_into_fd.c \ archive_read_disk.c \ @@ -223,6 +224,7 @@ MLINKS+= archive_util.3 archive_compress MLINKS+= archive_util.3 archive_compression_name.3 MLINKS+= archive_util.3 archive_errno.3 MLINKS+= archive_util.3 archive_error_string.3 +MLINKS+= archive_util.3 archive_file_count.3 MLINKS+= archive_util.3 archive_format.3 MLINKS+= archive_util.3 archive_format_name.3 MLINKS+= archive_util.3 archive_set_error.3 Modified: user/luigi/ipfw3-head/lib/libarchive/archive.h ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive.h Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive.h Tue Dec 29 15:48:51 2009 (r201203) @@ -35,12 +35,16 @@ * this header! If you must conditionalize, use predefined compiler and/or * platform macros. */ +#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 +# define __LA_STDINT_H +#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) +# define __LA_STDINT_H +#endif #include #include /* Linux requires this for off_t */ -#if !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) -/* Header unavailable on Watcom C or MS Visual C++ or SFU. */ -#include /* int64_t, etc. */ +#ifdef __LA_STDINT_H +# include __LA_STDINT_H /* int64_t, etc. */ #endif #include /* For FILE * */ @@ -53,8 +57,13 @@ # else # define __LA_SSIZE_T long # endif -#define __LA_UID_T unsigned int -#define __LA_GID_T unsigned int +# if defined(__BORLANDC__) +# define __LA_UID_T uid_t +# define __LA_GID_T gid_t +# else +# define __LA_UID_T short +# define __LA_GID_T short +# endif #else #include /* ssize_t, uid_t, and gid_t */ #define __LA_INT64_T int64_t @@ -704,6 +713,7 @@ __LA_DECL void archive_set_error(struc const char *fmt, ...); __LA_DECL void archive_copy_error(struct archive *dest, struct archive *src); +__LA_DECL int archive_file_count(struct archive *); #ifdef __cplusplus } Modified: user/luigi/ipfw3-head/lib/libarchive/archive_check_magic.c ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_check_magic.c Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_check_magic.c Tue Dec 29 15:48:51 2009 (r201203) @@ -50,7 +50,16 @@ __FBSDID("$FreeBSD$"); static void errmsg(const char *m) { - write(2, m, strlen(m)); + size_t s = strlen(m); + ssize_t written; + + while (s > 0) { + written = write(2, m, strlen(m)); + if (written <= 0) + return; + m += written; + s -= written; + } } static void @@ -60,8 +69,7 @@ diediedie(void) /* Cause a breakpoint exception */ DebugBreak(); #endif - *(char *)0 = 1; /* Deliberately segfault and force a coredump. */ - _exit(1); /* If that didn't work, just exit with an error. */ + abort(); /* Terminate the program abnormally. */ } static const char * @@ -85,7 +93,7 @@ write_all_states(unsigned int states) unsigned int lowbit; /* A trick for computing the lowest set bit. */ - while ((lowbit = states & (-states)) != 0) { + while ((lowbit = states & (1 + ~states)) != 0) { states &= ~lowbit; /* Clear the low bit. */ errmsg(state_name(lowbit)); if (states != 0) Copied: user/luigi/ipfw3-head/lib/libarchive/archive_crc32.h (from r201149, head/lib/libarchive/archive_crc32.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw3-head/lib/libarchive/archive_crc32.h Tue Dec 29 15:48:51 2009 (r201203, copy of r201149, head/lib/libarchive/archive_crc32.h) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2009 Joerg Sonnenberger + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + +/* + * When zlib is unavailable, we should still be able to validate + * uncompressed zip archives. That requires us to be able to compute + * the CRC32 check value. This is a drop-in compatible replacement + * for crc32() from zlib. It's slower than the zlib implementation, + * but still pretty fast: This runs about 300MB/s on my 3GHz P4 + * compared to about 800MB/s for the zlib implementation. + */ +static unsigned long +crc32(unsigned long crc, const void *_p, size_t len) +{ + unsigned long crc2, b, i; + const unsigned char *p = _p; + static volatile int crc_tbl_inited = 0; + static unsigned long crc_tbl[256]; + + if (!crc_tbl_inited) { + for (b = 0; b < 256; ++b) { + crc2 = b; + for (i = 8; i > 0; --i) { + if (crc2 & 1) + crc2 = (crc2 >> 1) ^ 0xedb88320UL; + else + crc2 = (crc2 >> 1); + } + crc_tbl[b] = crc2; + } + crc_tbl_inited = 1; + } + + crc = crc ^ 0xffffffffUL; + while (len--) + crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8); + return (crc ^ 0xffffffffUL); +} Modified: user/luigi/ipfw3-head/lib/libarchive/archive_endian.h ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_endian.h Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_endian.h Tue Dec 29 15:48:51 2009 (r201203) @@ -28,6 +28,10 @@ * Borrowed from FreeBSD's */ +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + /* Note: This is a purely internal header! */ /* Do not use this outside of libarchive internal code! */ @@ -41,7 +45,7 @@ * - SGI MIPSpro * - Microsoft Visual C++ 6.0 (supposedly newer versions too) */ -#if defined(__WATCOMC__) || defined(__sgi) +#if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__) #define inline #elif defined(_MSC_VER) #define inline __inline Modified: user/luigi/ipfw3-head/lib/libarchive/archive_entry.c ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_entry.c Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_entry.c Tue Dec 29 15:48:51 2009 (r201203) @@ -32,12 +32,12 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef MAJOR_IN_MKDEV +#if MAJOR_IN_MKDEV #include -#else -#ifdef MAJOR_IN_SYSMACROS +#define HAVE_MAJOR +#elif MAJOR_IN_SYSMACROS #include -#endif +#define HAVE_MAJOR #endif #ifdef HAVE_LIMITS_H #include @@ -75,6 +75,13 @@ __FBSDID("$FreeBSD$"); #undef max #define max(a, b) ((a)>(b)?(a):(b)) +#if !defined(HAVE_MAJOR) && !defined(major) +/* Replacement for major/minor/makedev. */ +#define major(x) ((int)(0x00ff & ((x) >> 8))) +#define minor(x) ((int)(0xffff00ff & (x))) +#define makedev(maj,min) ((0xff00 & ((maj)<<8)) | (0xffff00ff & (min))) +#endif + /* Play games to come up with a suitable makedev() definition. */ #ifdef __QNXNTO__ /* QNX. */ @@ -215,7 +222,7 @@ static const wchar_t * aes_get_wcs(struct aes *aes) { wchar_t *w; - int r; + size_t r; /* Return WCS form if we already have it. */ if (aes->aes_set & AES_SET_WCS) @@ -233,7 +240,7 @@ aes_get_wcs(struct aes *aes) if (w == NULL) __archive_errx(1, "No memory for aes_get_wcs()"); r = mbstowcs(w, aes->aes_mbs.s, wcs_length); - if (r > 0) { + if (r != (size_t)-1 && r != 0) { w[r] = 0; aes->aes_set |= AES_SET_WCS; return (aes->aes_wcs = w); @@ -618,6 +625,12 @@ archive_entry_ino(struct archive_entry * return (entry->ae_stat.aest_ino); } +int64_t +archive_entry_ino64(struct archive_entry *entry) +{ + return (entry->ae_stat.aest_ino); +} + mode_t archive_entry_mode(struct archive_entry *entry) { @@ -818,6 +831,13 @@ archive_entry_set_ino(struct archive_ent } void +archive_entry_set_ino64(struct archive_entry *entry, int64_t ino) +{ + entry->stat_valid = 0; + entry->ae_stat.aest_ino = ino; +} + +void archive_entry_set_hardlink(struct archive_entry *entry, const char *target) { aes_set_mbs(&entry->ae_hardlink, target); @@ -847,6 +867,16 @@ archive_entry_copy_hardlink_w(struct arc entry->ae_set &= ~AE_SET_HARDLINK; } +int +archive_entry_update_hardlink_utf8(struct archive_entry *entry, const char *target) +{ + if (target != NULL) + entry->ae_set |= AE_SET_HARDLINK; + else + entry->ae_set &= ~AE_SET_HARDLINK; + return (aes_update_utf8(&entry->ae_hardlink, target)); +} + void archive_entry_set_atime(struct archive_entry *entry, time_t t, long ns) { @@ -1095,6 +1125,16 @@ archive_entry_copy_symlink_w(struct arch entry->ae_set &= ~AE_SET_SYMLINK; } +int +archive_entry_update_symlink_utf8(struct archive_entry *entry, const char *linkname) +{ + if (linkname != NULL) + entry->ae_set |= AE_SET_SYMLINK; + else + entry->ae_set &= ~AE_SET_SYMLINK; + return (aes_update_utf8(&entry->ae_symlink, linkname)); +} + void archive_entry_set_uid(struct archive_entry *entry, uid_t u) { @@ -1186,7 +1226,7 @@ archive_entry_acl_add_entry_w(struct arc archive_entry_acl_add_entry_w_len(entry, type, permset, tag, id, name, wcslen(name)); } -void +static void archive_entry_acl_add_entry_w_len(struct archive_entry *entry, int type, int permset, int tag, int id, const wchar_t *name, size_t len) { @@ -1595,7 +1635,7 @@ __archive_entry_acl_parse_w(struct archi const wchar_t *end; } field[4], name; - int fields; + int fields, n; int type, tag, permset, id; wchar_t sep; @@ -1615,6 +1655,10 @@ __archive_entry_acl_parse_w(struct archi ++fields; } while (sep == L':'); + /* Set remaining fields to blank. */ + for (n = fields; n < 4; ++n) + field[n].start = field[n].end = NULL; + /* Check for a numeric ID in field 1 or 3. */ id = -1; isint_w(field[1].start, field[1].end, &id); @@ -1626,7 +1670,7 @@ __archive_entry_acl_parse_w(struct archi * Solaris extension: "defaultuser::rwx" is the * default ACL corresponding to "user::rwx", etc. */ - if (field[0].end-field[0].start > 7 + if (field[0].end - field[0].start > 7 && wmemcmp(field[0].start, L"default", 7) == 0) { type = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT; field[0].start += 7; @@ -1653,7 +1697,7 @@ __archive_entry_acl_parse_w(struct archi } else if (prefix_w(field[0].start, field[0].end, L"other")) { if (fields == 2 && field[1].start < field[1].end - && ismode_w(field[1].start, field[2].end, &permset)) { + && ismode_w(field[1].start, field[1].end, &permset)) { /* This is Solaris-style "other:rwx" */ } else if (fields == 3 && field[1].start == field[1].end @@ -1687,98 +1731,6 @@ __archive_entry_acl_parse_w(struct archi } /* - * extended attribute handling - */ - -void -archive_entry_xattr_clear(struct archive_entry *entry) -{ - struct ae_xattr *xp; - - while (entry->xattr_head != NULL) { - xp = entry->xattr_head->next; - free(entry->xattr_head->name); - free(entry->xattr_head->value); - free(entry->xattr_head); - entry->xattr_head = xp; - } - - entry->xattr_head = NULL; -} - -void -archive_entry_xattr_add_entry(struct archive_entry *entry, - const char *name, const void *value, size_t size) -{ - struct ae_xattr *xp; - - for (xp = entry->xattr_head; xp != NULL; xp = xp->next) - ; - - if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL) - /* XXX Error XXX */ - return; - - xp->name = strdup(name); - if ((xp->value = malloc(size)) != NULL) { - memcpy(xp->value, value, size); - xp->size = size; - } else - xp->size = 0; - - xp->next = entry->xattr_head; - entry->xattr_head = xp; -} - - -/* - * returns number of the extended attribute entries - */ -int -archive_entry_xattr_count(struct archive_entry *entry) -{ - struct ae_xattr *xp; - int count = 0; - - for (xp = entry->xattr_head; xp != NULL; xp = xp->next) - count++; - - return count; -} - -int -archive_entry_xattr_reset(struct archive_entry * entry) -{ - entry->xattr_p = entry->xattr_head; - - return archive_entry_xattr_count(entry); -} - -int -archive_entry_xattr_next(struct archive_entry * entry, - const char **name, const void **value, size_t *size) -{ - if (entry->xattr_p) { - *name = entry->xattr_p->name; - *value = entry->xattr_p->value; - *size = entry->xattr_p->size; - - entry->xattr_p = entry->xattr_p->next; - - return (ARCHIVE_OK); - } else { - *name = NULL; - *value = NULL; - *size = (size_t)0; - return (ARCHIVE_WARN); - } -} - -/* - * end of xattr handling - */ - -/* * Parse a string to a positive decimal integer. Returns true if * the string is non-empty and consists only of decimal digits, * false otherwise. @@ -1814,6 +1766,8 @@ ismode_w(const wchar_t *start, const wch { const wchar_t *p; + if (start >= end) + return (0); p = start; *permset = 0; while (p < end) { @@ -1988,6 +1942,18 @@ static struct flag { { "nouunlnk", L"nouunlnk", UF_NOUNLINK, 0 }, { "nouunlink", L"nouunlink", UF_NOUNLINK, 0 }, #endif +#ifdef EXT2_UNRM_FL + { "nouunlink", L"nouunlink", EXT2_UNRM_FL, 0}, +#endif + +#ifdef EXT2_BTREE_FL + { "nobtree", L"nobtree", EXT2_BTREE_FL, 0 }, +#endif + +#ifdef EXT2_ECOMPR_FL + { "nocomperr", L"nocomperr", EXT2_ECOMPR_FL, 0 }, +#endif + #ifdef EXT2_COMPR_FL /* 'c' */ { "nocompress", L"nocompress", EXT2_COMPR_FL, 0 }, #endif @@ -1995,6 +1961,46 @@ static struct flag { #ifdef EXT2_NOATIME_FL /* 'A' */ { "noatime", L"noatime", 0, EXT2_NOATIME_FL}, #endif + +#ifdef EXT2_DIRTY_FL + { "nocompdirty",L"nocompdirty", EXT2_DIRTY_FL, 0}, +#endif + +#ifdef EXT2_COMPRBLK_FL +#ifdef EXT2_NOCOMPR_FL + { "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, EXT2_NOCOMPR_FL}, +#else + { "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, 0}, +#endif +#endif +#ifdef EXT2_DIRSYNC_FL + { "nodirsync", L"nodirsync", EXT2_DIRSYNC_FL, 0}, +#endif +#ifdef EXT2_INDEX_FL + { "nohashidx", L"nohashidx", EXT2_INDEX_FL, 0}, +#endif +#ifdef EXT2_IMAGIC_FL + { "noimagic", L"noimagic", EXT2_IMAGIC_FL, 0}, +#endif +#ifdef EXT3_JOURNAL_DATA_FL + { "nojournal", L"nojournal", EXT3_JOURNAL_DATA_FL, 0}, +#endif +#ifdef EXT2_SECRM_FL + { "nosecuredeletion",L"nosecuredeletion",EXT2_SECRM_FL, 0}, +#endif +#ifdef EXT2_SYNC_FL + { "nosync", L"nosync", EXT2_SYNC_FL, 0}, +#endif +#ifdef EXT2_NOTAIL_FL + { "notail", L"notail", 0, EXT2_NOTAIL_FL}, +#endif +#ifdef EXT2_TOPDIR_FL + { "notopdir", L"notopdir", EXT2_TOPDIR_FL, 0}, +#endif +#ifdef EXT2_RESERVED_FL + { "noreserved", L"noreserved", EXT2_RESERVED_FL, 0}, +#endif + { NULL, NULL, 0, 0 } }; Modified: user/luigi/ipfw3-head/lib/libarchive/archive_entry.h ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_entry.h Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_entry.h Tue Dec 29 15:48:51 2009 (r201203) @@ -40,14 +40,25 @@ #include /* for wchar_t */ #include +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#endif + /* Get appropriate definitions of standard POSIX-style types. */ /* These should match the types used in 'struct stat' */ #if defined(_WIN32) && !defined(__CYGWIN__) #define __LA_INT64_T __int64 -#define __LA_UID_T unsigned int -#define __LA_GID_T unsigned int -#define __LA_DEV_T unsigned int -#define __LA_MODE_T unsigned short +# if defined(__BORLANDC__) +# define __LA_UID_T uid_t +# define __LA_GID_T gid_t +# define __LA_DEV_T dev_t +# define __LA_MODE_T mode_t +# else +# define __LA_UID_T short +# define __LA_GID_T short +# define __LA_DEV_T unsigned int +# define __LA_MODE_T unsigned short +# endif #else #include #define __LA_INT64_T int64_t @@ -194,6 +205,7 @@ __LA_DECL const wchar_t *archive_entry_g __LA_DECL const char *archive_entry_hardlink(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_hardlink_w(struct archive_entry *); __LA_DECL __LA_INO_T archive_entry_ino(struct archive_entry *); +__LA_DECL __LA_INT64_T archive_entry_ino64(struct archive_entry *); __LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *); __LA_DECL time_t archive_entry_mtime(struct archive_entry *); __LA_DECL long archive_entry_mtime_nsec(struct archive_entry *); @@ -227,6 +239,10 @@ __LA_DECL const wchar_t *archive_entry_u __LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long); __LA_DECL void archive_entry_unset_atime(struct archive_entry *); +#if defined(_WIN32) && !defined(__CYGWIN__) +__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *, + BY_HANDLE_FILE_INFORMATION *); +#endif __LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long); __LA_DECL void archive_entry_unset_birthtime(struct archive_entry *); __LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long); @@ -251,7 +267,14 @@ __LA_DECL int archive_entry_update_gname __LA_DECL void archive_entry_set_hardlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_hardlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *); +__LA_DECL int archive_entry_update_hardlink_utf8(struct archive_entry *, const char *); +#if ARCHIVE_VERSION_NUMBER >= 3000000 +/* Starting with libarchive 3.0, this will be synonym for ino64. */ +__LA_DECL void archive_entry_set_ino(struct archive_entry *, __LA_INT64_T); +#else __LA_DECL void archive_entry_set_ino(struct archive_entry *, unsigned long); +#endif +__LA_DECL void archive_entry_set_ino64(struct archive_entry *, __LA_INT64_T); __LA_DECL void archive_entry_set_link(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *); @@ -274,6 +297,7 @@ __LA_DECL void archive_entry_copy_source __LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *); +__LA_DECL int archive_entry_update_symlink_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_uid(struct archive_entry *, __LA_UID_T); __LA_DECL void archive_entry_set_uname(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *); Modified: user/luigi/ipfw3-head/lib/libarchive/archive_entry_link_resolver.c ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_entry_link_resolver.c Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_entry_link_resolver.c Tue Dec 29 15:48:51 2009 (r201203) @@ -249,7 +249,7 @@ find_entry(struct archive_entry_linkreso struct links_entry *le; int hash, bucket; dev_t dev; - ino_t ino; + int64_t ino; /* Free a held entry. */ if (res->spare != NULL) { @@ -264,15 +264,15 @@ find_entry(struct archive_entry_linkreso return (NULL); dev = archive_entry_dev(entry); - ino = archive_entry_ino(entry); - hash = dev ^ ino; + ino = archive_entry_ino64(entry); + hash = (int)(dev ^ ino); /* Try to locate this entry in the links cache. */ bucket = hash % res->number_buckets; for (le = res->buckets[bucket]; le != NULL; le = le->next) { if (le->hash == hash && dev == archive_entry_dev(le->canonical) - && ino == archive_entry_ino(le->canonical)) { + && ino == archive_entry_ino64(le->canonical)) { /* * Decrement link count each time and release * the entry if it hits zero. This saves @@ -350,7 +350,7 @@ insert_entry(struct archive_entry_linkre if (res->number_entries > res->number_buckets * 2) grow_hash(res); - hash = archive_entry_dev(entry) ^ archive_entry_ino(entry); + hash = archive_entry_dev(entry) ^ archive_entry_ino64(entry); bucket = hash % res->number_buckets; /* If we could allocate the entry, record it. */ Modified: user/luigi/ipfw3-head/lib/libarchive/archive_entry_private.h ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_entry_private.h Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_entry_private.h Tue Dec 29 15:48:51 2009 (r201203) @@ -25,6 +25,10 @@ * $FreeBSD$ */ +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + #ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED #define ARCHIVE_ENTRY_PRIVATE_H_INCLUDED @@ -115,7 +119,7 @@ struct archive_entry { int64_t aest_birthtime; uint32_t aest_birthtime_nsec; gid_t aest_gid; - ino_t aest_ino; + int64_t aest_ino; mode_t aest_mode; uint32_t aest_nlink; uint64_t aest_size; Modified: user/luigi/ipfw3-head/lib/libarchive/archive_entry_stat.c ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_entry_stat.c Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_entry_stat.c Tue Dec 29 15:48:51 2009 (r201203) @@ -72,7 +72,7 @@ archive_entry_stat(struct archive_entry st->st_dev = archive_entry_dev(entry); st->st_gid = archive_entry_gid(entry); st->st_uid = archive_entry_uid(entry); - st->st_ino = archive_entry_ino(entry); + st->st_ino = archive_entry_ino64(entry); st->st_nlink = archive_entry_nlink(entry); st->st_rdev = archive_entry_rdev(entry); st->st_size = archive_entry_size(entry); Copied: user/luigi/ipfw3-head/lib/libarchive/archive_entry_xattr.c (from r201149, head/lib/libarchive/archive_entry_xattr.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw3-head/lib/libarchive/archive_entry_xattr.c Tue Dec 29 15:48:51 2009 (r201203, copy of r201149, head/lib/libarchive/archive_entry_xattr.c) @@ -0,0 +1,158 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_LINUX_FS_H +#include /* for Linux file flags */ +#endif +/* + * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h. + * As the include guards don't agree, the order of include is important. + */ +#ifdef HAVE_LINUX_EXT2_FS_H +#include /* for Linux file flags */ +#endif +#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__) +#include /* for Linux file flags */ +#endif +#include +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_WCHAR_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_entry_private.h" + +/* + * extended attribute handling + */ + +void +archive_entry_xattr_clear(struct archive_entry *entry) +{ + struct ae_xattr *xp; + + while (entry->xattr_head != NULL) { + xp = entry->xattr_head->next; + free(entry->xattr_head->name); + free(entry->xattr_head->value); + free(entry->xattr_head); + entry->xattr_head = xp; + } + + entry->xattr_head = NULL; +} + +void +archive_entry_xattr_add_entry(struct archive_entry *entry, + const char *name, const void *value, size_t size) +{ + struct ae_xattr *xp; + + for (xp = entry->xattr_head; xp != NULL; xp = xp->next) + ; + + if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL) + /* XXX Error XXX */ + return; + + xp->name = strdup(name); + if ((xp->value = malloc(size)) != NULL) { + memcpy(xp->value, value, size); + xp->size = size; + } else + xp->size = 0; + + xp->next = entry->xattr_head; + entry->xattr_head = xp; +} + + +/* + * returns number of the extended attribute entries + */ +int +archive_entry_xattr_count(struct archive_entry *entry) +{ + struct ae_xattr *xp; + int count = 0; + + for (xp = entry->xattr_head; xp != NULL; xp = xp->next) + count++; + + return count; +} + +int +archive_entry_xattr_reset(struct archive_entry * entry) +{ + entry->xattr_p = entry->xattr_head; + + return archive_entry_xattr_count(entry); +} + +int +archive_entry_xattr_next(struct archive_entry * entry, + const char **name, const void **value, size_t *size) +{ + if (entry->xattr_p) { + *name = entry->xattr_p->name; + *value = entry->xattr_p->value; + *size = entry->xattr_p->size; + + entry->xattr_p = entry->xattr_p->next; + + return (ARCHIVE_OK); + } else { + *name = NULL; + *value = NULL; + *size = (size_t)0; + return (ARCHIVE_WARN); + } +} + +/* + * end of xattr handling + */ Modified: user/luigi/ipfw3-head/lib/libarchive/archive_platform.h ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_platform.h Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_platform.h Tue Dec 29 15:48:51 2009 (r201203) @@ -25,6 +25,8 @@ * $FreeBSD$ */ +/* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */ + /* * This header is the first thing included in any of the libarchive * source files. As far as possible, platform-specific issues should @@ -50,17 +52,27 @@ #error Oops: No config.h and no pre-built configuration in archive_platform.h. #endif +/* It should be possible to get rid of this by extending the feature-test + * macros to cover Windows API functions, probably along with non-trivial + * refactoring of code to find structures that sit more cleanly on top of + * either Windows or Posix APIs. */ +#if (defined(__WIN32__) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__) +#include "archive_windows.h" +#endif + /* * The config files define a lot of feature macros. The following * uses those macros to select/define replacements and include key * headers as required. */ -/* No non-FreeBSD platform will have __FBSDID, so just define it here. */ -#ifdef __FreeBSD__ -#include /* For __FBSDID */ -#else -/* Just leaving this macro replacement empty leads to a dangling semicolon. */ +/* Get a real definition for __FBSDID if we can */ +#if HAVE_SYS_CDEFS_H +#include +#endif + +/* If not, define it so as to avoid dangling semicolons. */ +#ifndef __FBSDID #define __FBSDID(a) struct _undefined_hack #endif @@ -72,6 +84,26 @@ #include #endif +/* Borland warns about its own constants! */ +#if defined(__BORLANDC__) +# if HAVE_DECL_UINT64_MAX +# undef UINT64_MAX +# undef HAVE_DECL_UINT64_MAX +# endif +# if HAVE_DECL_UINT64_MIN +# undef UINT64_MIN +# undef HAVE_DECL_UINT64_MIN +# endif +# if HAVE_DECL_INT64_MAX +# undef INT64_MAX +# undef HAVE_DECL_INT64_MAX +# endif +# if HAVE_DECL_INT64_MIN +# undef INT64_MIN +# undef HAVE_DECL_INT64_MIN +# endif +#endif + /* Some platforms lack the standard *_MAX definitions. */ #if !HAVE_DECL_SIZE_MAX #define SIZE_MAX (~(size_t)0) Modified: user/luigi/ipfw3-head/lib/libarchive/archive_private.h ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_private.h Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_private.h Tue Dec 29 15:48:51 2009 (r201203) @@ -25,6 +25,10 @@ * $FreeBSD$ */ +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + #ifndef ARCHIVE_PRIVATE_H_INCLUDED #define ARCHIVE_PRIVATE_H_INCLUDED @@ -87,9 +91,11 @@ struct archive { const char *compression_name; /* Position in UNCOMPRESSED data stream. */ - off_t file_position; + int64_t file_position; /* Position in COMPRESSED data stream. */ - off_t raw_position; + int64_t raw_position; + /* Number of file entries processed. */ + int file_count; int archive_error_number; const char *error; @@ -107,4 +113,12 @@ int __archive_parse_options(const char * #define err_combine(a,b) ((a) < (b) ? (a) : (b)) +#if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER <= 1300) +# define ARCHIVE_LITERAL_LL(x) x##i64 +# define ARCHIVE_LITERAL_ULL(x) x##ui64 +#else +# define ARCHIVE_LITERAL_LL(x) x##ll +# define ARCHIVE_LITERAL_ULL(x) x##ull +#endif + #endif Modified: user/luigi/ipfw3-head/lib/libarchive/archive_read.c ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_read.c Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_read.c Tue Dec 29 15:48:51 2009 (r201203) @@ -386,6 +386,7 @@ archive_read_next_header2(struct archive ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, "archive_read_next_header"); + ++_a->file_count; archive_entry_clear(entry); archive_clear_error(&a->archive); Modified: user/luigi/ipfw3-head/lib/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- user/luigi/ipfw3-head/lib/libarchive/archive_read_disk_entry_from_file.c Tue Dec 29 15:48:04 2009 (r201202) +++ user/luigi/ipfw3-head/lib/libarchive/archive_read_disk_entry_from_file.c Tue Dec 29 15:48:51 2009 (r201203) @@ -103,7 +103,7 @@ archive_read_disk_entry_from_file(struct * open file descriptor which we can use in the subsequent lookups. */ if ((S_ISREG(st->st_mode) || S_ISDIR(st->st_mode))) { if (fd < 0) - fd = open(pathname, O_RDONLY | O_NONBLOCK); + fd = open(pathname, O_RDONLY | O_NONBLOCK | O_BINARY); if (fd >= 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Dec 29 16:01:23 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E59D1065676; Tue, 29 Dec 2009 16:01:23 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D45E8FC0C; Tue, 29 Dec 2009 16:01:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBTG1Nuq029050; Tue, 29 Dec 2009 16:01:23 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBTG1NHp029048; Tue, 29 Dec 2009 16:01:23 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912291601.nBTG1NHp029048@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 29 Dec 2009 16:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201205 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 16:01:23 -0000 Author: luigi Date: Tue Dec 29 16:01:22 2009 New Revision: 201205 URL: http://svn.freebsd.org/changeset/base/201205 Log: really need htonl() here Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Tue Dec 29 15:58:10 2009 (r201204) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Tue Dec 29 16:01:22 2009 (r201205) @@ -1367,7 +1367,7 @@ do { \ else if (v == 2) key = htonl(dst_port); else if (v == 3) - key = htons(src_port); + key = htonl(src_port); else if (v == 4 || v == 5) { check_uidgid( (ipfw_insn_u32 *)cmd, From owner-svn-src-user@FreeBSD.ORG Tue Dec 29 18:54:39 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DA61106568D; Tue, 29 Dec 2009 18:54:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2D3888FC2E; Tue, 29 Dec 2009 18:54:39 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id AFFF646B4C; Tue, 29 Dec 2009 13:54:38 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id D63808A01B; Tue, 29 Dec 2009 13:54:37 -0500 (EST) From: John Baldwin To: Luigi Rizzo Date: Tue, 29 Dec 2009 07:46:58 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <200912272213.nBRMDJAC069043@svn.freebsd.org> <20091229021846.U46429@delplex.bde.org> <20091228232151.GA39294@onelab2.iet.unipi.it> In-Reply-To: <20091228232151.GA39294@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912290746.59011.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 29 Dec 2009 13:54:37 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.0 required=4.2 tests=AWL,BAYES_00, DATE_IN_PAST_06_12,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Luigi Rizzo , src-committers@freebsd.org, Bruce Evans , svn-src-user@freebsd.org Subject: Re: svn commit: r201063 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 18:54:39 -0000 On Monday 28 December 2009 6:21:51 pm Luigi Rizzo wrote: > On Tue, Dec 29, 2009 at 02:38:15AM +1100, Bruce Evans wrote: > > On Sun, 27 Dec 2009, Luigi Rizzo wrote: > > > > >Log: > > > use a less obfuscated construct to call the hook/unhook functions > > > > > >Modified: > > > user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c > > > > Better unobfuscation: > > > > >Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c > > >============================================================================== > > >--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 > > >21:58:48 2009 (r201062) > > >+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 > > >22:13:19 2009 (r201063) > > >@@ -329,18 +329,17 @@ ipfw_divert(struct mbuf **m0, int incomi > > >static int > > >ipfw_hook(int onoff, int pf) > > >{ > > >+ const int arg = PFIL_IN | PFIL_OUT | PFIL_WAITOK; > > > > Don't add this obfuscation (a constant used only once stored in a variable > > used only once, just to avoid 2 long lines (1 after my change). > > It is not just that. > > I want to tell humans reading the code that the value used in the > two calls is exactly the same, beyond any chance of misspelling or > misreading the two long lines. > > Then whether or not to store it in a variable is compiler's business, > same as if i use the constant FOO ( #define FOO 0x11122334455667788LL ) > 20 times in a piece of code. Bruce's cute ?: trick for picking which function pointer to invoke avoided that problem FWIW as the flags were only passed once. -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Tue Dec 29 21:41:55 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B68E81065694; Tue, 29 Dec 2009 21:41:55 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 891BC8FC12; Tue, 29 Dec 2009 21:41:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBTLftBa037044; Tue, 29 Dec 2009 21:41:55 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBTLftu3037042; Tue, 29 Dec 2009 21:41:55 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912292141.nBTLftu3037042@svn.freebsd.org> From: Doug Barton Date: Tue, 29 Dec 2009 21:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201221 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 21:41:55 -0000 Author: dougb Date: Tue Dec 29 21:41:55 2009 New Revision: 201221 URL: http://svn.freebsd.org/changeset/base/201221 Log: For the printing of status information to the terminal title bar: 1. Collect the information in update_port(). This is both simpler and more thorough. 2. Make the counts global so that per parent port they will count all of the dependencies all the way down the tree. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Tue Dec 29 21:41:51 2009 (r201220) +++ user/dougb/portmaster/portmaster Tue Dec 29 21:41:55 2009 (r201221) @@ -208,6 +208,8 @@ safe_exit () { # Save state for the parent process to read back in echo "CUR_DEPS='$CUR_DEPS'" >> $IPC_SAVE + echo "num_of_deps='$num_of_deps'" >> $IPC_SAVE + echo "dep_of_deps='$dep_of_deps'" >> $IPC_SAVE if [ -z "$CONFIG_ONLY" ]; then echo "DISPLAY_LIST='$DISPLAY_LIST'" >> $IPC_SAVE echo "INSTALLED_LIST='$INSTALLED_LIST'" >> $IPC_SAVE @@ -1093,8 +1095,6 @@ check_for_updates () { # No need for check_exclude here because it is already # run in the places that call check_for_updates(). check_interactive $iport $port_ver || return 0 - [ -n "$CONFIG_ONLY" ] && num_of_deps=$(( $num_of_deps + 1 )) - dep_of_deps=$(( $dep_of_deps + 1 )) update_port $iport $port_ver || return 1 return 0 } @@ -1655,6 +1655,10 @@ term_printf () { update_port () { local update_to +#[ -n "$CONFIG_ONLY" ] && { echo '' ; echo "Debug> num_deps $num_of_deps"; } + [ -n "$CONFIG_ONLY" ] && num_of_deps=$(( $num_of_deps + 1 )) + dep_of_deps=$(( $dep_of_deps + 1 )) + [ -n "$2" ] && update_to=" to $2" echo "===>>> Launching child to update ${1#$pd/}${update_to}" @@ -1847,9 +1851,6 @@ dependency_check () { check_for_updates $iport $origin || fail 'Update failed' else check_interactive $origin || continue - [ -n "$CONFIG_ONLY" ] && - num_of_deps=$(( $num_of_deps + 1 )) - dep_of_deps=$(( $dep_of_deps + 1 )) update_port $origin fi done From owner-svn-src-user@FreeBSD.ORG Wed Dec 30 03:59:45 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7569A1065670; Wed, 30 Dec 2009 03:59:45 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64ABE8FC0C; Wed, 30 Dec 2009 03:59:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBU3xjaJ046079; Wed, 30 Dec 2009 03:59:45 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBU3xjYp046077; Wed, 30 Dec 2009 03:59:45 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912300359.nBU3xjYp046077@svn.freebsd.org> From: Doug Barton Date: Wed, 30 Dec 2009 03:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201245 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2009 03:59:45 -0000 Author: dougb Date: Wed Dec 30 03:59:45 2009 New Revision: 201245 URL: http://svn.freebsd.org/changeset/base/201245 Log: Bug fix: ======== PM_BUILD_ONLY_LIST should only be set to pm_bol in the command line parser if we are in the parent. Feature expansion: ================== Do a more thorough job of tracking things that should fall into the --packages-build/--delete-build-only category. I.e., if something is a run dependency of a port or ports that themselves are only build dependencies, add it to the build_only_dl_g anyway. New internal: ============= Add a uniquify_list function so that internal lists of variables can be made unique. Start using it for some of the new stuff, and in clean_build_only_list(). Cleanup: ======== Factor out one line of common code for the rundep list in dep_check() Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Wed Dec 30 00:03:36 2009 (r201244) +++ user/dougb/portmaster/portmaster Wed Dec 30 03:59:45 2009 (r201245) @@ -229,6 +229,12 @@ safe_exit () { if [ "$PM_BUILD_ONLY_LIST" = pmp_doing_build_deps ]; then echo "build_only_dl_g='$build_only_dl_g'" >> $IPC_SAVE echo "run_dl_g='$run_dl_g'" >> $IPC_SAVE + rundep_list=`uniquify_list $rundep_list` + echo "rundep_list='$rundep_list'" >> $IPC_SAVE + for f in $rundep_list; do + eval echo "export $f=\'\$$f\'" >> $IPC_SAVE + eval echo "export ${f}_p=\'\$${f}_p\'" >> $IPC_SAVE + done fi [ -n "$PM_DEL_BUILD_ONLY" ] && echo "build_deps_il='$build_deps_il'" >> $IPC_SAVE @@ -451,9 +457,11 @@ for var in "$@" ; do esac done -if [ -n "$PM_PACKAGES_BUILD" -o -n "$PM_DEL_BUILD_ONLY" ]; then - PM_BUILD_ONLY_LIST=pm_bol - export PM_BUILD_ONLY_LIST +if [ "$$" -eq "$PM_PARENT_PID" ]; then # XXXXX!!!!! + if [ -n "$PM_PACKAGES_BUILD" -o -n "$PM_DEL_BUILD_ONLY" ]; then + PM_BUILD_ONLY_LIST=pm_bol + export PM_BUILD_ONLY_LIST + fi fi set -- $newopts @@ -1695,6 +1703,19 @@ update_port () { return 0 } +uniquify_list () { + local item temp_list + + for item in "$@"; do + case "$temp_list" in + *" $item "*) ;; + *) temp_list=" $item $temp_list" ;; + esac + done + + echo $temp_list +} + clean_build_only_list () { local dep temp_bodlg @@ -1705,7 +1726,7 @@ clean_build_only_list () { esac done - build_only_dl_g=" $temp_bodlg " + build_only_dl_g=" `uniquify_list $temp_bodlg` " } dependency_check () { @@ -1736,19 +1757,27 @@ dependency_check () { if [ "$PM_BUILD_ONLY_LIST" = pmp_doing_build_deps ]; then local rundeps dep run_dl build_only_dl - if [ -z "$RECURSE_THOROUGH" ]; then - rundeps=`pm_make run-depends-list | sort -u` + rundeps=`pm_make run-depends-list | sort -u` + if [ -z "$RECURSE_THOROUGH" ]; then for dep in $d_port_list; do case "$rundeps" in - *${dep}*) run_dl="$run_dl $dep" ;; + *${dep}*) +# XXX + varname=`echo ${dep#$pd/} | sed 's#[-+/\.]#_#g'` + rundep_list="$rundep_list $varname" + eval $varname=\"$portdir \$$varname\" + eval ${varname}_p=$dep + eval export $varname ${varname}_p + + run_dl="$run_dl $dep" ;; *) build_only_dl="$build_only_dl $dep" ;; esac done d_port_list="$build_only_dl $run_dl" else - for dep in `pm_make run-depends-list | sort -u`; do + for dep in $rundeps; do run_dl="$run_dl $dep" done build_only_dl=`pm_make build-depends-list | sort -u` @@ -1899,7 +1928,26 @@ post_config () { dep_of_deps=0 if [ -n "$PM_BUILD_ONLY_LIST" ]; then - unset run_dl_g + local var real_rundep deplist dep + + for var in $rundep_list ; do + real_rundep=no + + eval deplist=\$$var + for dep in $deplist ; do + case "$build_only_dl_g" in + *" $pd/$dep "*) ;; + *) real_rundep=yes ; break ;; + esac + done + + [ "$real_rundep" = 'no' ] && + eval build_only_dl_g=\"${build_only_dl_g}\$${var}_p \" + + eval unset $var ${var}_p + done + + unset run_dl_g rundep_list PM_BUILD_ONLY_LIST=pm_bol fi } @@ -2065,8 +2113,8 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S export CONFIG_SEEN_LIST CONFIG_ONLY NO_DEP_UPDATES if [ -n "$PM_BUILD_ONLY_LIST" ]; then - run_dl_g='' ; build_only_dl_g='' - export run_dl_g build_only_dl_g + run_dl_g='' ; build_only_dl_g='' ; rundep_list='' + export run_dl_g build_only_dl_g rundep_list fi if [ -n "$PM_DEL_BUILD_ONLY" ]; then build_deps_il='' ; export build_deps_il From owner-svn-src-user@FreeBSD.ORG Wed Dec 30 10:44:39 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78C0E1065676; Wed, 30 Dec 2009 10:44:39 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67E2F8FC18; Wed, 30 Dec 2009 10:44:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBUAidFC057169; Wed, 30 Dec 2009 10:44:39 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBUAidmj057166; Wed, 30 Dec 2009 10:44:39 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200912301044.nBUAidmj057166@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 30 Dec 2009 10:44:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201255 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2009 10:44:39 -0000 Author: edwin Date: Wed Dec 30 10:44:39 2009 New Revision: 201255 URL: http://svn.freebsd.org/changeset/base/201255 Log: Add licenses. Modified: user/edwin/calendar/dates.c user/edwin/calendar/locale.c user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/dates.c ============================================================================== --- user/edwin/calendar/dates.c Wed Dec 30 08:52:13 2009 (r201254) +++ user/edwin/calendar/dates.c Wed Dec 30 10:44:39 2009 (r201255) @@ -1,3 +1,32 @@ +/*- + * Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD: user/edwin/calendar/calendar.c 201195 2009-12-29 13:14:13Z edwin $"); + #include #include #include Modified: user/edwin/calendar/locale.c ============================================================================== --- user/edwin/calendar/locale.c Wed Dec 30 08:52:13 2009 (r201254) +++ user/edwin/calendar/locale.c Wed Dec 30 10:44:39 2009 (r201255) @@ -1,3 +1,32 @@ +/*- + * Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + #include #include #include Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Wed Dec 30 08:52:13 2009 (r201254) +++ user/edwin/calendar/parsedata.c Wed Dec 30 10:44:39 2009 (r201255) @@ -1,3 +1,29 @@ +/*- + * Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + #include __FBSDID("$FreeBSD: user/edwin/calendar/day.c 200813 2009-12-21 21:17:59Z edwin $"); From owner-svn-src-user@FreeBSD.ORG Wed Dec 30 11:46:39 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C3201065672; Wed, 30 Dec 2009 11:46:39 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 337408FC1C; Wed, 30 Dec 2009 11:46:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBUBkdnw058374; Wed, 30 Dec 2009 11:46:39 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBUBkd4G058372; Wed, 30 Dec 2009 11:46:39 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200912301146.nBUBkd4G058372@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 30 Dec 2009 11:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201256 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2009 11:46:39 -0000 Author: edwin Date: Wed Dec 30 11:46:38 2009 New Revision: 201256 URL: http://svn.freebsd.org/changeset/base/201256 Log: Be able to process dayofweek of a month with a modifier. Modified: user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Wed Dec 30 10:44:39 2009 (r201255) +++ user/edwin/calendar/parsedata.c Wed Dec 30 11:46:38 2009 (r201256) @@ -41,6 +41,7 @@ static int checkmonth(char *s, int *len, static char *getdayofweekname(int i); static int checkdayofweek(char *s, int *len, int *offset, char **dow); static int isonlydigits(char *s, int nostar); +static int indextooffset(char *s); /* * Expected styles: @@ -320,7 +321,7 @@ parsedaymonth(char *date, int *yearp, in char modifierindex[100], specialday[100]; int idayofweek, imonth, idayofmonth, year, index; - int *mondays, d, m, dow, rm, rd; + int *mondays, d, m, dow, rm, rd, offset; /* * CONVENTION @@ -410,6 +411,42 @@ parsedaymonth(char *date, int *yearp, in continue; } + /* A certain dayofweek of a month */ + if (*flags == + (F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) { + offset = indextooffset(modifierindex); + dow = first_dayofweek_of_month(year, imonth); + d = (idayofweek - dow + 8) % 7; + + if (offset > 0) { + while (d <= mondays[imonth]) { + if (--offset == 0 + && remember_ymd(year, imonth, d)) { + remember(index++, yearp, + monthp, dayp, year, imonth, + rd); + continue; + } + d += 7; + } + continue; + } + if (offset < 0) { + while (d <= mondays[imonth]) + d += 7; + while (offset != 0) { + offset++; + d -= 7; + } + if (remember_ymd(year, imonth, d)) + remember(index++, yearp, + monthp, dayp, year, imonth, + rd); + continue; + } + continue; + } + /* Every dayofweek of the month */ if (*flags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { dow = first_dayofweek_of_month(year, imonth); @@ -421,7 +458,6 @@ parsedaymonth(char *date, int *yearp, in d += 7; } continue; - } printf("Unprocessed:\n"); @@ -752,3 +788,20 @@ isonlydigits(char *s, int nostar) return (1); } +static int +indextooffset(char *s) +{ + if (strcasecmp(s, "first") == 0) + return (1); + if (strcasecmp(s, "second") == 0) + return (2); + if (strcasecmp(s, "third") == 0) + return (3); + if (strcasecmp(s, "fourth") == 0) + return (4); + if (strcasecmp(s, "fifth") == 0) + return (5); + if (strcasecmp(s, "last") == 0) + return (-1); + return (0); +} From owner-svn-src-user@FreeBSD.ORG Wed Dec 30 15:46:21 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC62B1065694; Wed, 30 Dec 2009 15:46:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 3FD908FC1B; Wed, 30 Dec 2009 15:46:21 +0000 (UTC) Received: from c220-239-235-55.carlnfd3.nsw.optusnet.com.au (c220-239-235-55.carlnfd3.nsw.optusnet.com.au [220.239.235.55]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id nBUFkCPF015254 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 31 Dec 2009 02:46:15 +1100 Date: Thu, 31 Dec 2009 02:46:11 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: John Baldwin In-Reply-To: <200912290746.59011.jhb@freebsd.org> Message-ID: <20091231021707.J48242@delplex.bde.org> References: <200912272213.nBRMDJAC069043@svn.freebsd.org> <20091229021846.U46429@delplex.bde.org> <20091228232151.GA39294@onelab2.iet.unipi.it> <200912290746.59011.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Luigi Rizzo , src-committers@freebsd.org, Luigi Rizzo , Bruce Evans , svn-src-user@freebsd.org Subject: Re: svn commit: r201063 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2009 15:46:21 -0000 On Tue, 29 Dec 2009, John Baldwin wrote: > On Monday 28 December 2009 6:21:51 pm Luigi Rizzo wrote: >> On Tue, Dec 29, 2009 at 02:38:15AM +1100, Bruce Evans wrote: >>> On Sun, 27 Dec 2009, Luigi Rizzo wrote: >>> >>>> Log: >>>> use a less obfuscated construct to call the hook/unhook functions >>>> >>>> Modified: >>>> user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c >>> >>> Better unobfuscation: >>> >>>> Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c >>> >> ============================================================================== >>>> --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 >>>> 21:58:48 2009 (r201062) >>>> +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 >>>> 22:13:19 2009 (r201063) >>>> @@ -329,18 +329,17 @@ ipfw_divert(struct mbuf **m0, int incomi >>>> static int >>>> ipfw_hook(int onoff, int pf) >>>> { >>>> + const int arg = PFIL_IN | PFIL_OUT | PFIL_WAITOK; >>> >>> Don't add this obfuscation (a constant used only once stored in a variable >>> used only once, just to avoid 2 long lines (1 after my change). >> >> It is not just that. >> >> I want to tell humans reading the code that the value used in the >> two calls is exactly the same, beyond any chance of misspelling or >> misreading the two long lines. >> >> Then whether or not to store it in a variable is compiler's business, >> same as if i use the constant FOO ( #define FOO 0x11122334455667788LL ) >> 20 times in a piece of code. > > Bruce's cute ?: trick for picking which function pointer to invoke avoided > that problem FWIW as the flags were only passed once. ?: also works for all the other function parameter -- you don't have to read them all and compare them to see that they are the same: if (foo) func1(arg1, FOO | BAR | BAZ, arg3, ... argn); else func234(arg1, FOO | BAR | BAZ, arg3, ... argn); It is no easier (or harder) to read all the identifiers and operators to see that arg2 = FOO | BAR | BAZ is the same in both calls as it is to read all the identifiers to see that all the parameters are to same. Not very easy for either when there are lots of identifiers and/or more worse lining up than above. The above lines could be misformatted to make the correspondence clear, provided the function call lines are short: The ?: trick works especially well for variant function calls when all except 1 of the function and the parameters are the same. I also prefer it when it allows writing an assignment in 1 statement of N lines instead of as N statements in > 2*N lines, no matter how many ?:'s this takes. Bruce From owner-svn-src-user@FreeBSD.ORG Thu Dec 31 03:25:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 199B11065692; Thu, 31 Dec 2009 03:25:20 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E64C28FC12; Thu, 31 Dec 2009 03:25:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBV3PRRe084587; Thu, 31 Dec 2009 03:25:27 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBV3PRPV084586; Thu, 31 Dec 2009 03:25:27 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912310325.nBV3PRPV084586@svn.freebsd.org> From: Doug Barton Date: Thu, 31 Dec 2009 03:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201322 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 03:25:20 -0000 Author: dougb Date: Thu Dec 31 03:25:27 2009 New Revision: 201322 URL: http://svn.freebsd.org/changeset/base/201322 Log: The options needed for pkg_add were not introduced until version 6.4, so check for that if the appropriate options are enabled. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Thu Dec 31 01:38:12 2009 (r201321) +++ user/dougb/portmaster/portmaster Thu Dec 31 03:25:27 2009 (r201322) @@ -462,6 +462,10 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then PM_BUILD_ONLY_LIST=pm_bol export PM_BUILD_ONLY_LIST fi + if [ -n "$PM_PACKAGES" -o -n "$PM_PACKAGES_BUILD" ]; then + [ `/sbin/sysctl -n kern.osreldate 2>/dev/null` -lt 600400 ] && + fail Package installation support requires FreeBSD 6.4 or newer + fi fi set -- $newopts From owner-svn-src-user@FreeBSD.ORG Thu Dec 31 04:16:13 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFA31106568B; Thu, 31 Dec 2009 04:16:13 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D48A18FC13; Thu, 31 Dec 2009 04:16:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBV4GDOQ085591; Thu, 31 Dec 2009 04:16:13 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBV4GDRC085589; Thu, 31 Dec 2009 04:16:13 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912310416.nBV4GDRC085589@svn.freebsd.org> From: Doug Barton Date: Thu, 31 Dec 2009 04:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201324 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 04:16:14 -0000 Author: dougb Date: Thu Dec 31 04:16:13 2009 New Revision: 201324 URL: http://svn.freebsd.org/changeset/base/201324 Log: Restore command line flags for pkg_add as they are in the ports version (long options) ala 2.16. The problem with FreeBSD older than 6.4 is not the option format, it's the existince of the option itself (or lack thereof). Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Thu Dec 31 04:07:13 2009 (r201323) +++ user/dougb/portmaster/portmaster Thu Dec 31 04:16:13 2009 (r201324) @@ -2874,8 +2874,7 @@ else [ -n "$local_package" ] && ppd=${local_package%/Latest*}/All echo "===>>> Installing package" - # -i == --no-deps, -f == --force - pkg_add -i -f ${ppd}/${latest_pv}.tbz || + pkg_add --no-deps --force ${ppd}/${latest_pv}.tbz || install_failed ${latest_pv}.tbz fi echo '' From owner-svn-src-user@FreeBSD.ORG Thu Dec 31 06:09:33 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F5F7106573F; Thu, 31 Dec 2009 06:09:33 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E40F8FC16; Thu, 31 Dec 2009 06:09:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBV69Xch087896; Thu, 31 Dec 2009 06:09:33 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBV69XIS087894; Thu, 31 Dec 2009 06:09:33 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912310609.nBV69XIS087894@svn.freebsd.org> From: Doug Barton Date: Thu, 31 Dec 2009 06:09:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201326 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 06:09:33 -0000 Author: dougb Date: Thu Dec 31 06:09:32 2009 New Revision: 201326 URL: http://svn.freebsd.org/changeset/base/201326 Log: Now that the bugfix has been committed, remove the XXX Even though it's probably already obvious, add a hint as to what the non-default option is for the y/n prompts. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Thu Dec 31 04:16:18 2009 (r201325) +++ user/dougb/portmaster/portmaster Thu Dec 31 06:09:32 2009 (r201326) @@ -457,7 +457,7 @@ for var in "$@" ; do esac done -if [ "$$" -eq "$PM_PARENT_PID" ]; then # XXXXX!!!!! +if [ "$$" -eq "$PM_PARENT_PID" ]; then if [ -n "$PM_PACKAGES_BUILD" -o -n "$PM_DEL_BUILD_ONLY" ]; then PM_BUILD_ONLY_LIST=pm_bol export PM_BUILD_ONLY_LIST @@ -577,7 +577,7 @@ IFS=' echo " ===>>> but there is no installed version" echo '' if [ -n "$CHECK_DEPENDS" ]; then - echo -n " ===>>> Delete this dependency data? [n] " + echo -n " ===>>> Delete this dependency data? y/[n] " read answer case "$answer" in [yY]) unset prev_line line ; continue ;; @@ -784,7 +784,7 @@ if [ -n "$CLEAN_DISTFILES" ]; then echo "===>>> Deleting $f" pm_unlink $df else - echo -n "===>>> Delete stale file: ${f}? [y] " + echo -n "===>>> Delete stale file: ${f}? n/[y] " read answer case "$answer" in [nN]*) continue ;; @@ -892,7 +892,7 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then *) [ -n "$PM_VERBOSE" ] && echo '' echo '' echo " ===>>> $dbdir does not seem to be installed" - echo -n " ===>>> Delete ${dir}? [n] " + echo -n " ===>>> Delete ${dir}? y/[n] " read answer case "$answer" in [yY]) pm_rm_s -rf $dir ;; @@ -1273,7 +1273,7 @@ find_and_delete_distfiles () { continue fi - echo -n "===>>> Delete $file? [n] " + echo -n "===>>> Delete $file? y/[n] " read answer case "$answer" in [yY]) pm_unlink $file ;; @@ -1353,7 +1353,7 @@ delete_stale_distfiles () { continue fi - echo -n "===>>> Delete $file? [n] " + echo -n "===>>> Delete $file? y/[n] " read answer case "$answer" in [yY]) pm_unlink $file ;; @@ -1389,7 +1389,7 @@ delete_all_distfiles () { echo '' if [ -n "$dist_list_files" ]; then echo "===>>> However, the list of files in $dist_list" - echo -n " should be current. Delete the files on this list? [n] " + echo -n " should be current. Delete the files on this list? y/[n] " local answer f ; read answer case "$answer" in [yY]) for f in $dist_list_files; do @@ -1410,11 +1410,11 @@ delete_all_distfiles () { delete_all=delete_all else echo "===>>> Delete old and new distfiles for $origin" - echo -n " without prompting? [n] " + echo -n " without prompting? y/[n] " local answer ; read answer case "$answer" in [yY]) delete_all=delete_all2 ;; - *) echo -n "===>>> Delete the current distfiles? [n] " + *) echo -n "===>>> Delete the current distfiles? y/[n] " read answer case "$answer" in [yY]) delete_current=delete_current ;; @@ -1495,7 +1495,7 @@ if [ -n "$EXPUNGE" ]; then dep=${dep%/+CON*} ; echo " ${dep##*/}" done echo '' - echo -n "===>>> Delete this dependency data? [n] " + echo -n "===>>> Delete this dependency data? y/[n] " read answer case "$answer" in [yY]) for f in $deplist; do @@ -1541,7 +1541,7 @@ if [ -n "$CLEAN_STALE" ]; then pkg_info $iport - echo -n "===>>> ${iport} is no longer depended on, delete? [n] " + echo -n "===>>> ${iport} is no longer depended on, delete? y/[n] " read answer case "$answer" in [yY]) if [ -n "$BACKUP" ]; then @@ -1558,7 +1558,7 @@ if [ -n "$CLEAN_STALE" ]; then exec $0 -s $ARGS ;; - *) echo -n " ===>>> Keep listing $iport as a dependency? [n] " + *) echo -n " ===>>> Keep listing $iport as a dependency? y/[n] " read answer case "$answer" in [yY]) no_del_list="${no_del_list}${iport}:" ;; @@ -1606,7 +1606,7 @@ check_interactive () { echo "===>>> +IGNOREME file is present for $1" fi - echo '' ; echo -n "===>>> Update ${1}${update_to}? [y] " + echo '' ; echo -n "===>>> Update ${1}${update_to}? n/[y] " local answer ; read answer case "$answer" in [nN]*) INTERACTIVE_NO="${INTERACTIVE_NO}${1}:" ; return 1 ;; @@ -2094,13 +2094,13 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S files=`find $pdb -type f -name PM_UPGRADE_DONE_FLAG` if [ -n "$files" ]; then echo "===>>> There are 'install complete' flags from a previous" - echo -n " -[rf] run of ${0##*/}, delete them? [n] " + echo -n " -[rf] run of ${0##*/}, delete them? y/[n] " read answer case "$answer" in [yY]) [ -n "$PM_SU_VERBOSE" ] && echo "===>>> Deleting 'install complete' flags" pm_find_s $pdb -type f -name PM_UPGRADE_DONE_FLAG -delete ;; - *) echo -n "===>>> Enable the -R option? [n] " + *) echo -n "===>>> Enable the -R option? y/[n] " read answer case "$answer" in [yY]) RESTART=Ropt ; ARGS="-R $ARGS" ;; @@ -2341,7 +2341,7 @@ if [ -e "$pdb/$upg_port/+IGNOREME" ]; th echo '' echo "===>>> $upg_port has an +IGNOREME file" echo '' - echo -n "===>>> Update anyway? [n] " + echo -n "===>>> Update anyway? y/[n] " read answer case "$answer" in [yY]) ;; # Let it build From owner-svn-src-user@FreeBSD.ORG Thu Dec 31 07:06:01 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3741B106568B for ; Thu, 31 Dec 2009 07:06:01 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from monday.kientzle.com (kientzle.com [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id B0FAA8FC0C for ; Thu, 31 Dec 2009 07:06:00 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.3/8.14.3) id nBV6csjx046243; Thu, 31 Dec 2009 06:38:54 GMT (envelope-from kientzle@freebsd.org) Received: from dark.x.kientzle.com (fw2.kientzle.com [10.123.1.2]) by kientzle.com with SMTP id gjwug4v4tmb9zbexg4vre3g35w; Thu, 31 Dec 2009 06:38:53 +0000 (UTC) (envelope-from kientzle@freebsd.org) Message-ID: <4B3C4716.9020806@freebsd.org> Date: Wed, 30 Dec 2009 22:39:18 -0800 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.21) Gecko/20090601 SeaMonkey/1.1.16 MIME-Version: 1.0 To: Doug Barton References: <200912310609.nBV69XIS087894@svn.freebsd.org> In-Reply-To: <200912310609.nBV69XIS087894@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r201326 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 07:06:01 -0000 Doug Barton wrote: > Even though it's probably already obvious, add a hint as to what the > non-default option is for the y/n prompts. > - echo -n " ===>>> Delete this dependency data? [n] " > + echo -n " ===>>> Delete this dependency data? y/[n] " I've seen this done a little more clearly by using an uppercase letter to indicate the default: [Y/n] Tim From owner-svn-src-user@FreeBSD.ORG Thu Dec 31 07:28:14 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DAD71065672; Thu, 31 Dec 2009 07:28:14 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B98C8FC13; Thu, 31 Dec 2009 07:28:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBV7SD4Y089580; Thu, 31 Dec 2009 07:28:13 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBV7SDxU089576; Thu, 31 Dec 2009 07:28:13 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200912310728.nBV7SDxU089576@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 31 Dec 2009 07:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201328 - user/edwin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 07:28:14 -0000 Author: edwin Date: Thu Dec 31 07:28:13 2009 New Revision: 201328 URL: http://svn.freebsd.org/changeset/base/201328 Log: As requested by Robert Watson: - Properly assign copyright for locale.c, since it came from day.c - Non-pseuonymous dates.c and parsedata.c Modified: user/edwin/calendar/dates.c user/edwin/calendar/locale.c user/edwin/calendar/parsedata.c Modified: user/edwin/calendar/dates.c ============================================================================== --- user/edwin/calendar/dates.c Thu Dec 31 06:59:15 2009 (r201327) +++ user/edwin/calendar/dates.c Thu Dec 31 07:28:13 2009 (r201328) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved. + * Copyright (c) 1992-2009 Edwin Groothuis. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: user/edwin/calendar/locale.c ============================================================================== --- user/edwin/calendar/locale.c Thu Dec 31 06:59:15 2009 (r201327) +++ user/edwin/calendar/locale.c Thu Dec 31 07:28:13 2009 (r201328) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved. + * Copyright (c) 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -9,11 +10,18 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -21,7 +29,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * */ #include Modified: user/edwin/calendar/parsedata.c ============================================================================== --- user/edwin/calendar/parsedata.c Thu Dec 31 06:59:15 2009 (r201327) +++ user/edwin/calendar/parsedata.c Thu Dec 31 07:28:13 2009 (r201328) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved. + * Copyright (c) 1992-2009 Edwin Groothuis. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-user@FreeBSD.ORG Thu Dec 31 07:58:08 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8153610656AD; Thu, 31 Dec 2009 07:58:08 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F5528FC1F; Thu, 31 Dec 2009 07:58:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBV7w8D5090352; Thu, 31 Dec 2009 07:58:08 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBV7w8cN090350; Thu, 31 Dec 2009 07:58:08 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912310758.nBV7w8cN090350@svn.freebsd.org> From: Doug Barton Date: Thu, 31 Dec 2009 07:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201332 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 07:58:08 -0000 Author: dougb Date: Thu Dec 31 07:58:08 2009 New Revision: 201332 URL: http://svn.freebsd.org/changeset/base/201332 Log: New Feature: ============ At the end of the config phase print the list of what is about to be done, and prompt the user on whether to proceed or not. This requires some infrastructure in update_port() to keep the list of what to do, and in post_config() to do the printing and prompting. This needs refinement for multiports. Internal Cleanups: ================== 1. Instead of saving some of the new variables unconditionally in safe_exit(), move the things that are only done in the config phase to that section, and move build_deps_il to the !config section. 2. Do a more thorough job with the terminal escape sequences. It now works in -a mode (although not thoroughly tested). This required some annoying twiddling of spaces and such with PM_DEPTH, but so far it seems "ok." 3. Rename init_parent_port to init_term_printf which is more accurate and less confusing. 4. Since $new_port may be set as a side effect of the new feature above, conditionalize it when we get there in the "main" process. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Thu Dec 31 07:34:38 2009 (r201331) +++ user/dougb/portmaster/portmaster Thu Dec 31 07:58:08 2009 (r201332) @@ -208,11 +208,13 @@ safe_exit () { # Save state for the parent process to read back in echo "CUR_DEPS='$CUR_DEPS'" >> $IPC_SAVE - echo "num_of_deps='$num_of_deps'" >> $IPC_SAVE echo "dep_of_deps='$dep_of_deps'" >> $IPC_SAVE if [ -z "$CONFIG_ONLY" ]; then echo "DISPLAY_LIST='$DISPLAY_LIST'" >> $IPC_SAVE echo "INSTALLED_LIST='$INSTALLED_LIST'" >> $IPC_SAVE + + [ -n "$PM_DEL_BUILD_ONLY" ] && + echo "build_deps_il='$build_deps_il'" >> $IPC_SAVE elif [ -z "$NO_DEP_UPDATES" ]; then echo 'unset NO_DEP_UPDATES' >> $IPC_SAVE fi @@ -226,18 +228,6 @@ safe_exit () { fi [ -n "$URB_YES" ] && echo "URB_DONE_LIST='$URB_DONE_LIST'" >> $IPC_SAVE - if [ "$PM_BUILD_ONLY_LIST" = pmp_doing_build_deps ]; then - echo "build_only_dl_g='$build_only_dl_g'" >> $IPC_SAVE - echo "run_dl_g='$run_dl_g'" >> $IPC_SAVE - rundep_list=`uniquify_list $rundep_list` - echo "rundep_list='$rundep_list'" >> $IPC_SAVE - for f in $rundep_list; do - eval echo "export $f=\'\$$f\'" >> $IPC_SAVE - eval echo "export ${f}_p=\'\$${f}_p\'" >> $IPC_SAVE - done - fi - [ -n "$PM_DEL_BUILD_ONLY" ] && - echo "build_deps_il='$build_deps_il'" >> $IPC_SAVE fi exit ${1:-0} @@ -1667,19 +1657,30 @@ term_printf () { update_port () { local update_to -#[ -n "$CONFIG_ONLY" ] && { echo '' ; echo "Debug> num_deps $num_of_deps"; } - [ -n "$CONFIG_ONLY" ] && num_of_deps=$(( $num_of_deps + 1 )) dep_of_deps=$(( $dep_of_deps + 1 )) [ -n "$2" ] && update_to=" to $2" + if [ -n "$CONFIG_ONLY" ]; then + num_of_deps=$(( $num_of_deps + 1 )) + case "$1" in + */*) build_l="${build_l}\tInstall $1\n" ;; + *) build_l="${build_l}\tUpgrade ${1#$pd/}${update_to}\n" ;; + esac +#echo '' ; echo "Debug> num_deps $num_of_deps" + fi + echo "===>>> Launching child to update ${1#$pd/}${update_to}" if [ -n "$PM_DEPTH" ]; then - echo " $PM_DEPTH >> ${1#$pd/}" - term_printf " >> ${1#$pd/} (${dep_of_deps}/${num_of_deps})" + echo " ${PM_DEPTH}>> ${1#$pd/}" +term_printf "${PM_DEPTH#$PM_PARENT_PORT}>> ${1#$pd/} (${dep_of_deps}/${num_of_deps})" else + if [ -n "$UPDATE_ALL" ]; then + term_printf " >> ${1#$pd/} (${dep_of_deps}/${num_of_deps})" + else #echo '' ; echo "Debug> NO PM_DEPTH HERE" ; echo '' + fi fi [ -n "$doing_dep_check" -o \ @@ -1695,6 +1696,7 @@ update_port () { fi if [ -n "$UPDATE_ALL" ]; then + term_printf " (${num_of_deps})" echo "===>>> Returning to update check of installed ports" echo '' elif [ -n "$UPDATE_REQ_BYS" ]; then @@ -1702,6 +1704,7 @@ update_port () { elif [ -n "$CONFIG_ONLY" -a -z "$PM_PACKAGES" ]; then echo "===>>> Continuing 'make config' dependency check for $portdir" else +term_printf "${PM_DEPTH#$PM_PARENT_PORT}(${dep_of_deps}/${num_of_deps})" echo "===>>> Returning to dependency check for $portdir" fi return 0 @@ -1914,7 +1917,34 @@ create_master_rb_list () { } post_config () { - local action + local num answer action + + [ $num_of_deps -gt 0 ] && num=" (${num_of_deps})" + term_printf "$num" + +# XXX + echo '' + echo "===>>> If you choose to proceed, the following will be done:" + if [ -z "$UPDATE_ALL" ]; then +# XXX Needs something here for multiport() + if [ -n "$upg_port" ]; then + cd $pd/$portdir && new_port=`pm_make -V PKGNAME` + case `pkg_version -t $upg_port $new_port` in + \<) echo " Upgrade $upg_port to $new_port" ;; + =) echo " Re-install $upg_port" ;; + \>) echo " Downgrade $upg_port to $new_port" ;; + esac + else + echo " Install $portdir" + fi + fi + [ -n "$build_l" ] && echo -e "$build_l" + echo -n "===>>> Proceed? n/[y] " + read answer + case "$answer" in + [nN]*) safe_exit ;; + esac + unset build_l action=build if [ "$PM_PACKAGES" = only ]; then @@ -1948,15 +1978,19 @@ post_config () { [ "$real_rundep" = 'no' ] && eval build_only_dl_g=\"${build_only_dl_g}\$${var}_p \" +#[ "$real_rundep" = 'no' ] && printf "\nDebug> Inserting $var into bodlg\n\n" + eval unset $var ${var}_p done +#echo "Debug> build_only_dl_g: X${build_only_dl_g}X" ; echo '' + unset run_dl_g rundep_list PM_BUILD_ONLY_LIST=pm_bol fi } -init_parent_port () { +init_term_printf () { PM_PARENT_PORT=$1 num_of_deps=0 dep_of_deps=0 @@ -2027,7 +2061,7 @@ multiport () { num=1 for port in $worklist; do - init_parent_port "$port ${num}/${numports}" + init_term_printf "$port ${num}/${numports}" ($0 $ARGS $port) || fail "Update for $port failed" . $IPC_SAVE num=$(( $num + 1 )) @@ -2051,7 +2085,7 @@ multiport () { continue fi ;; esac - init_parent_port "$port ${num}/${numports}" + init_term_printf "$port ${num}/${numports}" ($0 $ARGS $port) || fail "Update for $port failed" . $IPC_SAVE num=$(( $num + 1 )) @@ -2113,8 +2147,8 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S if [ -z "$NO_RECURSIVE_CONFIG" ]; then CONFIG_SEEN_LIST=':' ; CONFIG_ONLY=config_only - NO_DEP_UPDATES=no_dep_updates - export CONFIG_SEEN_LIST CONFIG_ONLY NO_DEP_UPDATES + NO_DEP_UPDATES=no_dep_updates ; build_l='' + export CONFIG_SEEN_LIST CONFIG_ONLY NO_DEP_UPDATES build_l if [ -n "$PM_BUILD_ONLY_LIST" ]; then run_dl_g='' ; build_only_dl_g='' ; rundep_list='' @@ -2172,7 +2206,7 @@ all_config () { } [ -n "$DI_FILES" ] && (read_distinfos)& - init_parent_port All + init_term_printf All ports_by_category echo "===>>> Starting check of installed ports for available updates" @@ -2373,10 +2407,10 @@ case "$CONFIG_SEEN_LIST" in *:${portdir} pm_cd $pd/$portdir || no_valid_port if [ -z "$PM_DEPTH" ]; then - PM_DEPTH=${upg_port:-$portdir} - [ -z "$PM_PARENT_PORT" ] && init_parent_port $portdir + PM_DEPTH="${upg_port:-$portdir} " + [ -z "$PM_PARENT_PORT" ] && init_term_printf ${upg_port:-$portdir} else - PM_DEPTH="$PM_DEPTH >> ${upg_port:-$portdir}" + PM_DEPTH="${PM_DEPTH}>> ${upg_port:-$portdir} " fi echo '' @@ -2468,6 +2502,21 @@ if [ -n "$CONFIG_ONLY" ]; then if [ ! "$$" -eq "$PM_PARENT_PID" ]; then # Save state for the parent process to read back in echo "CONFIG_SEEN_LIST='$CONFIG_SEEN_LIST'" > $IPC_SAVE +# XXX config + echo "num_of_deps='$num_of_deps'" >> $IPC_SAVE + echo "build_l='$build_l'" >> $IPC_SAVE + + if [ "$PM_BUILD_ONLY_LIST" = pmp_doing_build_deps ]; then + echo "build_only_dl_g='$build_only_dl_g'" >> $IPC_SAVE + echo "run_dl_g='$run_dl_g'" >> $IPC_SAVE + rundep_list=`uniquify_list $rundep_list` + echo "rundep_list='$rundep_list'" >> $IPC_SAVE + for f in $rundep_list; do + eval echo "export $f=\'\$$f\'" >> $IPC_SAVE + eval echo "export ${f}_p=\'\$${f}_p\'" >> $IPC_SAVE + done + fi + safe_exit elif [ -n "$UPDATE_REQ_BYS" ]; then export URB_YES=urb_yes @@ -2546,7 +2595,7 @@ if [ -n "$NO_ACTION" -a -z "$CONFIG_ONLY safe_exit fi -new_port=`pm_make -V PKGNAME` +[ -z "$new_port" ] && new_port=`pm_make -V PKGNAME` if [ -n "$PM_PACKAGES" -o "$PM_PACKAGES_BUILD" = doing_build_only_dep ]; then fetch_package () { From owner-svn-src-user@FreeBSD.ORG Thu Dec 31 18:28:40 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A4FC1065698; Thu, 31 Dec 2009 18:28:40 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6623A8FC18; Thu, 31 Dec 2009 18:28:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBVISeql073688; Thu, 31 Dec 2009 18:28:40 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBVISeOm073676; Thu, 31 Dec 2009 18:28:40 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912311828.nBVISeOm073676@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 31 Dec 2009 18:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201346 - in user/luigi/ipfw3-head/sys: net netgraph netinet netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2009 18:28:40 -0000 Author: luigi Date: Thu Dec 31 18:28:40 2009 New Revision: 201346 URL: http://svn.freebsd.org/changeset/base/201346 Log: snapshot (probably not compiling) Modified: user/luigi/ipfw3-head/sys/net/if_bridge.c user/luigi/ipfw3-head/sys/net/if_ethersubr.c user/luigi/ipfw3-head/sys/netgraph/ng_ipfw.c user/luigi/ipfw3-head/sys/netinet/ip_divert.c user/luigi/ipfw3-head/sys/netinet/ip_divert.h user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Modified: user/luigi/ipfw3-head/sys/net/if_bridge.c ============================================================================== --- user/luigi/ipfw3-head/sys/net/if_bridge.c Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/net/if_bridge.c Thu Dec 31 18:28:40 2009 (r201346) @@ -3040,25 +3040,26 @@ bridge_pfil(struct mbuf **mp, struct ifn } /* XXX this section is also in if_ethersubr.c */ - if (V_ip_fw_chk_ptr && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { + // XXX PFIL_OUT or DIR_OUT ? + if (V_ip_fw_chk_ptr && pfil_ipfw != 0 && + dir == PFIL_OUT && ifp != NULL) { struct m_tag *mtag; error = -1; - mtag = m_tag_find(*mp, PACKET_TAG_DUMMYNET, NULL); + /* fetch the start point from existing tags, if any */ + mtag = m_tag_locate(*mp, MTAG_IPFW_RULE, 0, NULL); if (mtag == NULL) { - args.slot = 0; + args.rule.slot = 0; } else { struct dn_pkt_tag *dn_tag; + /* XXX can we free the tag after use ? */ mtag->m_tag_id = PACKET_TAG_NONE; dn_tag = (struct dn_pkt_tag *)(mtag + 1); - if (dn_tag->slot != 0 && V_fw_one_pass) - /* packet already partially processed */ + /* packet already partially processed ? */ + if (dn_tag->rule.slot != 0 && V_fw_one_pass) goto ipfwpass; - args.slot = dn_tag->slot; /* next rule to use */ - args.chain_id = dn_tag->chain_id; - args.rulenum = dn_tag->rulenum; - args.rule_id = dn_tag->rule_id; + args.rule = dn_tag->rule; } args.m = *mp; Modified: user/luigi/ipfw3-head/sys/net/if_ethersubr.c ============================================================================== --- user/luigi/ipfw3-head/sys/net/if_ethersubr.c Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/net/if_ethersubr.c Thu Dec 31 18:28:40 2009 (r201346) @@ -469,21 +469,20 @@ ether_ipfw_chk(struct mbuf **m0, struct struct ip_fw_args args; struct m_tag *mtag; - mtag = m_tag_find(*m0, PACKET_TAG_DUMMYNET, NULL); + /* fetch start point from rule, if any */ + mtag = m_tag_locate(*m0, MTAG_IPFW_RULE, 0, NULL); if (mtag == NULL) { - args.slot = 0; + args.rule.slot = 0; } else { struct dn_pkt_tag *dn_tag; + /* XXX can we free it after use ? */ mtag->m_tag_id = PACKET_TAG_NONE; dn_tag = (struct dn_pkt_tag *)(mtag + 1); - if (dn_tag->slot != 0 && V_fw_one_pass) + if (dn_tag->rule.slot != 0 && V_fw_one_pass) /* dummynet packet, already partially processed */ return (1); - args.slot = dn_tag->slot; /* matching rule to restart */ - args.rulenum = dn_tag->rulenum; - args.rule_id = dn_tag->rule_id; - args.chain_id = dn_tag->chain_id; + args.rule = dn_tag->rule; } /* Modified: user/luigi/ipfw3-head/sys/netgraph/ng_ipfw.c ============================================================================== --- user/luigi/ipfw3-head/sys/netgraph/ng_ipfw.c Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netgraph/ng_ipfw.c Thu Dec 31 18:28:40 2009 (r201346) @@ -221,19 +221,20 @@ ng_ipfw_findhook1(node_p node, u_int16_t static int ng_ipfw_rcvdata(hook_p hook, item_p item) { - struct ng_ipfw_tag *ngit; + struct ipfw_start_info *ngit; struct mbuf *m; NGI_GET_M(item, m); NG_FREE_ITEM(item); - if ((ngit = (struct ng_ipfw_tag *)m_tag_locate(m, NGM_IPFW_COOKIE, 0, - NULL)) == NULL) { + ngit = (struct ipfw_start_info *) + m_tag_locate(m, NGM_IPFW_COOKIE, 0, NULL); + if (ngit == NULL) { NG_FREE_M(m); return (EINVAL); /* XXX: find smth better */ }; - switch (ngit->dir) { + switch (ngit->info) { case DIR_OUT: { struct ip *ip; @@ -263,7 +264,7 @@ static int ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_args *fwa, int tee) { struct mbuf *m; - struct ng_ipfw_tag *ngit; + struct ipfw_start_info *ngit; struct ip *ip; hook_p hook; int error = 0; @@ -284,21 +285,21 @@ ng_ipfw_input(struct mbuf **m0, int dir, * a copy of a packet and forward it into netgraph without a tag. */ if (tee == 0) { + struct m_tag *tag; + struct ipfw_start_info *ngit; m = *m0; *m0 = NULL; /* it belongs now to netgraph */ - if ((ngit = (struct ng_ipfw_tag *)m_tag_alloc(NGM_IPFW_COOKIE, - 0, TAGSIZ, M_NOWAIT|M_ZERO)) == NULL) { + tag = m_tag_alloc(NGM_IPFW_COOKIE, sizeof(*mt), + M_NOWAIT|M_ZERO); + if (tagn == NULL) { m_freem(m); return (ENOMEM); } - ngit->slot = fwa->slot; - ngit->rulenum = fwa->rulenum; - ngit->rule_id = fwa->rule_id; - ngit->chain_id = fwa->chain_id; - ngit->dir = dir; -// ngit->ifp = fwa->oif; /* XXX do we use it ? */ - m_tag_prepend(m, &ngit->mt); + ngit = (struct ipfw_start_info *)(tag + 1); + *ngit = fwa->start + ngit->info = dir; + m_tag_prepend(m, tag); } else if ((m = m_dup(*m0, M_DONTWAIT)) == NULL) Modified: user/luigi/ipfw3-head/sys/netinet/ip_divert.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_divert.c Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netinet/ip_divert.c Thu Dec 31 18:28:40 2009 (r201346) @@ -72,10 +72,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include +#include #ifdef SCTP #include #endif @@ -301,6 +301,9 @@ divert_packet(struct mbuf *m, int incomi /* Put packet on socket queue, if any */ sa = NULL; nport = htons((u_int16_t)divert_info(mtag)); + printf("divert rule %d %s to port %d\n", divsrc.sin_port, + incoming ? "in" : "out", + ntohs(nport)); INP_INFO_RLOCK(&V_divcbinfo); LIST_FOREACH(inp, &V_divcb, inp_list) { /* XXX why does only one socket match? */ @@ -339,7 +342,7 @@ div_output(struct socket *so, struct mbu struct mbuf *control) { struct m_tag *mtag; - struct divert_tag *dt; + struct ipfw_rule_ref *dt; int error = 0; struct mbuf *options; @@ -354,23 +357,35 @@ div_output(struct socket *so, struct mbu if (control) m_freem(control); /* XXX */ - if ((mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL)) == NULL) { - mtag = m_tag_get(PACKET_TAG_DIVERT, sizeof(struct divert_tag), - M_NOWAIT | M_ZERO); + mtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL); + if (mtag == NULL) { + /* this should be normal */ + printf("create divert tag\n"); + mtag = m_tag_alloc(MTAG_IPFW_RULE, 0, + sizeof(struct ipfw_rule_ref), M_NOWAIT | M_ZERO); if (mtag == NULL) { error = ENOBUFS; goto cantsend; } - dt = (struct divert_tag *)(mtag+1); m_tag_prepend(m, mtag); - } else - dt = (struct divert_tag *)(mtag+1); + } + dt = (struct ipfw_rule_ref *)(mtag+1); + printf("%s sin %p dst rule %d addr 0x%x\n", __FUNCTION__, + sin, sin? sin->sin_port : -1, + sin ? sin->sin_addr.s_addr : 0xdeaddead); /* Loopback avoidance and state recovery */ if (sin) { int i; - dt->cookie = sin->sin_port; + /* set the starting point. We provide a non-zero slot, + * but a non_matching chain_id to skip that info and use + * the rulenum/rule_id. + */ + dt->slot = 1; /* dummy, chain_id is invalid */ + dt->chain_id = 0; + dt->rulenum = sin->sin_port+1; /* host format ? */ + dt->rule_id = 0; /* * Find receive interface with the given name, stuffed * (if it exists) in the sin_zero[] field. @@ -455,6 +470,7 @@ div_output(struct socket *so, struct mbu } } else { dt->info |= IP_FW_DIVERT_LOOPBACK_FLAG; + printf("divert to loopback\n"); if (m->m_pkthdr.rcvif == NULL) { /* * No luck with the name, check by IP address. @@ -467,6 +483,7 @@ div_output(struct socket *so, struct mbu sin->sin_port = 0; ifa = ifa_ifwithaddr((struct sockaddr *) sin); if (ifa == NULL) { + printf("%s ifa not found ???\n", __FUNCTION__); error = EADDRNOTAVAIL; goto cantsend; } Modified: user/luigi/ipfw3-head/sys/netinet/ip_divert.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_divert.h Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netinet/ip_divert.h Thu Dec 31 18:28:40 2009 (r201346) @@ -45,10 +45,6 @@ SYSCTL_DECL(_net_inet_divert); /* * Divert socket definitions. */ -struct divert_tag { - u_int32_t info; /* port & flags */ - u_int16_t cookie; /* ipfw rule number */ -}; /* * Return the divert cookie associated with the mbuf; if any. @@ -56,13 +52,7 @@ struct divert_tag { static __inline u_int16_t divert_cookie(struct m_tag *mtag) { - return ((struct divert_tag *)(mtag+1))->cookie; -} -static __inline u_int16_t -divert_find_cookie(struct mbuf *m) -{ - struct m_tag *mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL); - return mtag ? divert_cookie(mtag) : 0; + return ((struct ipfw_rule_ref *)(mtag+1))->rulenum; } /* @@ -71,13 +61,7 @@ divert_find_cookie(struct mbuf *m) static __inline u_int32_t divert_info(struct m_tag *mtag) { - return ((struct divert_tag *)(mtag+1))->info; -} -static __inline u_int32_t -divert_find_info(struct mbuf *m) -{ - struct m_tag *mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL); - return mtag ? divert_info(mtag) : 0; + return ((struct ipfw_rule_ref *)(mtag+1))->info; } typedef void ip_divert_packet_t(struct mbuf *m, int incoming); Modified: user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netinet/ip_dummynet.h Thu Dec 31 18:28:40 2009 (r201346) @@ -114,11 +114,7 @@ struct dn_heap { * other forms of packet reinjection. */ struct dn_pkt_tag { - /* first part, reinject info */ - uint32_t slot; /* slot of next rule to use */ - uint32_t rulenum; /* matching rule number */ - uint32_t rule_id; /* matching rule id */ - uint32_t chain_id; /* ruleset id */ + struct ipfw_rule_ref rule; /* matching rule */ /* second part, dummynet specific */ int dn_dir; /* action when packet comes out. */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Thu Dec 31 18:28:40 2009 (r201346) @@ -468,7 +468,7 @@ heap_free(struct dn_heap *h) */ static __inline void *dn_free_pkt(struct mbuf *m) { - m_freem(m); + FREE_PKT(m); return NULL; } @@ -975,8 +975,10 @@ dummynet_send(struct mbuf *m) dst = DIR_DROP; } else { struct dn_pkt_tag *pkt = dn_tag_get(m); + /* extract the dummynet info, rename the tag */ dst = pkt->dn_dir; ifp = pkt->ifp; + // XXX rename the tag } switch (dst) { @@ -1364,7 +1366,7 @@ dummynet_io(struct mbuf **m0, int dir, s struct dn_pipe *pipe; uint64_t len = m->m_pkthdr.len; struct dn_flow_queue *q = NULL; - int is_pipe = fwa->cookie & 0x8000000 ? 0 : 1; + int is_pipe = fwa->rule.info & 0x8000000 ? 0 : 1; KASSERT(m->m_nextpkt == NULL, ("dummynet_io: mbuf queue passed to dummynet")); @@ -1378,11 +1380,11 @@ dummynet_io(struct mbuf **m0, int dir, s * below can be simplified. */ if (is_pipe) { - pipe = locate_pipe(fwa->cookie & 0xffff); + pipe = locate_pipe(fwa->rule.info & 0xffff); if (pipe != NULL) fs = &(pipe->fs); } else - fs = locate_flowset(fwa->cookie & 0xffff); + fs = locate_flowset(fwa->rule.info & 0xffff); if (fs == NULL) goto dropit; /* This queue/pipe does not exist! */ @@ -1428,12 +1430,8 @@ dummynet_io(struct mbuf **m0, int dir, s * Ok, i can handle the pkt now... * Build and enqueue packet + parameters. */ - pkt->slot = fwa->slot; - pkt->rulenum = fwa->rulenum; - pkt->rule_id = fwa->rule_id; - pkt->chain_id = fwa->chain_id; + pkt->rule = fwa->rule; pkt->dn_dir = dir; - pkt->ifp = fwa->oif; if (q->head == NULL) Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Thu Dec 31 18:28:40 2009 (r201346) @@ -560,7 +560,7 @@ send_reject6(struct ip_fw_args *args, in ip6_output(m0, NULL, NULL, 0, NULL, NULL, NULL); } - m_freem(m); + FREE_PKT(m); } else if (code != ICMP6_UNREACH_RST) { /* Send an ICMPv6 unreach. */ #if 0 /* @@ -576,7 +576,7 @@ send_reject6(struct ip_fw_args *args, in #endif icmp6_error(m, ICMP6_DST_UNREACH, code, 0); } else - m_freem(m); + FREE_PKT(m); args->m = NULL; } @@ -616,9 +616,9 @@ send_reject(struct ip_fw_args *args, int if (m != NULL) ip_output(m, NULL, NULL, 0, NULL, NULL); } - m_freem(args->m); + FREE_PKT(args->m); } else - m_freem(args->m); + FREE_PKT(args->m); args->m = NULL; } @@ -707,16 +707,18 @@ check_uidgid(ipfw_insn_u32 *insn, int pr } /* - * Helper function to write the matching rule into args + * Helper function to set args with info on the rule after the matching + * one. slot is precise, whereas we guess rule_id as they are + * assigned sequentially. */ static inline void set_match(struct ip_fw_args *args, int slot, struct ip_fw_chain *chain) { - args->chain_id = chain->id; - args->slot = slot + 1; /* we use 0 as a marker */ - args->rule_id = chain->map[slot]->id; - args->rulenum = chain->map[slot]->rulenum; + args->rule.chain_id = chain->id; + args->rule.slot = slot + 1; /* we use 0 as a marker */ + args->rule.rule_id = 1 + chain->map[slot]->id; + args->rule.rulenum = chain->map[slot]->rulenum; } /* @@ -741,7 +743,7 @@ set_match(struct ip_fw_args *args, int s * args->rule Pointer to the last matching rule (in/out) * args->next_hop Socket we are forwarding to (out). * args->f_id Addresses grabbed from the packet (out) - * args->cookie a cookie depending on rule action + * args->rule.info a cookie depending on rule action * * Return value: * @@ -751,6 +753,8 @@ set_match(struct ip_fw_args *args, int s * IP_FW_TEE tee packet, port in m_tag * IP_FW_DUMMYNET to dummynet, pipe in args->cookie * IP_FW_NETGRAPH into netgraph, cookie args->cookie + * args->rule contains the matching rule, + * args->rule.info has additional information. * */ int @@ -1133,45 +1137,25 @@ do { \ IPFW_RUNLOCK(chain); return (IP_FW_PASS); /* accept */ } - /* XXX divert should be handled same as other tags */ - mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL); - if (args->slot) { + if (args->rule.slot) { /* * Packet has already been tagged as a result of a previous * match on rule args->rule aka args->rule_id (PIPE, QUEUE, - * REASS, NETGRAPH and similar, never a skipto). + * REASS, NETGRAPH, DIVERT/TEE...) * Validate the slot and continue from the next one * if still present, otherwise do a lookup. */ - if (V_fw_one_pass) { - IPFW_RUNLOCK(chain); - return (IP_FW_PASS); - } - f_pos = (args->chain_id == chain->id) ? - args->slot /* already incremented */ : - ipfw_find_rule(chain, args->rulenum, args->rule_id+1); + f_pos = (args->rule.chain_id == chain->id) ? + args->rule.slot : + ipfw_find_rule(chain, args->rule.rulenum, + args->rule.rule_id); } else { - /* - * Find the starting rule. It can be either the first - * one, or the one after divert_rule if asked so. - */ - int skipto = mtag ? divert_cookie(mtag) : 0; - f_pos = 0; - if (args->eh == NULL && skipto != 0) { - if (skipto >= IPFW_DEFAULT_RULE) { - IPFW_RUNLOCK(chain); - return (IP_FW_DENY); /* invalid */ - } - f_pos = ipfw_find_rule(chain, skipto+1, 0); - } } - /* reset divert rule to avoid confusion later */ - if (mtag) { +#if 0 // XXX to be fixed divinput_flags = divert_info(mtag) & (IP_FW_DIVERT_OUTPUT_FLAG | IP_FW_DIVERT_LOOPBACK_FLAG); - m_tag_delete(m, mtag); - } +#endif /* * Now scan the rules, and parse microinstructions for each rule. @@ -1761,12 +1745,13 @@ do { \ if (cmd->len & F_NOT) { /* `untag' action */ if (mtag != NULL) m_tag_delete(m, mtag); + match = 0; } else if (mtag == NULL) { if ((mtag = m_tag_alloc(MTAG_IPFW, tag, 0, M_NOWAIT)) != NULL) m_tag_prepend(m, mtag); + match = 1; } - match = (cmd->len & F_NOT) ? 0: 1; break; } @@ -1916,10 +1901,10 @@ do { \ case O_PIPE: case O_QUEUE: set_match(args, f_pos, chain); - args->cookie = (cmd->arg1 == IP_FW_TABLEARG) ? + args->rule.info = (cmd->arg1 == IP_FW_TABLEARG) ? tablearg : cmd->arg1; if (cmd->opcode == O_QUEUE) - args->cookie |= 0x80000000; + args->rule.info |= 0x80000000; retval = IP_FW_DUMMYNET; l = 0; /* exit inner loop */ done = 1; /* exit outer loop */ @@ -1932,23 +1917,9 @@ do { \ /* otherwise this is terminal */ l = 0; /* exit inner loop */ done = 1; /* exit outer loop */ - mtag = m_tag_get(PACKET_TAG_DIVERT, - sizeof(struct divert_tag), - M_NOWAIT); - if (mtag == NULL) { - retval = IP_FW_DENY; - } else { - struct divert_tag *dt; - dt = (struct divert_tag *)(mtag+1); - dt->cookie = f->rulenum; - if (cmd->arg1 == IP_FW_TABLEARG) - dt->info = tablearg; - else - dt->info = cmd->arg1; - m_tag_prepend(m, mtag); - retval = (cmd->opcode == O_DIVERT) ? - IP_FW_DIVERT : IP_FW_TEE; - } + set_match(args, f_pos, chain); + args->rule.info = (cmd->arg1 == IP_FW_TABLEARG) ? + tablearg : cmd->arg1; break; case O_COUNT: @@ -2064,7 +2035,7 @@ do { \ case O_NETGRAPH: case O_NGTEE: set_match(args, f_pos, chain); - args->cookie = (cmd->arg1 == IP_FW_TABLEARG) ? + args->rule.info = (cmd->arg1 == IP_FW_TABLEARG) ? tablearg : cmd->arg1; retval = (cmd->opcode == O_NETGRAPH) ? IP_FW_NETGRAPH : IP_FW_NGTEE; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_dynamic.c Thu Dec 31 18:28:40 2009 (r201346) @@ -917,7 +917,7 @@ ipfw_send_pkt(struct mbuf *replyto, stru #endif default: /* XXX: log me?!? */ - m_freem(m); + FREE_PKT(m); return (NULL); } dir = ((flags & (TH_SYN | TH_RST)) == TH_SYN); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Thu Dec 31 18:28:40 2009 (r201346) @@ -106,8 +106,7 @@ ipfw_check_hook(void *arg, struct mbuf * struct inpcb *inp) { struct ip_fw_args args; - struct ng_ipfw_tag *ng_tag; - struct m_tag *dn_tag; + struct m_tag *tag; int ipfw; int ret; #ifdef IPFIREWALL_FORWARD @@ -118,29 +117,11 @@ ipfw_check_hook(void *arg, struct mbuf * dir = (dir == PFIL_IN) ? DIR_IN : DIR_OUT; bzero(&args, sizeof(args)); - ng_tag = (struct ng_ipfw_tag *)m_tag_locate(*m0, NGM_IPFW_COOKIE, 0, - NULL); - if (ng_tag != NULL) { - KASSERT(ng_tag->dir == dir, - ("ng_ipfw tag with wrong direction")); - args.slot = ng_tag->slot; - args.rulenum = ng_tag->rulenum; - args.rule_id = ng_tag->rule_id; - args.chain_id = ng_tag->chain_id; - m_tag_delete(*m0, (struct m_tag *)ng_tag); - } - again: - dn_tag = m_tag_find(*m0, PACKET_TAG_DUMMYNET, NULL); - if (dn_tag != NULL) { - struct dn_pkt_tag *dt; - - dt = (struct dn_pkt_tag *)(dn_tag+1); - args.slot = dt->slot; - args.rulenum = dt->rulenum; - args.rule_id = dt->rule_id; - args.chain_id = dt->chain_id; - m_tag_delete(*m0, dn_tag); + tag = m_tag_locate(*m0, MTAG_IPFW_RULE, 0, NULL); + if (tag != NULL) { + args.rule = *((struct ipfw_rule_ref *)(tag+1)); + m_tag_delete(*m0, tag); } args.m = *m0; @@ -150,7 +131,7 @@ again: /* all the processing now uses ip_len in net format */ SET_NET_IPLEN(mtod(*m0, struct ip *)); - if (V_fw_one_pass == 0 || args.slot == 0) { + if (V_fw_one_pass == 0 || args.rule.slot == 0) { ipfw = ipfw_chk(&args); *m0 = args.m; } else @@ -224,15 +205,19 @@ again: ret = EACCES; break; /* i.e. drop */ } - ipfw_divert(m0, dir, (ipfw == IP_FW_TEE) ? 1 : 0); - if (*m0) { - /* continue processing for this one. We set - * args.slot=0, but the divert tag is processed - * in ipfw_chk to jump to the right place. - */ - args.slot = 0; - goto again; /* continue with packet */ + tag = m_tag_alloc(MTAG_IPFW_RULE, 0, + sizeof(struct ipfw_rule_ref), M_NOWAIT); + if (tag == NULL) { + ret = EACCES; + break; /* i.e. drop */ } + *((struct ipfw_rule_ref *)(tag+1)) = args.rule; + m_tag_prepend(*m0, tag); + + ipfw_divert(m0, dir, (ipfw == IP_FW_TEE) ? 1 : 0); + /* continue processing for the original packet (tee) */ + if (*m0) + goto again; break; case IP_FW_NGTEE: @@ -257,7 +242,7 @@ again: if (ret != 0) { if (*m0) - m_freem(*m0); + FREE_PKT(*m0); *m0 = NULL; } if (*m0) Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Thu Dec 31 18:02:48 2009 (r201345) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Thu Dec 31 18:28:40 2009 (r201346) @@ -36,6 +36,7 @@ #ifdef _KERNEL #define MTAG_IPFW 1148380143 /* IPFW-tagged cookie */ +#define MTAG_IPFW_RULE 1262273568 /* rule reference */ /* Return values from ipfw_chk() */ enum { @@ -70,6 +71,20 @@ struct _ip6dn_args { }; /* + * Reference to an ipfw rule that can be carried outside critical sections. + * A rule is identified by rulenum:rule_id which is ordered. + * In version chain_id the rule can be found in slot 'slot', so + * we don't need a lookup if chain_id == chain->id. + */ +struct ipfw_rule_ref { + uint32_t slot; /* slot for matching rule */ + uint32_t rulenum; /* matching rule number */ + uint32_t rule_id; /* matching rule id */ + uint32_t chain_id; /* ruleset id */ + uint32_t info; /* reason for reinject */ +}; + +/* * Arguments for calling ipfw_chk() and dummynet_io(). We put them * all into a structure because this way it is easier and more * efficient to pass variables around and extend the interface. @@ -79,19 +94,19 @@ struct ip_fw_args { struct ifnet *oif; /* output interface */ struct sockaddr_in *next_hop; /* forward address */ - /* chain_id validates 'slot', the location of the pointer to - * a matching rule. - * If invalid, we can lookup the rule using rule_id and rulenum + /* + * On return, it points to the matching rule. + * On entry, rule.slot > 0 means the info is valid and + * contains the the starting rule for an ipfw search. + * If chain_id == chain->id && slot >0 then jump to that slot. + * Otherwise, we locate the first rule >= rulenum:rule_id */ - uint32_t slot; /* slot for matching rule */ - uint32_t rulenum; /* matching rule number */ - uint32_t rule_id; /* matching rule id */ - uint32_t chain_id; /* ruleset id */ + struct ipfw_rule_ref rule; /* match/restart info */ struct ether_header *eh; /* for bridged packets */ struct ipfw_flow_id f_id; /* grabbed from IP header */ - uint32_t cookie; /* a cookie depending on rule action */ + //uint32_t cookie; /* a cookie depending on rule action */ struct inpcb *inp; struct _ip6dn_args dummypar; /* dummynet->ip6_output */ @@ -122,6 +137,9 @@ enum { /* PROTO_OLDBDG = 0x14, unused, old bridge */ }; +/* wrapper for freeing a packet, in case we need to do more work */ +#define FREE_PKT(m) m_freem(m) + /* * Function definitions. */ @@ -277,18 +295,6 @@ typedef int ng_ipfw_input_t(struct mbuf extern ng_ipfw_input_t *ng_ipfw_input_p; #define NG_IPFW_LOADED (ng_ipfw_input_p != NULL) -struct ng_ipfw_tag { - struct m_tag mt; /* tag header */ - /* reinject info */ - uint32_t slot; /* slot for next rule */ - uint32_t rulenum; /* matching rule number */ - uint32_t rule_id; /* matching rule id */ - uint32_t chain_id; /* ruleset id */ - int dir; - -// struct ifnet *ifp; /* interface, for ip_output */ -}; - #define TAGSIZ (sizeof(struct ng_ipfw_tag) - sizeof(struct m_tag))