CVS commit: src/lib/libc/stdlib
Module Name:src Committed By: gutteridge Date: Tue Nov 15 22:17:53 UTC 2022 Modified Files: src/lib/libc/stdlib: posix_openpt.3 Log Message: posix_openpt.3: add a history section To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/libc/stdlib/posix_openpt.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/stdlib/posix_openpt.3 diff -u src/lib/libc/stdlib/posix_openpt.3:1.9 src/lib/libc/stdlib/posix_openpt.3:1.10 --- src/lib/libc/stdlib/posix_openpt.3:1.9 Tue Oct 4 01:46:18 2022 +++ src/lib/libc/stdlib/posix_openpt.3 Tue Nov 15 22:17:53 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: posix_openpt.3,v 1.9 2022/10/04 01:46:18 gutteridge Exp $ +.\" $NetBSD: posix_openpt.3,v 1.10 2022/11/15 22:17:53 gutteridge Exp $ .\" .\" Copyright (c) 2004 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 4, 2022 +.Dd November 15, 2022 .Dt POSIX_OPENPT 3 .Os .Sh NAME @@ -98,3 +98,8 @@ The .Fn posix_openpt function conforms to .St -p1003.1-2001 . +.Sh HISTORY +This function first appeared in +.Nx 3 . +Support for non-standard flags appeared in +.Nx 10 .
CVS commit: src/lib/libc/stdlib
Module Name:src Committed By: gutteridge Date: Tue Nov 15 22:17:53 UTC 2022 Modified Files: src/lib/libc/stdlib: posix_openpt.3 Log Message: posix_openpt.3: add a history section To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/libc/stdlib/posix_openpt.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/blocklist/libexec
Module Name:src Committed By: christos Date: Tue Nov 15 21:05:00 UTC 2022 Modified Files: src/external/bsd/blocklist/libexec: blocklistd-helper Log Message: More ipfilter fixes (Jose Luis Duran) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/blocklist/libexec/blocklistd-helper Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/blocklist/libexec
Module Name:src Committed By: christos Date: Tue Nov 15 21:05:00 UTC 2022 Modified Files: src/external/bsd/blocklist/libexec: blocklistd-helper Log Message: More ipfilter fixes (Jose Luis Duran) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/blocklist/libexec/blocklistd-helper Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/blocklist/libexec/blocklistd-helper diff -u src/external/bsd/blocklist/libexec/blocklistd-helper:1.6 src/external/bsd/blocklist/libexec/blocklistd-helper:1.7 --- src/external/bsd/blocklist/libexec/blocklistd-helper:1.6 Tue Nov 15 15:58:50 2022 +++ src/external/bsd/blocklist/libexec/blocklistd-helper Tue Nov 15 16:05:00 2022 @@ -14,10 +14,18 @@ if [ -f "/etc/ipfw-blocklist.rc" ]; then pf="ipfw" . /etc/ipfw-blocklist.rc ipfw_offset=${ipfw_offset:-2000} -elif [ -f "/etc/ipfilter.conf" ]; then - pf="ipf" else - for f in npf pf ipf; do + # ipfilter NetBSD, FreeBSD, Linux + for f in /etc/ipf.conf /etc/ipf.rules /etc/netscript/ipfilter.conf; do + if [ -f "$f" ]; then + pf="ipf" + break + fi + done +fi + +if [ -z "$pf" ]; then + for f in npf pf; do if [ -f "/etc/$f.conf" ]; then pf="$f" break
CVS commit: src/external/bsd/blocklist/libexec
Module Name:src Committed By: christos Date: Tue Nov 15 20:58:50 UTC 2022 Modified Files: src/external/bsd/blocklist/libexec: blocklistd-helper Log Message: NetBSD uses ipf.conf for ipfilter not ipfilter.conf (Hose Luis Duran) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/blocklist/libexec/blocklistd-helper Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/blocklist/libexec/blocklistd-helper diff -u src/external/bsd/blocklist/libexec/blocklistd-helper:1.5 src/external/bsd/blocklist/libexec/blocklistd-helper:1.6 --- src/external/bsd/blocklist/libexec/blocklistd-helper:1.5 Wed Oct 12 15:50:29 2022 +++ src/external/bsd/blocklist/libexec/blocklistd-helper Tue Nov 15 15:58:50 2022 @@ -14,10 +14,10 @@ if [ -f "/etc/ipfw-blocklist.rc" ]; then pf="ipfw" . /etc/ipfw-blocklist.rc ipfw_offset=${ipfw_offset:-2000} -fi - -if [ -z "$pf" ]; then - for f in npf pf ipfilter; do +elif [ -f "/etc/ipfilter.conf" ]; then + pf="ipf" +else + for f in npf pf ipf; do if [ -f "/etc/$f.conf" ]; then pf="$f" break
CVS commit: src/external/bsd/blocklist/libexec
Module Name:src Committed By: christos Date: Tue Nov 15 20:58:50 UTC 2022 Modified Files: src/external/bsd/blocklist/libexec: blocklistd-helper Log Message: NetBSD uses ipf.conf for ipfilter not ipfilter.conf (Hose Luis Duran) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/blocklist/libexec/blocklistd-helper Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/evbmips/conf
Module Name:src Committed By: simonb Date: Tue Nov 15 14:49:14 UTC 2022 Modified Files: src/sys/arch/evbmips/conf: MIPSSIM Log Message: Enable CD9660; noticed by he@. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbmips/conf/MIPSSIM Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbmips/conf/MIPSSIM diff -u src/sys/arch/evbmips/conf/MIPSSIM:1.6 src/sys/arch/evbmips/conf/MIPSSIM:1.7 --- src/sys/arch/evbmips/conf/MIPSSIM:1.6 Sun Aug 7 02:52:25 2022 +++ src/sys/arch/evbmips/conf/MIPSSIM Tue Nov 15 14:49:14 2022 @@ -1,4 +1,4 @@ -# $NetBSD: MIPSSIM,v 1.6 2022/08/07 02:52:25 simonb Exp $ +# $NetBSD: MIPSSIM,v 1.7 2022/11/15 14:49:14 simonb Exp $ # # Kernel config for the QEMU MIPS "mipssim" simulator # @@ -8,7 +8,7 @@ include "arch/evbmips/conf/std.mipssim" -#ident "GENERIC-$Revision: 1.6 $" +#ident "GENERIC-$Revision: 1.7 $" maxusers 32 @@ -61,7 +61,7 @@ file-system FDESC # user file descripto #file-system UMAPFS # uid/gid remapping filesystem #file-system LFS # Log-based filesystem (still experimental) file-system PROCFS # /proc -#file-system CD9660 # ISO 9660 + Rock Ridge file system +file-system CD9660 # ISO 9660 + Rock Ridge file system file-system UNION # union file system #file-system MSDOSFS # MS-DOS FAT filesystem(s). #file-system CODA # Coda File System; also needs vcoda (below)
CVS commit: src/sys/arch/evbmips/conf
Module Name:src Committed By: simonb Date: Tue Nov 15 14:49:14 UTC 2022 Modified Files: src/sys/arch/evbmips/conf: MIPSSIM Log Message: Enable CD9660; noticed by he@. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbmips/conf/MIPSSIM Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/riscv/conf
Module Name:src Committed By: simonb Date: Tue Nov 15 14:44:05 UTC 2022 Modified Files: src/sys/arch/riscv/conf: GENERIC Log Message: Include GENERIC.local if it exists. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/riscv/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/riscv/conf/GENERIC diff -u src/sys/arch/riscv/conf/GENERIC:1.18 src/sys/arch/riscv/conf/GENERIC:1.19 --- src/sys/arch/riscv/conf/GENERIC:1.18 Sat Nov 12 11:14:44 2022 +++ src/sys/arch/riscv/conf/GENERIC Tue Nov 15 14:44:04 2022 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.18 2022/11/12 11:14:44 simonb Exp $ +# $NetBSD: GENERIC,v 1.19 2022/11/15 14:44:04 simonb Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/riscv/conf/std.riscv64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.18 $" +#ident "GENERIC-$Revision: 1.19 $" maxusers 64 # estimated number of users @@ -183,3 +183,5 @@ pseudo-device drvctl options PAX_MPROTECT=0 # PaX mprotect(2) restrictions options PAX_ASLR=0 # PaX Address Space Layout Randomization + +cinclude "arch/riscv/conf/GENERIC.local"
CVS commit: src/sys/arch/riscv/conf
Module Name:src Committed By: simonb Date: Tue Nov 15 14:44:05 UTC 2022 Modified Files: src/sys/arch/riscv/conf: GENERIC Log Message: Include GENERIC.local if it exists. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/riscv/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/riscv
Module Name:src Committed By: simonb Date: Tue Nov 15 14:33:34 UTC 2022 Modified Files: src/sys/arch/riscv/include: sysreg.h src/sys/arch/riscv/riscv: pmap_machdep.c riscv_machdep.c vm_machdep.c Log Message: Use similar macro-magic to aarch64 armreg.h to add per-csr read/write/set-bits/clear-bits inline functions. Keep the open-coded 32-bit version of riscvreg_cycle_read() than reads a 64-bit cycle counter values. Added benefit of fixing these so that the inline asm uses __volatile and aren't opmtimised to nops by the compiler. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/riscv/include/sysreg.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/riscv/riscv/pmap_machdep.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/riscv/riscv/riscv_machdep.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/riscv/include/sysreg.h diff -u src/sys/arch/riscv/include/sysreg.h:1.24 src/sys/arch/riscv/include/sysreg.h:1.25 --- src/sys/arch/riscv/include/sysreg.h:1.24 Sun Nov 13 08:13:55 2022 +++ src/sys/arch/riscv/include/sysreg.h Tue Nov 15 14:33:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: sysreg.h,v 1.24 2022/11/13 08:13:55 skrll Exp $ */ +/* $NetBSD: sysreg.h,v 1.25 2022/11/15 14:33:33 simonb Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -104,7 +104,64 @@ riscvreg_fcsr_write_frm(uint32_t __new) return __SHIFTOUT(__old, FCSR_FRM); } + +#define RISCVREG_READ_INLINE(regname) \ +static inline uintptr_t \ +csr_##regname##_read(void) \ +{ \ + uintptr_t __rv; \ + asm volatile("csrr %0, " #regname : "=r"(__rv) :: "memory"); \ + return __rv; \ +} + +#define RISCVREG_WRITE_INLINE(regname) \ +static inline void \ +csr_##regname##_write(uintptr_t __val) \ +{ \ + asm volatile("csrw " #regname ", %0" :: "r"(__val) : "memory"); \ +} + +#define RISCVREG_SET_INLINE(regname) \ +static inline void \ +csr_##regname##_set(uintptr_t __mask) \ +{ \ + if (__builtin_constant_p(__mask) && __mask < 0x20) { \ + asm volatile("csrsi " #regname ", %0" :: "i"(__mask) : \ + "memory"); \ + } else { \ + asm volatile("csrs " #regname ", %0" :: "r"(__mask) : \ + "memory"); \ + }\ +} + +#define RISCVREG_CLEAR_INLINE(regname) \ +static inline void \ +csr_##regname##_clear(uintptr_t __mask) \ +{ \ + if (__builtin_constant_p(__mask) && __mask < 0x20) { \ + asm volatile("csrci " #regname ", %0" :: "i"(__mask) : \ + "memory"); \ + } else { \ + asm volatile("csrc " #regname ", %0" :: "r"(__mask) : \ + "memory"); \ + }\ +} + +#define RISCVREG_READ_WRITE_INLINE(regname)\ +RISCVREG_READ_INLINE(regname) \ +RISCVREG_WRITE_INLINE(regname) +#define RISCVREG_SET_CLEAR_INLINE(regname)\ +RISCVREG_SET_INLINE(regname) \ +RISCVREG_CLEAR_INLINE(regname) +#define RISCVREG_READ_SET_CLEAR_INLINE(regname)\ +RISCVREG_READ_INLINE(regname) \ +RISCVREG_SET_CLEAR_INLINE(regname) +#define RISCVREG_READ_WRITE_SET_CLEAR_INLINE(regname) \ +RISCVREG_READ_WRITE_INLINE(regname) \ +RISCVREG_SET_CLEAR_INLINE(regname) + /* Supervisor Status Register */ +RISCVREG_READ_SET_CLEAR_INLINE(sstatus) // supervisor status register #ifdef _LP64 #define SR_WPRI __BITS(62, 34) | __BITS(31,20) | __BIT(17) | \ __BITS(12,9) | __BITS(7,6) | __BITS(3,2) @@ -144,6 +201,7 @@ riscvreg_fcsr_write_frm(uint32_t __new) /* Supervisor interrupt registers */ /* ... interrupt pending register (sip) */ +RISCVREG_READ_SET_CLEAR_INLINE(sip) // supervisor interrupt pending /* Bit (XLEN-1) - 10 is WIRI */ #define SIP_SEIP __BIT(9) #define SIP_UEIP __BIT(8) @@ -155,6 +213,7 @@ riscvreg_fcsr_write_frm(uint32_t __new) #define SIP_USIP __BIT(0) /* ... interrupt-enable register (sie) */ +RISCVREG_READ_SET_CLEAR_INLINE(sie) // supervisor interrupt enable /* Bit (XLEN-1) - 10 is WIRI */ #define SIE_SEIE __BIT(9) #define SIE_UEIE __BIT(8) @@ -177,38 +236,6 @@ riscvreg_fcsr_write_frm(uint32_t __new) #define SR_KERNEL (SR_SIE | SR_UIE) #endif -static inline uintptr_t -riscvreg_status_read(void) -{ - uintptr_t __sr; - __asm("csrr\t%0, sstatus" : "=r"(__sr)); - return __sr; -} - -static inline uintptr_t -riscvreg_status_clear(uintptr_t __mask) -{ - uintptr_t __sr; - if (__builtin_constant_p(__mask) && __mask < 0x20) { - __asm("csrrci\t%0, sstatus, %1" : "=r"(__sr) : "i"(__mask)); - } else { - __asm("csrrc\t%0, sstatus, %1" : "=r"(__sr) : "r"(__mask)); - } - return __sr; -} - -static inline uintptr_t -riscvreg_status_set(uintptr_t __mask) -{ - uintptr_t __sr; - if (__builtin_constant_p(__mask) && __mask < 0x20) { - __asm("csrrsi\t%0, sstatus, %1" : "=r"(__sr) : "i"(__mask)); - } else { - __asm("csrrs\t%0, sstatus, %1" : "=r"(__sr) : "r"(__mask)); - } - return __sr;
CVS commit: src/sys/arch/riscv
Module Name:src Committed By: simonb Date: Tue Nov 15 14:33:34 UTC 2022 Modified Files: src/sys/arch/riscv/include: sysreg.h src/sys/arch/riscv/riscv: pmap_machdep.c riscv_machdep.c vm_machdep.c Log Message: Use similar macro-magic to aarch64 armreg.h to add per-csr read/write/set-bits/clear-bits inline functions. Keep the open-coded 32-bit version of riscvreg_cycle_read() than reads a 64-bit cycle counter values. Added benefit of fixing these so that the inline asm uses __volatile and aren't opmtimised to nops by the compiler. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/riscv/include/sysreg.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/riscv/riscv/pmap_machdep.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/riscv/riscv/riscv_machdep.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/include
Module Name:src Committed By: macallan Date: Tue Nov 15 12:43:14 UTC 2022 Modified Files: src/sys/arch/powerpc/include: cpu.h Log Message: remove workaround for old clang - it's not needed anymore and caused problems elsewhere To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/sys/arch/powerpc/include/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/include/cpu.h diff -u src/sys/arch/powerpc/include/cpu.h:1.122 src/sys/arch/powerpc/include/cpu.h:1.123 --- src/sys/arch/powerpc/include/cpu.h:1.122 Mon May 30 14:48:08 2022 +++ src/sys/arch/powerpc/include/cpu.h Tue Nov 15 12:43:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.122 2022/05/30 14:48:08 rin Exp $ */ +/* $NetBSD: cpu.h,v 1.123 2022/11/15 12:43:14 macallan Exp $ */ /* * Copyright (C) 1999 Wolfgang Solfrank. @@ -240,12 +240,8 @@ curcpu(void) return ci; } -#ifdef __clang__ -#define curlwp (curcpu()->ci_curlwp) -#else register struct lwp *powerpc_curlwp __asm("r13"); #define curlwp powerpc_curlwp -#endif #define curpcb (curcpu()->ci_curpcb) #define curpm (curcpu()->ci_curpm)
CVS commit: src/sys/arch/powerpc/include
Module Name:src Committed By: macallan Date: Tue Nov 15 12:43:14 UTC 2022 Modified Files: src/sys/arch/powerpc/include: cpu.h Log Message: remove workaround for old clang - it's not needed anymore and caused problems elsewhere To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/sys/arch/powerpc/include/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys
On 15/11/2022 05:35, Ryo Shimizu wrote: Since l2_sha continues to point outside of m_data manipulated by m_adj(), it can be corrupted by subsequent m_pullup() or other mbuf m_*() operations. I still believe that using MTAG is appropriate. How about something like this? (not tested) Wow, that looks good and works well. I've comitted it, thanks. Since l2_shalen is fixed to ETHER_ADDR_LEN for now, the tag name should be PACKET_TAG_ETHERNET_SRC instead of PACKET_TAG_L2SHA for now. If all L2 addresses are to be treated extensively, the structure of mtag should include the size, but that will not be necessary just yet. I'm happy with that. Roy
CVS commit: src/sys
Module Name:src Committed By: roy Date: Tue Nov 15 10:47:39 UTC 2022 Modified Files: src/sys/net: if_ethersubr.c src/sys/netinet: if_arp.c src/sys/sys: mbuf.h Log Message: arp: Validate ARP source hardware address matches Ethernet source RFC 5227 section 1.1 states that for a DaD ARP probe the sender hardware address must match the hardware address of the interface sending the packet. We can now verify this by checking the mbuf tag PACKET_TAG_ETHERNET_SRC. This fixes an obsure issue where an old router was sending out bogus ARP probes. Thanks to Ryo Shimizu for the re-implementation. To generate a diff of this commit: cvs rdiff -u -r1.322 -r1.323 src/sys/net/if_ethersubr.c cvs rdiff -u -r1.310 -r1.311 src/sys/netinet/if_arp.c cvs rdiff -u -r1.235 -r1.236 src/sys/sys/mbuf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_ethersubr.c diff -u src/sys/net/if_ethersubr.c:1.322 src/sys/net/if_ethersubr.c:1.323 --- src/sys/net/if_ethersubr.c:1.322 Tue Nov 15 09:14:28 2022 +++ src/sys/net/if_ethersubr.c Tue Nov 15 10:47:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.322 2022/11/15 09:14:28 roy Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.323 2022/11/15 10:47:39 roy Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.322 2022/11/15 09:14:28 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.323 2022/11/15 10:47:39 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -886,6 +886,19 @@ ether_input(struct ifnet *ifp, struct mb #endif } + /* For ARP packets, store the source address so that + * ARP DAD probes can be validated. */ + if (etype == ETHERTYPE_ARP) { + struct m_tag *mtag; + + mtag = m_tag_get(PACKET_TAG_ETHERNET_SRC, ETHER_ADDR_LEN, + M_NOWAIT); + if (mtag != NULL) { + memcpy(mtag + 1, >ether_shost, ETHER_ADDR_LEN); + m_tag_prepend(m, mtag); + } + } + /* Strip off the Ethernet header. */ m_adj(m, ehlen); Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.310 src/sys/netinet/if_arp.c:1.311 --- src/sys/netinet/if_arp.c:1.310 Tue Nov 15 09:15:43 2022 +++ src/sys/netinet/if_arp.c Tue Nov 15 10:47:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.310 2022/11/15 09:15:43 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.311 2022/11/15 10:47:39 roy Exp $ */ /* * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.310 2022/11/15 09:15:43 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.311 2022/11/15 10:47:39 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -932,6 +932,8 @@ again: /* * DAD check, RFC 5227. + * ARP sender hardware address must match the interface + * address of the interface sending the packet. * Collision on sender address is always a duplicate. * Collision on target address is only a duplicate * IF the sender address is the null host (ie a DAD probe) @@ -945,13 +947,19 @@ again: m->m_flags & M_BCAST && ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED { - struct sockaddr_dl sdl, *sdlp; + struct m_tag *mtag; - sdlp = sockaddr_dl_init(, sizeof(sdl), - ifp->if_index, ifp->if_type, - NULL, 0, ar_sha(ah), ah->ar_hln); - arp_dad_duplicated((struct ifaddr *)ia, sdlp); - goto out; + mtag = m_tag_find(m, PACKET_TAG_ETHERNET_SRC); + if (mtag == NULL || (ah->ar_hln == ETHER_ADDR_LEN && + memcmp(mtag + 1, ar_sha(ah), ah->ar_hln) == 0)) { + struct sockaddr_dl sdl, *sdlp; + + sdlp = sockaddr_dl_init(, sizeof(sdl), + ifp->if_index, ifp->if_type, + NULL, 0, ar_sha(ah), ah->ar_hln); + arp_dad_duplicated((struct ifaddr *)ia, sdlp); + goto out; + } } /* Index: src/sys/sys/mbuf.h diff -u src/sys/sys/mbuf.h:1.235 src/sys/sys/mbuf.h:1.236 --- src/sys/sys/mbuf.h:1.235 Tue Nov 15 09:13:43 2022 +++ src/sys/sys/mbuf.h Tue Nov 15 10:47:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: mbuf.h,v 1.235 2022/11/15 09:13:43 roy Exp $ */ +/* $NetBSD: mbuf.h,v 1.236 2022/11/15 10:47:39 roy Exp $ */ /* * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc. @@ -800,6 +800,7 @@ int m_tag_copy_chain(struct mbuf *, stru */ #define PACKET_TAG_MPLS 29 /* Indicate it's for MPLS */ #define PACKET_TAG_SRCROUTE 30 /* IPv4 source routing */ +#define PACKET_TAG_ETHERNET_SRC 31 /* Ethernet source address */ /* * Return the number of bytes in the mbuf chain, m.
CVS commit: src/sys
Module Name:src Committed By: roy Date: Tue Nov 15 10:47:39 UTC 2022 Modified Files: src/sys/net: if_ethersubr.c src/sys/netinet: if_arp.c src/sys/sys: mbuf.h Log Message: arp: Validate ARP source hardware address matches Ethernet source RFC 5227 section 1.1 states that for a DaD ARP probe the sender hardware address must match the hardware address of the interface sending the packet. We can now verify this by checking the mbuf tag PACKET_TAG_ETHERNET_SRC. This fixes an obsure issue where an old router was sending out bogus ARP probes. Thanks to Ryo Shimizu for the re-implementation. To generate a diff of this commit: cvs rdiff -u -r1.322 -r1.323 src/sys/net/if_ethersubr.c cvs rdiff -u -r1.310 -r1.311 src/sys/netinet/if_arp.c cvs rdiff -u -r1.235 -r1.236 src/sys/sys/mbuf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/kern
Hello, On Tue, 15 Nov 2022 10:29:56 + "Michael Lorenz" wrote: > Module Name: src > Committed By: macallan > Date: Tue Nov 15 10:29:56 UTC 2022 > > Modified Files: > src/sys/kern: subr_pserialize.c > > Log Message: > don't KASSERT(kpreempt_disabled()) while cold > pserialize_read_*() can be called *very* early in kernel startup these days ... with this clang-built kernels work again on macppc have fun Michael
CVS commit: src/sys/kern
Module Name:src Committed By: macallan Date: Tue Nov 15 10:29:56 UTC 2022 Modified Files: src/sys/kern: subr_pserialize.c Log Message: don't KASSERT(kpreempt_disabled()) while cold pserialize_read_*() can be called *very* early in kernel startup these days To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/kern/subr_pserialize.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_pserialize.c diff -u src/sys/kern/subr_pserialize.c:1.18 src/sys/kern/subr_pserialize.c:1.19 --- src/sys/kern/subr_pserialize.c:1.18 Sun Oct 10 11:20:46 2021 +++ src/sys/kern/subr_pserialize.c Tue Nov 15 10:29:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pserialize.c,v 1.18 2021/10/10 11:20:46 riastradh Exp $ */ +/* $NetBSD: subr_pserialize.c,v 1.19 2022/11/15 10:29:56 macallan Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. @@ -31,11 +31,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.18 2021/10/10 11:20:46 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.19 2022/11/15 10:29:56 macallan Exp $"); #include #include #include +#include #include #include #include @@ -135,7 +136,7 @@ void pserialize_read_exit(int s) { - KASSERT(kpreempt_disabled()); + KASSERT((cold || kpreempt_disabled())); __insn_barrier(); if (__predict_false(curcpu()->ci_psz_read_depth-- == 0))
CVS commit: src/sys/kern
Module Name:src Committed By: macallan Date: Tue Nov 15 10:29:56 UTC 2022 Modified Files: src/sys/kern: subr_pserialize.c Log Message: don't KASSERT(kpreempt_disabled()) while cold pserialize_read_*() can be called *very* early in kernel startup these days To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/kern/subr_pserialize.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Nov 15 09:15:44 UTC 2022 Modified Files: src/sys/netinet: if_arp.c Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.309 -r1.310 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.309 src/sys/netinet/if_arp.c:1.310 --- src/sys/netinet/if_arp.c:1.309 Mon Nov 14 09:32:21 2022 +++ src/sys/netinet/if_arp.c Tue Nov 15 09:15:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.309 2022/11/14 09:32:21 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.310 2022/11/15 09:15:43 roy Exp $ */ /* * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.309 2022/11/14 09:32:21 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.310 2022/11/15 09:15:43 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -932,8 +932,6 @@ again: /* * DAD check, RFC 5227. - * ARP sender hardware address must match the interface - * address of the interface sending the packet. * Collision on sender address is always a duplicate. * Collision on target address is only a duplicate * IF the sender address is the null host (ie a DAD probe) @@ -945,10 +943,7 @@ again: (in_hosteq(isaddr, myaddr) || (in_nullhost(isaddr) && in_hosteq(itaddr, myaddr) && m->m_flags & M_BCAST && - ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED))) && - m->m_pkthdr.l2_shalen == ah->ar_hln && ( - ah->ar_hln == 0 || - memcmp(m->m_pkthdr.l2_sha, ar_sha(ah), ah->ar_hln) == 0)) + ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED { struct sockaddr_dl sdl, *sdlp;
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Nov 15 09:15:44 UTC 2022 Modified Files: src/sys/netinet: if_arp.c Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.309 -r1.310 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: roy Date: Tue Nov 15 09:14:28 UTC 2022 Modified Files: src/sys/net: if_ethersubr.c Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.321 -r1.322 src/sys/net/if_ethersubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_ethersubr.c diff -u src/sys/net/if_ethersubr.c:1.321 src/sys/net/if_ethersubr.c:1.322 --- src/sys/net/if_ethersubr.c:1.321 Mon Nov 14 09:23:42 2022 +++ src/sys/net/if_ethersubr.c Tue Nov 15 09:14:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.321 2022/11/14 09:23:42 roy Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.322 2022/11/15 09:14:28 roy Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.321 2022/11/14 09:23:42 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.322 2022/11/15 09:14:28 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -886,10 +886,6 @@ ether_input(struct ifnet *ifp, struct mb #endif } - /* Store the senders hardware address */ - m->m_pkthdr.l2_sha = >ether_shost; - m->m_pkthdr.l2_shalen = ETHER_ADDR_LEN; - /* Strip off the Ethernet header. */ m_adj(m, ehlen);
CVS commit: src/sys/net
Module Name:src Committed By: roy Date: Tue Nov 15 09:14:28 UTC 2022 Modified Files: src/sys/net: if_ethersubr.c Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.321 -r1.322 src/sys/net/if_ethersubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/sys
Module Name:src Committed By: roy Date: Tue Nov 15 09:13:43 UTC 2022 Modified Files: src/sys/sys: mbuf.h Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.234 -r1.235 src/sys/sys/mbuf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/mbuf.h diff -u src/sys/sys/mbuf.h:1.234 src/sys/sys/mbuf.h:1.235 --- src/sys/sys/mbuf.h:1.234 Mon Nov 14 10:15:08 2022 +++ src/sys/sys/mbuf.h Tue Nov 15 09:13:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: mbuf.h,v 1.234 2022/11/14 10:15:08 roy Exp $ */ +/* $NetBSD: mbuf.h,v 1.235 2022/11/15 09:13:43 roy Exp $ */ /* * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc. @@ -178,8 +178,8 @@ struct m_hdr { * checksum) -- this is so we can accumulate the checksum for fragmented * packets during reassembly. * - * Size ILP32: 48 - * LP64: 72 + * Size ILP32: 40 + * LP64: 56 */ struct pkthdr { union { @@ -203,9 +203,6 @@ struct pkthdr { int pattr_af; /* ALTQ: address family */ void *pattr_class; /* ALTQ: sched class set by classifier */ void *pattr_hdr; /* ALTQ: saved header position in mbuf */ - - void *l2_sha; /* l2 sender host address */ - size_t l2_shalen; /* length of the sender address */ }; /* Checksumming flags (csum_flags). */
CVS commit: src/sys/sys
Module Name:src Committed By: roy Date: Tue Nov 15 09:13:43 UTC 2022 Modified Files: src/sys/sys: mbuf.h Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.234 -r1.235 src/sys/sys/mbuf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.