head 1.65; access; symbols netbsd-10-0-RELEASE:1.65 netbsd-10-0-RC6:1.65 netbsd-10-0-RC5:1.65 netbsd-10-0-RC4:1.65 netbsd-10-0-RC3:1.65 netbsd-10-0-RC2:1.65 thorpej-ifq:1.65.0.8 thorpej-ifq-base:1.65 thorpej-altq-separation:1.65.0.6 thorpej-altq-separation-base:1.65 netbsd-10-0-RC1:1.65 netbsd-10:1.65.0.4 netbsd-10-base:1.65 bouyer-sunxi-drm:1.65.0.2 bouyer-sunxi-drm-base:1.65 netbsd-9-3-RELEASE:1.62.4.1 thorpej-i2c-spi-conf2:1.64.0.22 thorpej-i2c-spi-conf2-base:1.64 thorpej-futex2:1.64.0.20 thorpej-futex2-base:1.64 thorpej-cfargs2:1.64.0.18 thorpej-cfargs2-base:1.64 cjep_sun2x-base1:1.64 cjep_sun2x:1.64.0.16 cjep_sun2x-base:1.64 cjep_staticlib_x-base1:1.64 netbsd-9-2-RELEASE:1.62.4.1 cjep_staticlib_x:1.64.0.14 cjep_staticlib_x-base:1.64 thorpej-i2c-spi-conf:1.64.0.12 thorpej-i2c-spi-conf-base:1.64 thorpej-cfargs:1.64.0.10 thorpej-cfargs-base:1.64 thorpej-futex:1.64.0.8 thorpej-futex-base:1.64 netbsd-9-1-RELEASE:1.62.4.1 bouyer-xenpvh-base2:1.64 phil-wifi-20200421:1.64 bouyer-xenpvh-base1:1.64 phil-wifi-20200411:1.64 bouyer-xenpvh:1.64.0.6 bouyer-xenpvh-base:1.64 is-mlppp:1.64.0.4 is-mlppp-base:1.64 phil-wifi-20200406:1.64 netbsd-8-2-RELEASE:1.56.4.3 ad-namecache-base3:1.64 netbsd-9-0-RELEASE:1.62.4.1 netbsd-9-0-RC2:1.62.4.1 ad-namecache-base2:1.64 ad-namecache-base1:1.64 ad-namecache:1.64.0.2 ad-namecache-base:1.64 netbsd-9-0-RC1:1.62.4.1 phil-wifi-20191119:1.64 netbsd-9:1.62.0.4 netbsd-9-base:1.62 phil-wifi-20190609:1.62 netbsd-8-1-RELEASE:1.56.4.2 netbsd-8-1-RC1:1.56.4.2 isaki-audio2:1.62.0.2 isaki-audio2-base:1.62 pgoyette-compat-merge-20190127:1.58.2.4 pgoyette-compat-20190127:1.62 pgoyette-compat-20190118:1.62 pgoyette-compat-1226:1.62 pgoyette-compat-1126:1.62 pgoyette-compat-1020:1.62 pgoyette-compat-0930:1.62 pgoyette-compat-0906:1.61 netbsd-7-2-RELEASE:1.52 pgoyette-compat-0728:1.61 netbsd-8-0-RELEASE:1.56.4.2 phil-wifi:1.61.0.2 phil-wifi-base:1.61 pgoyette-compat-0625:1.61 netbsd-8-0-RC2:1.56.4.2 pgoyette-compat-0521:1.61 pgoyette-compat-0502:1.60 pgoyette-compat-0422:1.59 netbsd-8-0-RC1:1.56.4.2 pgoyette-compat-0415:1.59 pgoyette-compat-0407:1.59 pgoyette-compat-0330:1.59 pgoyette-compat-0322:1.59 pgoyette-compat-0315:1.58 netbsd-7-1-2-RELEASE:1.52 pgoyette-compat:1.58.0.2 pgoyette-compat-base:1.58 netbsd-7-1-1-RELEASE:1.52 tls-maxphys-base-20171202:1.58 matt-nb8-mediatek:1.56.4.1.0.2 matt-nb8-mediatek-base:1.56.4.1 nick-nhusb-base-20170825:1.56 perseant-stdc-iso10646:1.56.0.6 perseant-stdc-iso10646-base:1.56 netbsd-8:1.56.0.4 netbsd-8-base:1.56 prg-localcount2-base3:1.56 prg-localcount2-base2:1.56 prg-localcount2-base1:1.56 prg-localcount2:1.56.0.2 prg-localcount2-base:1.56 pgoyette-localcount-20170426:1.56 bouyer-socketcan-base1:1.56 jdolecek-ncq:1.55.0.6 jdolecek-ncq-base:1.55 pgoyette-localcount-20170320:1.55 netbsd-7-1:1.52.0.10 netbsd-7-1-RELEASE:1.52 netbsd-7-1-RC2:1.52 nick-nhusb-base-20170204:1.55 netbsd-7-nhusb-base-20170116:1.52 bouyer-socketcan:1.55.0.4 bouyer-socketcan-base:1.55 pgoyette-localcount-20170107:1.55 netbsd-7-1-RC1:1.52 nick-nhusb-base-20161204:1.55 pgoyette-localcount-20161104:1.55 netbsd-7-0-2-RELEASE:1.52 nick-nhusb-base-20161004:1.55 localcount-20160914:1.55 netbsd-7-nhusb:1.52.0.8 netbsd-7-nhusb-base:1.52 pgoyette-localcount-20160806:1.55 pgoyette-localcount-20160726:1.55 pgoyette-localcount:1.55.0.2 pgoyette-localcount-base:1.55 nick-nhusb-base-20160907:1.55 nick-nhusb-base-20160529:1.55 netbsd-7-0-1-RELEASE:1.52 nick-nhusb-base-20160422:1.55 nick-nhusb-base-20160319:1.55 nick-nhusb-base-20151226:1.54 netbsd-7-0:1.52.0.6 netbsd-7-0-RELEASE:1.52 nick-nhusb-base-20150921:1.54 netbsd-7-0-RC3:1.52 netbsd-7-0-RC2:1.52 netbsd-7-0-RC1:1.52 nick-nhusb-base-20150606:1.54 nick-nhusb-base-20150406:1.52 nick-nhusb:1.52.0.4 nick-nhusb-base:1.52 netbsd-5-2-3-RELEASE:1.35.8.1 netbsd-5-1-5-RELEASE:1.35.22.1 netbsd-6-0-6-RELEASE:1.37 netbsd-6-1-5-RELEASE:1.37 netbsd-7:1.52.0.2 netbsd-7-base:1.52 yamt-pagecache-base9:1.37 yamt-pagecache-tag8:1.37 netbsd-6-1-4-RELEASE:1.37 netbsd-6-0-5-RELEASE:1.37 tls-earlyentropy:1.37.0.26 tls-earlyentropy-base:1.52 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.37 riastradh-drm2-base3:1.37 netbsd-6-1-3-RELEASE:1.37 netbsd-6-0-4-RELEASE:1.37 netbsd-5-2-2-RELEASE:1.35.8.1 netbsd-5-1-4-RELEASE:1.35.22.1 netbsd-6-1-2-RELEASE:1.37 netbsd-6-0-3-RELEASE:1.37 netbsd-5-2-1-RELEASE:1.35.8.1 netbsd-5-1-3-RELEASE:1.35.22.1 rmind-smpnet-nbase:1.38 netbsd-6-1-1-RELEASE:1.37 riastradh-drm2-base2:1.37 riastradh-drm2-base1:1.37 riastradh-drm2:1.37.0.24 riastradh-drm2-base:1.37 rmind-smpnet:1.37.0.16 rmind-smpnet-base:1.38 netbsd-6-1:1.37.0.22 netbsd-6-0-2-RELEASE:1.37 netbsd-6-1-RELEASE:1.37 khorben-n900:1.37.0.20 netbsd-6-1-RC4:1.37 netbsd-6-1-RC3:1.37 agc-symver:1.37.0.18 agc-symver-base:1.37 netbsd-6-1-RC2:1.37 netbsd-6-1-RC1:1.37 yamt-pagecache-base8:1.37 netbsd-5-2:1.35.8.1.0.2 netbsd-6-0-1-RELEASE:1.37 yamt-pagecache-base7:1.37 netbsd-5-2-RELEASE:1.35.8.1 netbsd-5-2-RC1:1.35.8.1 matt-nb6-plus-nbase:1.37 yamt-pagecache-base6:1.37 netbsd-6-0:1.37.0.14 netbsd-6-0-RELEASE:1.37 netbsd-6-0-RC2:1.37 tls-maxphys:1.37.0.12 tls-maxphys-base:1.52 matt-nb6-plus:1.37.0.10 matt-nb6-plus-base:1.37 netbsd-6-0-RC1:1.37 jmcneill-usbmp-base10:1.37 yamt-pagecache-base5:1.37 jmcneill-usbmp-base9:1.37 yamt-pagecache-base4:1.37 jmcneill-usbmp-base8:1.37 jmcneill-usbmp-base7:1.37 jmcneill-usbmp-base6:1.37 jmcneill-usbmp-base5:1.37 jmcneill-usbmp-base4:1.37 jmcneill-usbmp-base3:1.37 jmcneill-usbmp-pre-base2:1.37 jmcneill-usbmp-base2:1.37 netbsd-6:1.37.0.8 netbsd-6-base:1.37 netbsd-5-1-2-RELEASE:1.35.22.1 netbsd-5-1-1-RELEASE:1.35.22.1 jmcneill-usbmp:1.37.0.6 jmcneill-usbmp-base:1.37 jmcneill-audiomp3:1.37.0.4 jmcneill-audiomp3-base:1.37 yamt-pagecache-base3:1.37 yamt-pagecache-base2:1.37 yamt-pagecache:1.37.0.2 yamt-pagecache-base:1.37 rmind-uvmplock-nbase:1.36 cherry-xenmp:1.36.0.6 cherry-xenmp-base:1.36 bouyer-quota2-nbase:1.36 bouyer-quota2:1.36.0.4 bouyer-quota2-base:1.36 jruoho-x86intr:1.36.0.2 jruoho-x86intr-base:1.36 matt-mips64-premerge-20101231:1.35 matt-nb5-mips64-premerge-20101231:1.35 matt-nb5-pq3:1.35.0.24 matt-nb5-pq3-base:1.35 netbsd-5-1:1.35.0.22 netbsd-5-1-RELEASE:1.35 uebayasi-xip-base4:1.35 uebayasi-xip-base3:1.35 yamt-nfs-mp-base11:1.35 netbsd-5-1-RC4:1.35 matt-nb5-mips64-k15:1.35 uebayasi-xip-base2:1.35 yamt-nfs-mp-base10:1.35 netbsd-5-1-RC3:1.35 netbsd-5-1-RC2:1.35 uebayasi-xip-base1:1.35 netbsd-5-1-RC1:1.35 rmind-uvmplock:1.35.0.20 rmind-uvmplock-base:1.36 yamt-nfs-mp-base9:1.35 uebayasi-xip:1.35.0.18 uebayasi-xip-base:1.35 netbsd-5-0-2-RELEASE:1.35 matt-nb5-mips64-premerge-20091211:1.35 matt-premerge-20091211:1.35 yamt-nfs-mp-base8:1.35 matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.35 matt-nb4-mips64-k7-u2a-k9b:1.35 matt-nb5-mips64-u1-k1-k5:1.35 yamt-nfs-mp-base7:1.35 matt-nb5-mips64:1.35.0.16 netbsd-5-0-1-RELEASE:1.35 jymxensuspend-base:1.35 yamt-nfs-mp-base6:1.35 yamt-nfs-mp-base5:1.35 yamt-nfs-mp-base4:1.35 jym-xensuspend-nbase:1.35 yamt-nfs-mp-base3:1.35 nick-hppapmap-base4:1.35 nick-hppapmap-base3:1.35 netbsd-5-0:1.35.0.14 netbsd-5-0-RELEASE:1.35 netbsd-5-0-RC4:1.35 netbsd-5-0-RC3:1.35 nick-hppapmap-base2:1.35 netbsd-5-0-RC2:1.35 jym-xensuspend:1.35.0.12 jym-xensuspend-base:1.35 netbsd-5-0-RC1:1.35 haad-dm-base2:1.35 haad-nbase2:1.35 ad-audiomp2:1.35.0.10 ad-audiomp2-base:1.35 netbsd-5:1.35.0.8 netbsd-5-base:1.35 nick-hppapmap:1.35.0.6 nick-hppapmap-base:1.35 matt-mips64-base2:1.35 matt-mips64:1.33.0.32 haad-dm-base1:1.35 wrstuden-revivesa-base-4:1.35 netbsd-4-0-1-RELEASE:1.30 wrstuden-revivesa-base-3:1.35 wrstuden-revivesa-base-2:1.35 wrstuden-fixsa-newbase:1.30 nick-csl-alignment-base5:1.33 haad-dm:1.35.0.4 haad-dm-base:1.35 wrstuden-revivesa-base-1:1.35 simonb-wapbl-nbase:1.35 yamt-pf42-base4:1.35 simonb-wapbl:1.35.0.2 simonb-wapbl-base:1.35 yamt-pf42-base3:1.35 hpcarm-cleanup-nbase:1.34 yamt-pf42-baseX:1.33 yamt-pf42-base2:1.34 yamt-nfs-mp-base2:1.34 wrstuden-revivesa:1.34.0.4 wrstuden-revivesa-base:1.35 yamt-nfs-mp:1.34.0.2 yamt-nfs-mp-base:1.34 yamt-pf42:1.33.0.30 yamt-pf42-base:1.33 ad-socklock-base1:1.33 yamt-lazymbuf-base15:1.33 yamt-lazymbuf-base14:1.33 keiichi-mipv6-nbase:1.33 mjf-devfs2:1.33.0.28 mjf-devfs2-base:1.35 nick-net80211-sync:1.33.0.26 nick-net80211-sync-base:1.33 keiichi-mipv6:1.33.0.24 keiichi-mipv6-base:1.33 bouyer-xeni386-merge1:1.33 matt-armv6-prevmlocking:1.33 wrstuden-fixsa-base-1:1.30 vmlocking2-base3:1.33 netbsd-4-0:1.30.0.10 netbsd-4-0-RELEASE:1.30 bouyer-xeni386-nbase:1.33 yamt-kmem-base3:1.33 cube-autoconf:1.33.0.22 cube-autoconf-base:1.33 yamt-kmem-base2:1.33 bouyer-xeni386:1.33.0.20 bouyer-xeni386-base:1.33 yamt-kmem:1.33.0.18 yamt-kmem-base:1.33 vmlocking2-base2:1.33 reinoud-bufcleanup-nbase:1.33 vmlocking2:1.33.0.16 vmlocking2-base1:1.33 netbsd-4-0-RC5:1.30 matt-nb4-arm:1.30.0.8 matt-nb4-arm-base:1.30 matt-armv6-nbase:1.33 jmcneill-base:1.33 netbsd-4-0-RC4:1.30 mjf-devfs:1.33.0.14 mjf-devfs-base:1.33 bouyer-xenamd64-base2:1.33 vmlocking-nbase:1.33 yamt-x86pmap-base4:1.33 bouyer-xenamd64:1.33.0.12 bouyer-xenamd64-base:1.33 netbsd-4-0-RC3:1.30 yamt-x86pmap-base3:1.33 yamt-x86pmap-base2:1.33 netbsd-4-0-RC2:1.30 yamt-x86pmap:1.33.0.10 yamt-x86pmap-base:1.33 netbsd-4-0-RC1:1.30 matt-armv6:1.33.0.8 matt-armv6-base:1.33 matt-mips64-base:1.33 jmcneill-pm:1.33.0.6 jmcneill-pm-base:1.33 hpcarm-cleanup:1.33.0.4 hpcarm-cleanup-base:1.33 nick-csl-alignment:1.33.0.2 nick-csl-alignment-base:1.33 netbsd-3-1-1-RELEASE:1.23 netbsd-3-0-3-RELEASE:1.23 yamt-idlelwp-base8:1.33 wrstuden-fixsa:1.30.0.6 wrstuden-fixsa-base:1.30 thorpej-atomic:1.32.0.8 thorpej-atomic-base:1.32 reinoud-bufcleanup:1.32.0.6 reinoud-bufcleanup-base:1.33 mjf-ufs-trans:1.32.0.4 mjf-ufs-trans-base:1.33 vmlocking:1.32.0.2 vmlocking-base:1.33 ad-audiomp:1.31.0.2 ad-audiomp-base:1.31 yamt-idlelwp:1.30.0.4 post-newlock2-merge:1.30 newlock2-nbase:1.30 yamt-splraiseipl-base5:1.30 yamt-splraiseipl-base4:1.30 yamt-splraiseipl-base3:1.30 abandoned-netbsd-4-base:1.27 abandoned-netbsd-4:1.27.0.2 netbsd-3-1:1.23.0.14 netbsd-3-1-RELEASE:1.23 netbsd-3-0-2-RELEASE:1.23 yamt-splraiseipl-base2:1.28 netbsd-3-1-RC4:1.23 yamt-splraiseipl:1.27.0.6 yamt-splraiseipl-base:1.27 netbsd-3-1-RC3:1.23 yamt-pdpolicy-base9:1.27 newlock2:1.27.0.4 newlock2-base:1.30 yamt-pdpolicy-base8:1.27 netbsd-3-1-RC2:1.23 netbsd-3-1-RC1:1.23 yamt-pdpolicy-base7:1.27 netbsd-4:1.30.0.2 netbsd-4-base:1.30 yamt-pdpolicy-base6:1.26 chap-midi-nbase:1.26 netbsd-3-0-1-RELEASE:1.23 gdamore-uart:1.26.0.4 gdamore-uart-base:1.26 simonb-timcounters-final:1.25.6.1 yamt-pdpolicy-base5:1.26 chap-midi:1.26.0.2 chap-midi-base:1.26 yamt-pdpolicy-base4:1.25 yamt-pdpolicy-base3:1.25 peter-altq-base:1.25 peter-altq:1.25.0.12 yamt-pdpolicy-base2:1.25 elad-kernelauth-base:1.25 elad-kernelauth:1.25.0.10 yamt-pdpolicy:1.25.0.8 yamt-pdpolicy-base:1.25 yamt-uio_vmspace-base5:1.25 simonb-timecounters:1.25.0.6 simonb-timecounters-base:1.26 rpaulo-netinet-merge-pcb:1.25.0.4 rpaulo-netinet-merge-pcb-base:1.27 yamt-uio_vmspace:1.25.0.2 netbsd-3-0:1.23.0.12 netbsd-3-0-RELEASE:1.23 netbsd-3-0-RC6:1.23 yamt-readahead-base3:1.23 netbsd-3-0-RC5:1.23 netbsd-3-0-RC4:1.23 netbsd-3-0-RC3:1.23 yamt-readahead-base2:1.23 netbsd-3-0-RC2:1.23 yamt-readahead-pervnode:1.23 yamt-readahead-perfile:1.23 yamt-readahead:1.23.0.10 yamt-readahead-base:1.23 netbsd-3-0-RC1:1.23 yamt-vop-base3:1.23 netbsd-2-0-3-RELEASE:1.21 netbsd-2-1:1.21.0.6 yamt-vop-base2:1.23 thorpej-vnode-attr:1.23.0.8 thorpej-vnode-attr-base:1.23 netbsd-2-1-RELEASE:1.21 yamt-vop:1.23.0.6 yamt-vop-base:1.23 netbsd-2-1-RC6:1.21 netbsd-2-1-RC5:1.21 netbsd-2-1-RC4:1.21 netbsd-2-1-RC3:1.21 netbsd-2-1-RC2:1.21 netbsd-2-1-RC1:1.21 yamt-lazymbuf:1.23.0.4 yamt-km-base4:1.23 netbsd-2-0-2-RELEASE:1.21 yamt-km-base3:1.23 netbsd-3:1.23.0.2 netbsd-3-base:1.23 yamt-km-base2:1.22 yamt-km:1.22.0.6 yamt-km-base:1.22 kent-audio2:1.22.0.4 kent-audio2-base:1.23 netbsd-2-0-1-RELEASE:1.21 kent-audio1-beforemerge:1.22 netbsd-2:1.21.0.4 netbsd-2-base:1.21 kent-audio1:1.22.0.2 kent-audio1-base:1.22 netbsd-2-0-RELEASE:1.21 netbsd-2-0-RC5:1.21 netbsd-2-0-RC4:1.21 netbsd-2-0-RC3:1.21 netbsd-2-0-RC2:1.21 netbsd-2-0-RC1:1.21 netbsd-2-0:1.21.0.2 netbsd-2-0-base:1.21 netbsd-1-6-PATCH002-RELEASE:1.17 netbsd-1-6-PATCH002:1.17 netbsd-1-6-PATCH002-RC4:1.17 netbsd-1-6-PATCH002-RC3:1.17 netbsd-1-6-PATCH002-RC2:1.17 netbsd-1-6-PATCH002-RC1:1.17 ktrace-lwp:1.19.0.2 ktrace-lwp-base:1.23 netbsd-1-6-PATCH001:1.17 netbsd-1-6-PATCH001-RELEASE:1.17 netbsd-1-6-PATCH001-RC3:1.17 netbsd-1-6-PATCH001-RC2:1.17 netbsd-1-6-PATCH001-RC1:1.17 nathanw_sa_end:1.15.6.1 nathanw_sa_before_merge:1.17 fvdl_fs64_base:1.17 gmcgarry_ctxsw:1.17.0.14 gmcgarry_ctxsw_base:1.17 gmcgarry_ucred:1.17.0.12 gmcgarry_ucred_base:1.17 nathanw_sa_base:1.17 kqueue-aftermerge:1.17 kqueue-beforemerge:1.17 netbsd-1-6-RELEASE:1.17 netbsd-1-6-RC3:1.17 netbsd-1-6-RC2:1.17 netbsd-1-6-RC1:1.17 netbsd-1-6:1.17.0.10 netbsd-1-6-base:1.17 gehenna-devsw:1.17.0.8 gehenna-devsw-base:1.17 netbsd-1-5-PATCH003:1.15 eeh-devprop:1.17.0.6 eeh-devprop-base:1.17 newlock:1.17.0.4 newlock-base:1.17 ifpoll-base:1.17 thorpej-mips-cache:1.15.0.12 thorpej-mips-cache-base:1.16 thorpej-devvp-base3:1.15 thorpej-devvp-base2:1.15 post-chs-ubcperf:1.15 pre-chs-ubcperf:1.15 thorpej-devvp:1.15.0.10 thorpej-devvp-base:1.15 netbsd-1-5-PATCH002:1.15 kqueue:1.15.0.8 kqueue-base:1.17 netbsd-1-5-PATCH001:1.15 thorpej_scsipi_beforemerge:1.15 nathanw_sa:1.15.0.6 thorpej_scsipi_nbase:1.15 netbsd-1-5-RELEASE:1.15 netbsd-1-5-BETA2:1.15 netbsd-1-5-BETA:1.15 netbsd-1-4-PATCH003:1.14 netbsd-1-5-ALPHA2:1.15 netbsd-1-5:1.15.0.4 netbsd-1-5-base:1.15 minoura-xpg4dl-base:1.15 minoura-xpg4dl:1.15.0.2 netbsd-1-4-PATCH002:1.14 chs-ubc2-newbase:1.14 wrstuden-devbsize-19991221:1.14 wrstuden-devbsize:1.14.0.34 wrstuden-devbsize-base:1.14 kame_141_19991130:1.14 comdex-fall-1999:1.14.0.32 comdex-fall-1999-base:1.14 fvdl-softdep:1.14.0.30 fvdl-softdep-base:1.14 thorpej_scsipi:1.14.0.28 thorpej_scsipi_base:1.15 netbsd-1-4-PATCH001:1.14 kame_14_19990705:1.14 kame_14_19990628:1.14 kame:1.14.0.26 chs-ubc2:1.14.0.24 chs-ubc2-base:1.14 netbsd-1-4-RELEASE:1.14 netbsd-1-4:1.14.0.22 netbsd-1-4-base:1.14 netbsd-1-3-PATCH003:1.14 netbsd-1-3-PATCH003-CANDIDATE2:1.14 kenh-if-detach:1.14.0.20 kenh-if-detach-base:1.14 netbsd-1-3-PATCH003-CANDIDATE1:1.14 netbsd-1-3-PATCH003-CANDIDATE0:1.14 chs-ubc:1.14.0.18 chs-ubc-base:1.14 eeh-paddr_t:1.14.0.16 eeh-paddr_t-base:1.14 netbsd-1-3-PATCH002:1.14 lite-2:1.1.1.2 lite-1:1.1.1.2 CSRG:1.1.1 netbsd-1-3-PATCH001:1.14 netbsd-1-3-RELEASE:1.14 netbsd-1-3-BETA:1.14 netbsd-1-3:1.14.0.14 netbsd-1-3-base:1.14 thorpej-signal:1.14.0.12 thorpej-signal-base:1.14 marc-pcmcia:1.14.0.10 marc-pcmcia-bp:1.14 marc-pcmcia-base:1.14 bouyer-scsipi:1.14.0.8 is-newarp-before-merge:1.14 netbsd-1-2-PATCH001:1.11.4.1 mrg-vm-swap:1.14.0.6 is-newarp:1.14.0.4 is-newarp-base:1.14 thorpej-setroot:1.14.0.2 netbsd-1-2-RELEASE:1.11 netbsd-1-2-BETA:1.11 netbsd-1-2:1.11.0.4 netbsd-1-2-base:1.11 date-03-may-96:1.1.1.2 netbsd-1-1-PATCH001:1.10 netbsd-1-1-RELEASE:1.10 netbsd-1-1:1.10.0.2 netbsd-1-1-base:1.10 netbsd-1-0-PATCH06:1.8 netbsd-1-0-PATCH05:1.8 netbsd-1-0-PATCH04:1.8 netbsd-1-0-PATCH03:1.8 netbsd-1-0-PATCH02:1.8 netbsd-1-0-PATCH1:1.8 netbsd-1-0-PATCH0:1.8 netbsd-1-0-RELEASE:1.8 netbsd-1-0:1.8.0.2 netbsd-1-0-base:1.8 magnum-base:1.3 magnum:1.3.0.4 netbsd-0-9-patch-001:1.3 netbsd-0-9-RELEASE:1.3 netbsd-0-9-BETA:1.3 netbsd-0-9-ALPHA2:1.3 netbsd-0-9-ALPHA:1.3 netbsd-0-9:1.3.0.2 netbsd-0-9-base:1.3 netbsd-0-8:1.1.1.1 netbsd-alpha-1:1.1.1.1 patchkit-0-2-2:1.1.1.1 WFJ-386bsd-01:1.1.1.1 WFJ-920714:1.1.1; locks; strict; comment @ * @; 1.65 date 2022.09.02.23.48.11; author thorpej; state Exp; branches; next 1.64; commitid 3f7nY4MTArheylSD; 1.64 date 2019.08.02.02.17.46; author ozaki-r; state Exp; branches; next 1.63; commitid gS2f11KrZlwQDoxB; 1.63 date 2019.08.02.01.55.01; author ozaki-r; state Exp; branches; next 1.62; commitid o1hOPK32F713woxB; 1.62 date 2018.09.07.06.13.14; author maxv; state Exp; branches 1.62.4.1; next 1.61; commitid zONCx1BEmQLgw8RA; 1.61 date 2018.05.09.06.35.10; author maxv; state Exp; branches 1.61.2.1; next 1.60; commitid IDukge6Bh5UQwABA; 1.60 date 2018.04.26.19.56.55; author maxv; state Exp; branches; next 1.59; commitid YiS80aABZadPnZzA; 1.59 date 2018.03.19.16.26.25; author roy; state Exp; branches; next 1.58; commitid pzwINZSPdrhdp5vA; 1.58 date 2017.09.25.01.57.54; author ozaki-r; state Exp; branches 1.58.2.1; next 1.57; commitid zY5eG7BFa1megw8A; 1.57 date 2017.09.25.01.56.22; author ozaki-r; state Exp; branches; next 1.56; commitid 30ecAO73DG6Ifw8A; 1.56 date 2017.04.11.13.55.54; author roy; state Exp; branches 1.56.4.1; next 1.55; 1.55 date 2016.01.20.21.43.59; author riastradh; state Exp; branches 1.55.2.1 1.55.4.1; next 1.54; 1.54 date 2015.05.02.17.18.03; author rtr; state Exp; branches; next 1.53; 1.53 date 2015.04.24.22.32.37; author rtr; state Exp; branches; next 1.52; 1.52 date 2014.08.09.05.33.01; author rtr; state Exp; branches 1.52.4.1; next 1.51; 1.51 date 2014.08.08.03.05.45; author rtr; state Exp; branches; next 1.50; 1.50 date 2014.08.05.07.55.31; author rtr; state Exp; branches; next 1.49; 1.49 date 2014.08.05.05.24.26; author rtr; state Exp; branches; next 1.48; 1.48 date 2014.07.31.05.13.53; author rtr; state Exp; branches; next 1.47; 1.47 date 2014.07.31.03.39.35; author rtr; state Exp; branches; next 1.46; 1.46 date 2014.07.30.10.04.26; author rtr; state Exp; branches; next 1.45; 1.45 date 2014.07.24.15.12.03; author rtr; state Exp; branches; next 1.44; 1.44 date 2014.07.23.13.17.18; author rtr; state Exp; branches; next 1.43; 1.43 date 2014.07.09.14.41.42; author rtr; state Exp; branches; next 1.42; 1.42 date 2014.07.09.04.54.03; author rtr; state Exp; branches; next 1.41; 1.41 date 2014.07.06.03.33.33; author rtr; state Exp; branches; next 1.40; 1.40 date 2014.06.22.08.10.18; author rtr; state Exp; branches; next 1.39; 1.39 date 2014.05.19.02.51.24; author rmind; state Exp; branches; next 1.38; 1.38 date 2014.05.18.14.46.16; author rmind; state Exp; branches; next 1.37; 1.37 date 2011.07.17.20.54.52; author joerg; state Exp; branches 1.37.12.1 1.37.16.1 1.37.26.1; next 1.36; 1.36 date 2011.01.11.10.52.42; author pooka; state Exp; branches; next 1.35; 1.35 date 2008.05.29.17.26.56; author dyoung; state Exp; branches 1.35.8.1 1.35.14.1 1.35.20.1 1.35.22.1; next 1.34; 1.34 date 2008.04.24.11.38.37; author ad; state Exp; branches 1.34.2.1 1.34.4.1; next 1.33; 1.33 date 2007.05.06.06.21.26; author dyoung; state Exp; branches 1.33.28.1 1.33.30.1; next 1.32; 1.32 date 2007.03.04.06.03.18; author christos; state Exp; branches 1.32.2.1 1.32.4.1; next 1.31; 1.31 date 2007.02.17.22.34.10; author dyoung; state Exp; branches; next 1.30; 1.30 date 2006.11.16.01.33.40; author christos; state Exp; branches 1.30.4.1; next 1.29; 1.29 date 2006.10.25.22.49.23; author elad; state Exp; branches; next 1.28; 1.28 date 2006.10.12.01.32.30; author christos; state Exp; branches; next 1.27; 1.27 date 2006.07.23.22.06.13; author ad; state Exp; branches 1.27.4.1 1.27.6.1; next 1.26; 1.26 date 2006.05.14.21.19.33; author elad; state Exp; branches; next 1.25; 1.25 date 2005.12.11.23.05.25; author thorpej; state Exp; branches 1.25.4.1 1.25.6.1 1.25.8.1 1.25.10.1 1.25.12.1; next 1.24; 1.24 date 2005.12.11.12.24.52; author christos; state Exp; branches; next 1.23; 1.23 date 2005.02.26.22.45.09; author perry; state Exp; branches 1.23.4.1; next 1.22; 1.22 date 2004.04.26.01.41.15; author matt; state Exp; branches 1.22.4.1 1.22.6.1; next 1.21; 1.21 date 2003.09.30.00.01.18; author christos; state Exp; branches; next 1.20; 1.20 date 2003.08.07.16.32.57; author agc; state Exp; branches; next 1.19; 1.19 date 2003.06.29.22.31.52; author fvdl; state Exp; branches 1.19.2.1; next 1.18; 1.18 date 2003.06.28.14.22.07; author darrenr; state Exp; branches; next 1.17; 1.17 date 2001.11.12.23.49.48; author lukem; state Exp; branches; next 1.16; 1.16 date 2001.11.05.18.02.16; author matt; state Exp; branches; next 1.15; 1.15 date 2000.03.30.09.45.40; author augustss; state Exp; branches 1.15.6.1 1.15.8.1 1.15.12.1; next 1.14; 1.14 date 96.05.28.23.24.23; author pk; state Exp; branches 1.14.28.1; next 1.13; 1.13 date 96.05.23.18.26.26; author mycroft; state Exp; branches; next 1.12; 1.12 date 96.05.22.13.55.15; author mycroft; state Exp; branches; next 1.11; 1.11 date 96.02.13.22.00.43; author christos; state Exp; branches 1.11.4.1; next 1.10; 1.10 date 95.06.12.00.46.55; author mycroft; state Exp; branches; next 1.9; 1.9 date 95.04.22.13.08.30; author cgd; state Exp; branches; next 1.8; 1.8 date 94.06.29.06.36.40; author cgd; state Exp; branches; next 1.7; 1.7 date 94.05.13.06.03.13; author mycroft; state Exp; branches; next 1.6; 1.6 date 94.01.16.02.22.54; author cgd; state Exp; branches; next 1.5; 1.5 date 94.01.06.14.00.35; author deraadt; state Exp; branches; next 1.4; 1.4 date 93.12.18.00.41.01; author mycroft; state Exp; branches; next 1.3; 1.3 date 93.05.22.11.42.17; author cgd; state Exp; branches 1.3.4.1; next 1.2; 1.2 date 93.05.18.18.20.00; author cgd; state Exp; branches; next 1.1; 1.1 date 93.03.21.09.45.37; author cgd; state Exp; branches 1.1.1.1; next ; 1.62.4.1 date 2019.08.04.11.40.11; author martin; state Exp; branches; next ; commitid YDiCvNxzDNPNGHxB; 1.61.2.1 date 2019.06.10.22.09.45; author christos; state Exp; branches; next 1.61.2.2; commitid jtc8rnCzWiEEHGqB; 1.61.2.2 date 2020.04.13.08.05.15; author martin; state Exp; branches; next ; commitid X01YhRUPVUDaec4C; 1.58.2.1 date 2018.03.22.01.44.51; author pgoyette; state Exp; branches; next 1.58.2.2; commitid fxb4Rxa9G9QMsovA; 1.58.2.2 date 2018.05.02.07.20.23; author pgoyette; state Exp; branches; next 1.58.2.3; commitid o3kRuNRzl9360HAA; 1.58.2.3 date 2018.05.21.04.36.15; author pgoyette; state Exp; branches; next 1.58.2.4; commitid X5L8kSrBWQcDt7DA; 1.58.2.4 date 2018.09.30.01.45.56; author pgoyette; state Exp; branches; next ; commitid SQ44grEPCeKPh4UA; 1.56.4.1 date 2017.10.21.19.43.54; author snj; state Exp; branches; next 1.56.4.2; commitid oXGWsjkUnhTWjXbA; 1.56.4.2 date 2018.04.09.13.34.10; author bouyer; state Exp; branches; next 1.56.4.3; commitid bk4qeBlXRTqsOLxA; 1.56.4.3 date 2019.08.04.11.01.22; author martin; state Exp; branches; next ; commitid l2pfn5EqGM2utHxB; 1.55.2.1 date 2017.04.26.02.53.29; author pgoyette; state Exp; branches; next ; 1.55.4.1 date 2017.04.21.16.54.05; author bouyer; state Exp; branches; next ; 1.52.4.1 date 2015.06.06.14.40.25; author skrll; state Exp; branches; next 1.52.4.2; 1.52.4.2 date 2016.03.19.11.30.32; author skrll; state Exp; branches; next 1.52.4.3; 1.52.4.3 date 2017.08.28.17.53.11; author skrll; state Exp; branches; next ; commitid UQQpnjvcNkUZn05A; 1.37.12.1 date 2014.08.20.00.04.34; author tls; state Exp; branches; next 1.37.12.2; 1.37.12.2 date 2017.12.03.11.39.02; author jdolecek; state Exp; branches; next ; commitid XcIYRZTAh1LmerhA; 1.37.16.1 date 2013.08.28.15.21.48; author rmind; state Exp; branches; next ; 1.37.26.1 date 2014.08.10.06.56.16; author tls; state Exp; branches; next ; 1.35.8.1 date 2011.01.16.13.04.33; author bouyer; state Exp; branches; next ; 1.35.14.1 date 2011.01.16.13.04.51; author bouyer; state Exp; branches; next ; 1.35.20.1 date 2011.03.05.20.55.53; author rmind; state Exp; branches; next ; 1.35.22.1 date 2011.01.16.13.04.45; author bouyer; state Exp; branches; next ; 1.34.2.1 date 2009.05.04.08.14.15; author yamt; state Exp; branches; next ; 1.34.4.1 date 2008.06.23.04.31.58; author wrstuden; state Exp; branches; next ; 1.33.28.1 date 2008.06.02.13.24.23; author mjf; state Exp; branches; next ; 1.33.30.1 date 2008.05.18.12.35.28; author yamt; state Exp; branches; next 1.33.30.2; 1.33.30.2 date 2008.06.04.02.05.48; author yamt; state Exp; branches; next ; 1.32.2.1 date 2007.06.08.14.17.36; author ad; state Exp; branches; next ; 1.32.4.1 date 2007.07.11.20.11.02; author mjf; state Exp; branches; next ; 1.30.4.1 date 2007.02.27.16.54.46; author yamt; state Exp; branches; next 1.30.4.2; 1.30.4.2 date 2007.03.12.05.59.15; author rmind; state Exp; branches; next 1.30.4.3; 1.30.4.3 date 2007.05.07.10.55.54; author yamt; state Exp; branches; next ; 1.27.4.1 date 2006.11.18.21.39.30; author ad; state Exp; branches; next ; 1.27.6.1 date 2006.10.22.06.07.25; author yamt; state Exp; branches; next 1.27.6.2; 1.27.6.2 date 2006.12.10.07.19.00; author yamt; state Exp; branches; next ; 1.25.4.1 date 2006.09.09.02.58.06; author rpaulo; state Exp; branches; next ; 1.25.6.1 date 2006.06.01.22.38.38; author kardel; state Exp; branches; next ; 1.25.8.1 date 2006.05.24.10.58.56; author yamt; state Exp; branches; next 1.25.8.2; 1.25.8.2 date 2006.08.11.15.46.16; author yamt; state Exp; branches; next ; 1.25.10.1 date 2006.03.08.01.11.55; author elad; state Exp; branches; next 1.25.10.2; 1.25.10.2 date 2006.03.10.15.05.23; author elad; state Exp; branches; next 1.25.10.3; 1.25.10.3 date 2006.05.06.23.31.59; author christos; state Exp; branches; next ; 1.25.12.1 date 2006.05.24.15.50.44; author tron; state Exp; branches; next ; 1.23.4.1 date 2006.06.21.15.10.27; author yamt; state Exp; branches; next 1.23.4.2; 1.23.4.2 date 2006.12.30.20.50.20; author yamt; state Exp; branches; next 1.23.4.3; 1.23.4.3 date 2007.02.26.09.11.37; author yamt; state Exp; branches; next 1.23.4.4; 1.23.4.4 date 2007.09.03.14.42.24; author yamt; state Exp; branches; next ; 1.22.4.1 date 2005.04.29.11.29.32; author kent; state Exp; branches; next ; 1.22.6.1 date 2005.03.19.08.36.32; author yamt; state Exp; branches; next ; 1.19.2.1 date 2003.07.02.15.26.57; author darrenr; state Exp; branches; next 1.19.2.2; 1.19.2.2 date 2004.08.03.10.54.19; author skrll; state Exp; branches; next 1.19.2.3; 1.19.2.3 date 2004.09.18.14.54.16; author skrll; state Exp; branches; next 1.19.2.4; 1.19.2.4 date 2004.09.21.13.36.42; author skrll; state Exp; branches; next 1.19.2.5; 1.19.2.5 date 2005.03.04.16.53.00; author skrll; state Exp; branches; next ; 1.15.6.1 date 2001.11.14.19.17.30; author nathanw; state Exp; branches; next ; 1.15.8.1 date 2002.01.10.20.02.21; author thorpej; state Exp; branches; next ; 1.15.12.1 date 2001.11.12.21.19.20; author thorpej; state Exp; branches; next ; 1.14.28.1 date 2000.11.20.18.10.11; author bouyer; state Exp; branches; next ; 1.11.4.1 date 96.12.11.03.43.54; author mycroft; state Exp; branches; next ; 1.3.4.1 date 93.10.16.10.49.31; author mycroft; state Exp; branches; next 1.3.4.2; 1.3.4.2 date 93.11.14.20.20.25; author mycroft; state Exp; branches; next ; 1.1.1.1 date 93.03.21.09.45.37; author cgd; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 98.03.01.02.10.09; author fvdl; state Exp; branches; next ; desc @@ 1.65 log @Remove unnecessary inclusion of . @ text @/* $NetBSD: raw_usrreq.c,v 1.64 2019/08/02 02:17:46 ozaki-r Exp $ */ /* * Copyright (c) 1980, 1986, 1993 * 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 * 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. 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 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) * 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. * * @@(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93 */ /* * Raw protocol interface. */ #include __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.64 2019/08/02 02:17:46 ozaki-r Exp $"); #include #include #include #include #include #include #include #include #include #include #include #include #include static inline int equal(const struct sockaddr *a1, const struct sockaddr *a2) { return memcmp(a1, a2, a1->sa_len) == 0; } /* * raw_input: find the socket associated with the packet and move it over. * If nothing exists for this packet, drop it. */ void raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, struct sockaddr *dst, struct rawcbhead *rawcbhead) { struct rawcb *rp; struct mbuf *m = m0; struct socket *last; last = NULL; LIST_FOREACH(rp, rawcbhead, rcb_list) { if (rp->rcb_proto.sp_family != proto->sp_family) continue; if (rp->rcb_proto.sp_protocol && rp->rcb_proto.sp_protocol != proto->sp_protocol) continue; /* * We assume the lower level routines have * placed the address in a canonical format * suitable for a structure comparison. * * Note that if the lengths are not the same * the comparison will fail at the first byte. */ if (rp->rcb_laddr && !equal(rp->rcb_laddr, dst)) continue; if (rp->rcb_faddr && !equal(rp->rcb_faddr, src)) continue; /* Run any filtering that may have been installed. */ if (rp->rcb_filter != NULL && rp->rcb_filter(m, proto, rp) != 0) continue; if (last != NULL) { struct mbuf *n; if ((n = m_copypacket(m, M_DONTWAIT)) == NULL || sbappendaddr(&last->so_rcv, src, n, NULL) == 0) { if (n != NULL) m_freem(n); soroverflow(last); } else sorwakeup(last); } last = rp->rcb_socket; } if (last != NULL) { if (sbappendaddr(&last->so_rcv, src, m, NULL) == 0) { m_freem(m); soroverflow(last); } else sorwakeup(last); } else { m_freem(m); } } void * raw_ctlinput(int cmd, const struct sockaddr *arg, void *d) { if ((unsigned)cmd >= PRC_NCMDS) return NULL; return NULL; /* INCOMPLETE */ } void raw_setsockaddr(struct rawcb *rp, struct sockaddr *nam) { memcpy(nam, rp->rcb_laddr, rp->rcb_laddr->sa_len); } void raw_setpeeraddr(struct rawcb *rp, struct sockaddr *nam) { memcpy(nam, rp->rcb_faddr, rp->rcb_faddr->sa_len); } int raw_send(struct socket *so, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct lwp *l, int (*output)(struct mbuf *, struct socket *)) { struct rawcb *rp = sotorawcb(so); int error = 0; KASSERT(rp != NULL); /* * Ship a packet out. The appropriate raw output * routine handles any massaging necessary. */ if (control && control->m_len) { m_freem(control); m_freem(m); return EINVAL; } if (nam) { if ((so->so_state & SS_ISCONNECTED) != 0) { error = EISCONN; goto die; } error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam, l); if (error) { die: m_freem(m); return error; } } else { if ((so->so_state & SS_ISCONNECTED) == 0) { error = ENOTCONN; goto die; } } error = (*output)(m, so); if (nam) raw_disconnect(rp); return error; } int raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { KASSERT(req != PRU_ATTACH); KASSERT(req != PRU_DETACH); KASSERT(req != PRU_ACCEPT); KASSERT(req != PRU_BIND); KASSERT(req != PRU_LISTEN); KASSERT(req != PRU_CONNECT); KASSERT(req != PRU_CONNECT2); KASSERT(req != PRU_DISCONNECT); KASSERT(req != PRU_SHUTDOWN); KASSERT(req != PRU_ABORT); KASSERT(req != PRU_CONTROL); KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); KASSERT(req != PRU_RCVD); KASSERT(req != PRU_RCVOOB); KASSERT(req != PRU_SEND); KASSERT(req != PRU_SENDOOB); KASSERT(req != PRU_PURGEIF); if (sotorawcb(so) == NULL) return EINVAL; panic("raw_usrreq"); return 0; } @ 1.64 log @Fix typo (s/m_free/m_freem/) (one more) @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.63 2019/08/02 01:55:01 ozaki-r Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.63 2019/08/02 01:55:01 ozaki-r Exp $"); a53 1 #include @ 1.63 log @Fix typo (s/m_free/m_freem/) This fixes PR kern/54419 "mbuf leak when deleting route" from sc dying. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.62 2018/09/07 06:13:14 maxv Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.62 2018/09/07 06:13:14 maxv Exp $"); d118 1 a118 1 m_free(m); @ 1.62 log @Make raw_input non-variadic. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.61 2018/05/09 06:35:10 maxv Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.61 2018/05/09 06:35:10 maxv Exp $"); d113 1 a113 1 m_free(m); @ 1.62.4.1 log @Pull up following revision(s) (requested by ozaki-r in ticket #7): sys/net/raw_usrreq.c: revision 1.63 sys/net/raw_usrreq.c: revision 1.64 Fix typo (s/m_free/m_freem/) This fixes PR kern/54419 "mbuf leak when deleting route" from sc dying. - Fix typo (s/m_free/m_freem/) (one more) @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.62 2018/09/07 06:13:14 maxv Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.62 2018/09/07 06:13:14 maxv Exp $"); d113 1 a113 1 m_freem(m); d118 1 a118 1 m_freem(m); @ 1.61 log @Replace m_copym(m, 0, M_COPYALL, M_DONTWAIT) by m_copypacket(m, M_DONTWAIT) when it is clear that we are copying a packet (that has M_PKTHDR) and not a raw mbuf chain. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.60 2018/04/26 19:56:55 maxv Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.60 2018/04/26 19:56:55 maxv Exp $"); d68 2 a69 1 raw_input(struct mbuf *m0, ...) a73 11 va_list ap; struct sockproto *proto; struct sockaddr *src, *dst; struct rawcbhead *rawcbhead; va_start(ap, m0); proto = va_arg(ap, struct sockproto *); src = va_arg(ap, struct sockaddr *); dst = va_arg(ap, struct sockaddr *); rawcbhead = va_arg(ap, struct rawcbhead *); va_end(ap); @ 1.61.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.62 2018/09/07 06:13:14 maxv Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.62 2018/09/07 06:13:14 maxv Exp $"); d68 1 a68 2 raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, struct sockaddr *dst, struct rawcbhead *rawcbhead) d73 11 @ 1.61.2.2 log @Mostly merge changes from HEAD upto 20200411 @ text @d1 1 a1 1 /* $NetBSD$ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD$"); d113 1 a113 1 m_freem(m); d118 1 a118 1 m_freem(m); @ 1.60 log @m_copy -> m_copym @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.59 2018/03/19 16:26:25 roy Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.59 2018/03/19 16:26:25 roy Exp $"); d110 1 a110 1 if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL || @ 1.59 log @socket: report receive buffer overflows Add soroverflow() which increments the overflow counter, sets so_error to ENOBUFS and wakes the receive socket up. Replace all code that manually increments this counter with soroverflow(). Add soroverflow() to raw_input(). This allows userland to detect route(4) overflows so it can re-sync with the current state. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.58 2017/09/25 01:57:54 ozaki-r Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.58 2017/09/25 01:57:54 ozaki-r Exp $"); d110 1 a110 1 if ((n = m_copy(m, 0, M_COPYALL)) == NULL || @ 1.58 log @Use a dedicated mutex for rt_rawcb instead of softnet_lock if NET_MPSAFE @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.57 2017/09/25 01:56:22 ozaki-r Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.57 2017/09/25 01:56:22 ozaki-r Exp $"); d109 8 a116 6 if ((n = m_copy(m, 0, M_COPYALL)) == NULL) ; else if (sbappendaddr(&last->so_rcv, src, n, NULL) == 0) /* should notify about lost packet */ m_freem(n); else { a117 1 } d121 8 a128 4 if (last == NULL || sbappendaddr(&last->so_rcv, src, m, NULL) == 0) m_freem(m); else { sorwakeup(last); @ 1.58.2.1 log @Synch with HEAD, resolve conflicts @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.59 2018/03/19 16:26:25 roy Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.59 2018/03/19 16:26:25 roy Exp $"); d109 6 a114 8 if ((n = m_copy(m, 0, M_COPYALL)) == NULL || sbappendaddr(&last->so_rcv, src, n, NULL) == 0) { if (n != NULL) m_freem(n); soroverflow(last); } else d116 1 d120 4 a123 8 if (last != NULL) { if (sbappendaddr(&last->so_rcv, src, m, NULL) == 0) { m_free(m); soroverflow(last); } else sorwakeup(last); } else { m_free(m); @ 1.58.2.2 log @Synch with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.60 2018/04/26 19:56:55 maxv Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.60 2018/04/26 19:56:55 maxv Exp $"); d110 1 a110 1 if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL || @ 1.58.2.3 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.61 2018/05/09 06:35:10 maxv Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.61 2018/05/09 06:35:10 maxv Exp $"); d110 1 a110 1 if ((n = m_copypacket(m, M_DONTWAIT)) == NULL || @ 1.58.2.4 log @Ssync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.62 2018/09/07 06:13:14 maxv Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.62 2018/09/07 06:13:14 maxv Exp $"); d68 1 a68 2 raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src, struct sockaddr *dst, struct rawcbhead *rawcbhead) d73 11 @ 1.57 log @Fix race condition on the rawcb list shared by rtsock and keysock keysock now protects itself by its own mutex, which means that the rawcb list is protected by two different mutexes (keysock's one and softnet_lock for rtsock), of course it's useless. Fix the situation by having a discrete rawcb list for each. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $"); a77 2 KASSERT(mutex_owned(softnet_lock)); @ 1.56 log @Add RO_MSGFILTER socket option to PF_ROUTE to filter out un-wanted route(4) messages. Inspired by the ROUTE_MSGFILTER equivalent in OpenBSD, but with an API which allows the full range of potential message types. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.55 2016/01/20 21:43:59 riastradh Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.55 2016/01/20 21:43:59 riastradh Exp $"); a56 6 void raw_init(void) { LIST_INIT(&rawcb); } d76 1 d84 1 d88 1 a88 1 LIST_FOREACH(rp, &rawcb, rcb_list) { @ 1.56.4.1 log @Pull up following revision(s) (requested by ozaki-r in ticket #300): crypto/dist/ipsec-tools/src/setkey/parse.y: 1.19 crypto/dist/ipsec-tools/src/setkey/token.l: 1.20 distrib/sets/lists/tests/mi: 1.754, 1.757, 1.759 doc/TODO.smpnet: 1.12-1.13 sys/net/pfkeyv2.h: 1.32 sys/net/raw_cb.c: 1.23-1.24, 1.28 sys/net/raw_cb.h: 1.28 sys/net/raw_usrreq.c: 1.57-1.58 sys/net/rtsock.c: 1.228-1.229 sys/netinet/in_proto.c: 1.125 sys/netinet/ip_input.c: 1.359-1.361 sys/netinet/tcp_input.c: 1.359-1.360 sys/netinet/tcp_output.c: 1.197 sys/netinet/tcp_var.h: 1.178 sys/netinet6/icmp6.c: 1.213 sys/netinet6/in6_proto.c: 1.119 sys/netinet6/ip6_forward.c: 1.88 sys/netinet6/ip6_input.c: 1.181-1.182 sys/netinet6/ip6_output.c: 1.193 sys/netinet6/ip6protosw.h: 1.26 sys/netipsec/ipsec.c: 1.100-1.122 sys/netipsec/ipsec.h: 1.51-1.61 sys/netipsec/ipsec6.h: 1.18-1.20 sys/netipsec/ipsec_input.c: 1.44-1.51 sys/netipsec/ipsec_netbsd.c: 1.41-1.45 sys/netipsec/ipsec_output.c: 1.49-1.64 sys/netipsec/ipsec_private.h: 1.5 sys/netipsec/key.c: 1.164-1.234 sys/netipsec/key.h: 1.20-1.32 sys/netipsec/key_debug.c: 1.18-1.21 sys/netipsec/key_debug.h: 1.9 sys/netipsec/keydb.h: 1.16-1.20 sys/netipsec/keysock.c: 1.59-1.62 sys/netipsec/keysock.h: 1.10 sys/netipsec/xform.h: 1.9-1.12 sys/netipsec/xform_ah.c: 1.55-1.74 sys/netipsec/xform_esp.c: 1.56-1.72 sys/netipsec/xform_ipcomp.c: 1.39-1.53 sys/netipsec/xform_ipip.c: 1.50-1.54 sys/netipsec/xform_tcp.c: 1.12-1.16 sys/rump/librump/rumpkern/Makefile.rumpkern: 1.170 sys/rump/librump/rumpnet/net_stub.c: 1.27 sys/sys/protosw.h: 1.67-1.68 tests/net/carp/t_basic.sh: 1.7 tests/net/if_gif/t_gif.sh: 1.11 tests/net/if_l2tp/t_l2tp.sh: 1.3 tests/net/ipsec/Makefile: 1.7-1.9 tests/net/ipsec/algorithms.sh: 1.5 tests/net/ipsec/common.sh: 1.4-1.6 tests/net/ipsec/t_ipsec_ah_keys.sh: 1.2 tests/net/ipsec/t_ipsec_esp_keys.sh: 1.2 tests/net/ipsec/t_ipsec_gif.sh: 1.6-1.7 tests/net/ipsec/t_ipsec_l2tp.sh: 1.6-1.7 tests/net/ipsec/t_ipsec_misc.sh: 1.8-1.18 tests/net/ipsec/t_ipsec_sockopt.sh: 1.1-1.2 tests/net/ipsec/t_ipsec_tcp.sh: 1.1-1.2 tests/net/ipsec/t_ipsec_transport.sh: 1.5-1.6 tests/net/ipsec/t_ipsec_tunnel.sh: 1.9 tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh: 1.1-1.2 tests/net/ipsec/t_ipsec_tunnel_odd.sh: 1.3 tests/net/mcast/t_mcast.sh: 1.6 tests/net/net/t_ipaddress.sh: 1.11 tests/net/net_common.sh: 1.20 tests/net/npf/t_npf.sh: 1.3 tests/net/route/t_flags.sh: 1.20 tests/net/route/t_flags6.sh: 1.16 usr.bin/netstat/fast_ipsec.c: 1.22 Do m_pullup before mtod It may fix panicks of some tests on anita/sparc and anita/GuruPlug. --- KNF --- Enable DEBUG for babylon5 --- Apply C99-style struct initialization to xformsw --- Tweak outputs of netstat -s for IPsec - Get rid of "Fast" - Use ipsec and ipsec6 for titles to clarify protocol - Indent outputs of sub protocols Original outputs were organized like this: (Fast) IPsec: IPsec ah: IPsec esp: IPsec ipip: IPsec ipcomp: (Fast) IPsec: IPsec ah: IPsec esp: IPsec ipip: IPsec ipcomp: New outputs are organized like this: ipsec: ah: esp: ipip: ipcomp: ipsec6: ah: esp: ipip: ipcomp: --- Add test cases for IPComp --- Simplify IPSEC_OSTAT macro (NFC) --- KNF; replace leading whitespaces with hard tabs --- Introduce and use SADB_SASTATE_USABLE_P --- KNF --- Add update command for testing Updating an SA (SADB_UPDATE) requires that a process issuing SADB_UPDATE is the same as a process issued SADB_ADD (or SADB_GETSPI). This means that update command must be used with add command in a configuration of setkey. This usage is normally meaningless but useful for testing (and debugging) purposes. --- Add test cases for updating SA/SP The tests require newly-added udpate command of setkey. --- PR/52346: Frank Kardel: Fix checksumming for NAT-T See XXX for improvements. --- Remove codes for PACKET_TAG_IPSEC_IN_CRYPTO_DONE It seems that PACKET_TAG_IPSEC_IN_CRYPTO_DONE is for network adapters that have IPsec accelerators; a driver sets the mtag to a packet when its device has already encrypted the packet. Unfortunately no driver implements such offload features for long years and seems unlikely to implement them soon. (Note that neither FreeBSD nor Linux doesn't have such drivers.) Let's remove related (unused) codes and simplify the IPsec code. --- Fix usages of sadb_msg_errno --- Avoid updating sav directly On SADB_UPDATE a target sav was updated directly, which was unsafe. Instead allocate another sav, copy variables of the old sav to the new one and replace the old one with the new one. --- Simplify; we can assume sav->tdb_xform cannot be NULL while it's valid --- Rename key_alloc* functions (NFC) We shouldn't use the term "alloc" for functions that just look up data and actually don't allocate memory. --- Use explicit_memset to surely zero-clear key_auth and key_enc --- Make sure to clear keys on error paths of key_setsaval --- Add missing KEY_FREESAV --- Make sure a sav is inserted to a sah list after its initialization completes --- Remove unnecessary zero-clearing codes from key_setsaval key_setsaval is now used only for a newly-allocated sav. (It was used to reset variables of an existing sav.) --- Correct wrong assumption of sav->refcnt in key_delsah A sav in a list is basically not to be sav->refcnt == 0. And also KEY_FREESAV assumes sav->refcnt > 0. --- Let key_getsavbyspi take a reference of a returning sav --- Use time_mono_to_wall (NFC) --- Separate sending message routine (NFC) --- Simplify; remove unnecessary zero-clears key_freesaval is used only when a target sav is being destroyed. --- Omit NULL checks for sav->lft_c sav->lft_c can be NULL only when initializing or destroying sav. --- Omit unnecessary NULL checks for sav->sah --- Omit unnecessary check of sav->state key_allocsa_policy picks a sav of either MATURE or DYING so we don't need to check its state again. --- Simplify; omit unnecessary saidx passing - ipsec_nextisr returns a saidx but no caller uses it - key_checkrequest is passed a saidx but it can be gotton by another argument (isr) --- Fix splx isn't called on some error paths --- Fix header size calculation of esp where sav is NULL --- Fix header size calculation of ah in the case sav is NULL This fix was also needed for esp. --- Pass sav directly to opencrypto callback In a callback, use a passed sav as-is by default and look up a sav only if the passed sav is dead. --- Avoid examining freshness of sav on packet processing If a sav list is sorted (by lft_c->sadb_lifetime_addtime) in advance, we don't need to examine each sav and also don't need to delete one on the fly and send up a message. Fortunately every sav lists are sorted as we need. Added key_validate_savlist validates that each sav list is surely sorted (run only if DEBUG because it's not cheap). --- Add test cases for SAs with different SPIs --- Prepare to stop using isr->sav isr is a shared resource and using isr->sav as a temporal storage for each packet processing is racy. And also having a reference from isr to sav makes the lifetime of sav non-deterministic; such a reference is removed when a packet is processed and isr->sav is overwritten by new one. Let's have a sav locally for each packet processing instead of using shared isr->sav. However this change doesn't stop using isr->sav yet because there are some users of isr->sav. isr->sav will be removed after the users find a way to not use isr->sav. --- Fix wrong argument handling --- fix printf format. --- Don't validate sav lists of LARVAL or DEAD states We don't sort the lists so the validation will always fail. Fix PR kern/52405 --- Make sure to sort the list when changing the state by key_sa_chgstate --- Rename key_allocsa_policy to key_lookup_sa_bysaidx --- Separate test files --- Calculate ah_max_authsize on initialization as well as esp_max_ivlen --- Remove m_tag_find(PACKET_TAG_IPSEC_PENDING_TDB) because nobody sets the tag --- Restore a comment removed in previous The comment is valid for the below code. --- Make tests more stable sleep command seems to wait longer than expected on anita so use polling to wait for a state change. --- Add tests that explicitly delete SAs instead of waiting for expirations --- Remove invalid M_AUTHIPDGM check on ESP isr->sav M_AUTHIPDGM flag is set to a mbuf in ah_input_cb. An sav of ESP can have AH authentication as sav->tdb_authalgxform. However, in that case esp_input and esp_input_cb are used to do ESP decryption and AH authentication and M_AUTHIPDGM never be set to a mbuf. So checking M_AUTHIPDGM of a mbuf on isr->sav of ESP is meaningless. --- Look up sav instead of relying on unstable sp->req->sav This code is executed only in an error path so an additional lookup doesn't matter. --- Correct a comment --- Don't release sav if calling crypto_dispatch again --- Remove extra KEY_FREESAV from ipsec_process_done It should be done by the caller. --- Don't bother the case of crp->crp_buf == NULL in callbacks --- Hold a reference to an SP during opencrypto processing An SP has a list of isr (ipsecrequest) that represents a sequence of IPsec encryption/authentication processing. One isr corresponds to one opencrypto processing. The lifetime of an isr follows its SP. We pass an isr to a callback function of opencrypto to continue to a next encryption/authentication processing. However nobody guaranteed that the isr wasn't freed, i.e., its SP wasn't destroyed. In order to avoid such unexpected destruction of isr, hold a reference to its SP during opencrypto processing. --- Don't make SAs expired on tests that delete SAs explicitly --- Fix a debug message --- Dedup error paths (NFC) --- Use pool to allocate tdb_crypto For ESP and AH, we need to allocate an extra variable space in addition to struct tdb_crypto. The fixed size of pool items may be larger than an actual requisite size of a buffer, but still the performance improvement by replacing malloc with pool wins. --- Don't use unstable isr->sav for header size calculations We may need to optimize to not look up sav here for users that don't need to know an exact size of headers (e.g., TCP segmemt size caclulation). --- Don't use sp->req->sav when handling NAT-T ESP fragmentation In order to do this we need to look up a sav however an additional look-up degrades performance. A sav is later looked up in ipsec4_process_packet so delay the fragmentation check until then to avoid an extra look-up. --- Don't use key_lookup_sp that depends on unstable sp->req->sav It provided a fast look-up of SP. We will provide an alternative method in the future (after basic MP-ification finishes). --- Stop setting isr->sav on looking up sav in key_checkrequest --- Remove ipsecrequest#sav --- Stop setting mtag of PACKET_TAG_IPSEC_IN_DONE because there is no users anymore --- Skip ipsec_spi_*_*_preferred_new_timeout when running on qemu Probably due to PR 43997 --- Add localcount to rump kernels --- Remove unused macro --- Fix key_getcomb_setlifetime The fix adjusts a soft limit to be 80% of a corresponding hard limit. I'm not sure the fix is really correct though, at least the original code is wrong. A passed comb is zero-cleared before calling key_getcomb_setlifetime, so comb->sadb_comb_soft_addtime = comb->sadb_comb_soft_addtime * 80 / 100; is meaningless. --- Provide and apply key_sp_refcnt (NFC) It simplifies further changes. --- Fix indentation Pointed out by knakahara@@ --- Use pslist(9) for sptree --- Don't acquire global locks for IPsec if NET_MPSAFE Note that the change is just to make testing easy and IPsec isn't MP-safe yet. --- Let PF_KEY socks hold their own lock instead of softnet_lock Operations on SAD and SPD are executed via PF_KEY socks. The operations include deletions of SAs and SPs that will use synchronization mechanisms such as pserialize_perform to wait for references to SAs and SPs to be released. It is known that using such mechanisms with holding softnet_lock causes a dead lock. We should avoid the situation. --- Make IPsec SPD MP-safe We use localcount(9), not psref(9), to make the sptree and secpolicy (SP) entries MP-safe because SPs need to be referenced over opencrypto processing that executes a callback in a different context. SPs on sockets aren't managed by the sptree and can be destroyed in softint. localcount_drain cannot be used in softint so we delay the destruction of such SPs to a thread context. To do so, a list to manage such SPs is added (key_socksplist) and key_timehandler_spd deletes dead SPs in the list. For more details please read the locking notes in key.c. Proposed on tech-kern@@ and tech-net@@ --- Fix updating ipsec_used - key_update_used wasn't called in key_api_spddelete2 and key_api_spdflush - key_update_used wasn't called if an SP had been added/deleted but a reply to userland failed --- Fix updating ipsec_used; turn on when SPs on sockets are added --- Add missing IPsec policy checks to icmp6_rip6_input icmp6_rip6_input is quite similar to rip6_input and the same checks exist in rip6_input. --- Add test cases for setsockopt(IP_IPSEC_POLICY) --- Don't use KEY_NEWSP for dummy SP entries By the change KEY_NEWSP is now not called from softint anymore and we can use kmem_zalloc with KM_SLEEP for KEY_NEWSP. --- Comment out unused functions --- Add test cases that there are SPs but no relevant SAs --- Don't allow sav->lft_c to be NULL lft_c of an sav that was created by SADB_GETSPI could be NULL. --- Clean up clunky eval strings - Remove unnecessary \ at EOL - This allows to omit ; too - Remove unnecessary quotes for arguments of atf_set - Don't expand $DEBUG in eval - We expect it's expanded on execution Suggested by kre@@ --- Remove unnecessary KEY_FREESAV in an error path sav should be freed (unreferenced) by the caller. --- Use pslist(9) for sahtree --- Use pslist(9) for sah->savtree --- Rename local variable newsah to sah It may not be new. --- MP-ify SAD slightly - Introduce key_sa_mtx and use it for some list operations - Use pserialize for some list iterations --- Introduce KEY_SA_UNREF and replace KEY_FREESAV with it where sav will never be actually freed in the future KEY_SA_UNREF is still key_freesav so no functional change for now. This change reduces diff of further changes. --- Remove out-of-date log output Pointed out by riastradh@@ --- Use KDASSERT instead of KASSERT for mutex_ownable Because mutex_ownable is too heavy to run in a fast path even for DIAGNOSTIC + LOCKDEBUG. Suggested by riastradh@@ --- Assemble global lists and related locks into cache lines (NFCI) Also rename variable names from *tree to *list because they are just lists, not trees. Suggested by riastradh@@ --- Move locking notes --- Update the locking notes - Add locking order - Add locking notes for misc lists such as reglist - Mention pserialize, key_sp_ref and key_sp_unref on SP operations Requested by riastradh@@ --- Describe constraints of key_sp_ref and key_sp_unref Requested by riastradh@@ --- Hold key_sad.lock on SAVLIST_WRITER_INSERT_TAIL --- Add __read_mostly to key_psz Suggested by riastradh@@ --- Tweak wording (pserialize critical section => pserialize read section) Suggested by riastradh@@ --- Add missing mutex_exit --- Fix setkey -D -P outputs The outputs were tweaked (by me), but I forgot updating libipsec in my local ATF environment... --- MP-ify SAD (key_sad.sahlist and sah entries) localcount(9) is used to protect key_sad.sahlist and sah entries as well as SPD (and will be used for SAD sav). Please read the locking notes of SAD for more details. --- Introduce key_sa_refcnt and replace sav->refcnt with it (NFC) --- Destroy sav only in the loop for DEAD sav --- Fix KASSERT(solocked(sb->sb_so)) failure in sbappendaddr that is called eventually from key_sendup_mbuf If key_sendup_mbuf isn't passed a socket, the assertion fails. Originally in this case sb->sb_so was softnet_lock and callers held softnet_lock so the assertion was magically satisfied. Now sb->sb_so is key_so_mtx and also softnet_lock isn't always held by callers so the assertion can fail. Fix it by holding key_so_mtx if key_sendup_mbuf isn't passed a socket. Reported by knakahara@@ Tested by knakahara@@ and ozaki-r@@ --- Fix locking notes of SAD --- Fix deadlock between key_sendup_mbuf called from key_acquire and localcount_drain If we call key_sendup_mbuf from key_acquire that is called on packet processing, a deadlock can happen like this: - At key_acquire, a reference to an SP (and an SA) is held - key_sendup_mbuf will try to take key_so_mtx - Some other thread may try to localcount_drain to the SP with holding key_so_mtx in say key_api_spdflush - In this case localcount_drain never return because key_sendup_mbuf that has stuck on key_so_mtx never release a reference to the SP Fix the deadlock by deferring key_sendup_mbuf to the timer (key_timehandler). --- Fix that prev isn't cleared on retry --- Limit the number of mbufs queued for deferred key_sendup_mbuf It's easy to be queued hundreds of mbufs on the list under heavy network load. --- MP-ify SAD (savlist) localcount(9) is used to protect savlist of sah. The basic design is similar to MP-ifications of SPD and SAD sahlist. Please read the locking notes of SAD for more details. --- Simplify ipsec_reinject_ipstack (NFC) --- Add per-CPU rtcache to ipsec_reinject_ipstack It reduces route lookups and also reduces rtcache lock contentions when NET_MPSAFE is enabled. --- Use pool_cache(9) instead of pool(9) for tdb_crypto objects The change improves network throughput especially on multi-core systems. --- Update ipsec(4), opencrypto(9) and vlan(4) are now MP-safe. --- Write known issues on scalability --- Share a global dummy SP between PCBs It's never be changed so it can be pre-allocated and shared safely between PCBs. --- Fix race condition on the rawcb list shared by rtsock and keysock keysock now protects itself by its own mutex, which means that the rawcb list is protected by two different mutexes (keysock's one and softnet_lock for rtsock), of course it's useless. Fix the situation by having a discrete rawcb list for each. --- Use a dedicated mutex for rt_rawcb instead of softnet_lock if NET_MPSAFE --- fix localcount leak in sav. fixed by ozaki-r@@n.o. I commit on behalf of him. --- remove unnecessary comment. --- Fix deadlock between pserialize_perform and localcount_drain A typical ussage of localcount_drain looks like this: mutex_enter(&mtx); item = remove_from_list(); pserialize_perform(psz); localcount_drain(&item->localcount, &cv, &mtx); mutex_exit(&mtx); This sequence can cause a deadlock which happens for example on the following situation: - Thread A calls localcount_drain which calls xc_broadcast after releasing a specified mutex - Thread B enters the sequence and calls pserialize_perform with holding the mutex while pserialize_perform also calls xc_broadcast - Thread C (xc_thread) that calls an xcall callback of localcount_drain tries to hold the mutex xc_broadcast of thread B doesn't start until xc_broadcast of thread A finishes, which is a feature of xcall(9). This means that pserialize_perform never complete until xc_broadcast of thread A finishes. On the other hand, thread C that is a callee of xc_broadcast of thread A sticks on the mutex. Finally the threads block each other (A blocks B, B blocks C and C blocks A). A possible fix is to serialize executions of the above sequence by another mutex, but adding another mutex makes the code complex, so fix the deadlock by another way; the fix is to release the mutex before pserialize_perform and instead use a condvar to prevent pserialize_perform from being called simultaneously. Note that the deadlock has happened only if NET_MPSAFE is enabled. --- Add missing ifdef NET_MPSAFE --- Take softnet_lock on pr_input properly if NET_MPSAFE Currently softnet_lock is taken unnecessarily in some cases, e.g., icmp_input and encap4_input from ip_input, or not taken even if needed, e.g., udp_input and tcp_input from ipsec4_common_input_cb. Fix them. NFC if NET_MPSAFE is disabled (default). --- - sanitize key debugging so that we don't print extra newlines or unassociated debugging messages. - remove unused functions and make internal ones static - print information in one line per message --- humanize printing of ip addresses --- cast reduction, NFC. --- Fix typo in comment --- Pull out ipsec_fill_saidx_bymbuf (NFC) --- Don't abuse key_checkrequest just for looking up sav It does more than expected for example key_acquire. --- Fix SP is broken on transport mode isr->saidx was modified accidentally in ipsec_nextisr. Reported by christos@@ Helped investigations by christos@@ and knakahara@@ --- Constify isr at many places (NFC) --- Include socketvar.h for softnet_lock --- Fix buffer length for ipsec_logsastr @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $"); d57 6 d82 2 a83 1 struct rawcbhead *rawcbhead; a88 1 rawcbhead = va_arg(ap, struct rawcbhead *); d92 1 a92 1 LIST_FOREACH(rp, rawcbhead, rcb_list) { @ 1.56.4.2 log @Pull up following revision(s) (requested by roy in ticket #724): tests/net/icmp/t_ping.c: revision 1.19 sys/netinet6/raw_ip6.c: revision 1.166 sys/netinet6/ip6_input.c: revision 1.195 sys/net/raw_usrreq.c: revision 1.59 sys/sys/socketvar.h: revision 1.151 sys/kern/uipc_socket2.c: revision 1.128 tests/lib/libc/sys/t_recvmmsg.c: revision 1.2 lib/libc/sys/recv.2: revision 1.38 sys/net/rtsock.c: revision 1.239 sys/netinet/udp_usrreq.c: revision 1.246 sys/netinet6/icmp6.c: revision 1.224 tests/net/icmp/t_ping.c: revision 1.20 sys/netipsec/keysock.c: revision 1.63 sys/netinet/raw_ip.c: revision 1.172 sys/kern/uipc_socket.c: revision 1.260 tests/net/icmp/t_ping.c: revision 1.22 sys/kern/uipc_socket.c: revision 1.261 tests/net/icmp/t_ping.c: revision 1.23 sys/netinet/ip_mroute.c: revision 1.155 sbin/route/route.c: revision 1.159 sys/netinet6/ip6_mroute.c: revision 1.123 sys/netatalk/ddp_input.c: revision 1.31 sys/netcan/can.c: revision 1.3 sys/kern/uipc_usrreq.c: revision 1.184 sys/netinet6/udp6_usrreq.c: revision 1.138 tests/net/icmp/t_ping.c: revision 1.18 socket: report receive buffer overflows Add soroverflow() which increments the overflow counter, sets so_error to ENOBUFS and wakes the receive socket up. Replace all code that manually increments this counter with soroverflow(). Add soroverflow() to raw_input(). This allows userland to detect route(4) overflows so it can re-sync with the current state. socket: clear error even when peeking The error has already been reported and it's pointless requiring another recv(2) call just to clear it. socket: remove now incorrect comment that so_error is only udp As it can be affected by route(4) sockets which are raw. rtsock: log dropped messages that we cannot report to userland Handle ENOBUFS when receiving messages. Don't send messages if the receiver has died. Sprinkle more soroverflow(). Handle ENOBUFS in recv Handle ENOBUFS in sendto Note value received. Harden another sendto for ENOBUFS. Handle the routing socket overflowing gracefully. Allow a valid sendto .... duh Handle errors better. Fix test for checking we sent all the data we asked to. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.56.4.1 2017/10/21 19:43:54 snj Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.56.4.1 2017/10/21 19:43:54 snj Exp $"); d109 6 a114 8 if ((n = m_copy(m, 0, M_COPYALL)) == NULL || sbappendaddr(&last->so_rcv, src, n, NULL) == 0) { if (n != NULL) m_freem(n); soroverflow(last); } else d116 1 d120 4 a123 8 if (last != NULL) { if (sbappendaddr(&last->so_rcv, src, m, NULL) == 0) { m_free(m); soroverflow(last); } else sorwakeup(last); } else { m_free(m); @ 1.56.4.3 log @Pull up following revision(s) (requested by ozaki-r in ticket #1318): sys/net/raw_usrreq.c: revision 1.63 sys/net/raw_usrreq.c: revision 1.64 Fix typo (s/m_free/m_freem/) This fixes PR kern/54419 "mbuf leak when deleting route" from sc dying. - Fix typo (s/m_free/m_freem/) (one more) @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.56.4.2 2018/04/09 13:34:10 bouyer Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.56.4.2 2018/04/09 13:34:10 bouyer Exp $"); d123 1 a123 1 m_freem(m); d128 1 a128 1 m_freem(m); @ 1.55 log @Eliminate struct protosw::pr_output. You can't use this unless you know what it is a priori: the formal prototype is variadic, and the different instances (e.g., ip_output, route_output) have different real prototypes. Convert the only user of it, raw_send in net/raw_cb.c, to take an explicit callback argument. Convert the only instances of it, route_output and key_output, to such explicit callbacks for raw_send. Use assertions to make sure the conversion to explicit callbacks is warranted. Discussed on tech-net with no objections: https://mail-index.netbsd.org/tech-net/2016/01/16/msg005484.html @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.54 2015/05/02 17:18:03 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.54 2015/05/02 17:18:03 rtr Exp $"); d110 3 @ 1.55.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $"); a109 3 /* Run any filtering that may have been installed. */ if (rp->rcb_filter != NULL && rp->rcb_filter(m, proto, rp) != 0) continue; @ 1.55.4.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.56 2017/04/11 13:55:54 roy Exp $"); a109 3 /* Run any filtering that may have been installed. */ if (rp->rcb_filter != NULL && rp->rcb_filter(m, proto, rp) != 0) continue; @ 1.54 log @make connect syscall use sockaddr_big and modify pr_{send,connect} nam parameter type from buf * to sockaddr *. final commit for parameter type changes to protocol user requests * bump kernel version to 7.99.15 for parameter type changes to pr_{send,connect} @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.53 2015/04/24 22:32:37 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.53 2015/04/24 22:32:37 rtr Exp $"); d156 2 a157 1 struct mbuf *control, struct lwp *l) d190 1 a190 1 error = (*so->so_proto->pr_output)(m, so); @ 1.53 log @make accept, getsockname and getpeername syscalls use sockaddr_big and modify pr_{accept,sockname,peername} nam parameter type from mbuf * to sockaddr *. * retained use of mbuftypes[MT_SONAME] for now. * bump to netbsd version 7.99.12 for parameter type change. patch posted to tech-net@@ 2015/04/19 @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.52 2014/08/09 05:33:01 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.52 2014/08/09 05:33:01 rtr Exp $"); d155 1 a155 1 raw_send(struct socket *so, struct mbuf *m, struct mbuf *nam, @ 1.52 log @split PRU_CONNECT2 & PRU_PURGEIF function out of pr_generic() usrreq switches and put into separate functions - always KASSERT(solocked(so)) even if not implemented (for PRU_CONNECT2 only) - replace calls to pr_generic() with req = PRU_CONNECT2 with calls to pr_connect2() - replace calls to pr_generic() with req = PRU_PURGEIF with calls to pr_purgeif() put common code from unp_connect2() (used by unp_connect() into unp_connect1() and call out to it when needed patch only briefly reviewed by rmind@@ @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.51 2014/08/08 03:05:45 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.51 2014/08/08 03:05:45 rtr Exp $"); d141 1 a141 1 raw_setsockaddr(struct rawcb *rp, struct mbuf *nam) d144 1 a144 2 nam->m_len = rp->rcb_laddr->sa_len; memcpy(mtod(nam, void *), rp->rcb_laddr, (size_t)nam->m_len); d148 1 a148 1 raw_setpeeraddr(struct rawcb *rp, struct mbuf *nam) d151 1 a151 2 nam->m_len = rp->rcb_faddr->sa_len; memcpy(mtod(nam, void *), rp->rcb_faddr, (size_t)nam->m_len); @ 1.52.4.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.54 2015/05/02 17:18:03 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.54 2015/05/02 17:18:03 rtr Exp $"); d141 1 a141 1 raw_setsockaddr(struct rawcb *rp, struct sockaddr *nam) d144 2 a145 1 memcpy(nam, rp->rcb_laddr, rp->rcb_laddr->sa_len); d149 1 a149 1 raw_setpeeraddr(struct rawcb *rp, struct sockaddr *nam) d152 2 a153 1 memcpy(nam, rp->rcb_faddr, rp->rcb_faddr->sa_len); d157 1 a157 1 raw_send(struct socket *so, struct mbuf *m, struct sockaddr *nam, @ 1.52.4.2 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.52.4.1 2015/06/06 14:40:25 skrll Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.52.4.1 2015/06/06 14:40:25 skrll Exp $"); d156 1 a156 2 struct mbuf *control, struct lwp *l, int (*output)(struct mbuf *, struct socket *)) d189 1 a189 1 error = (*output)(m, so); @ 1.52.4.3 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.52.4.2 2016/03/19 11:30:32 skrll Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.52.4.2 2016/03/19 11:30:32 skrll Exp $"); a109 3 /* Run any filtering that may have been installed. */ if (rp->rcb_filter != NULL && rp->rcb_filter(m, proto, rp) != 0) continue; @ 1.51 log @split PRU_RCVD function out of pr_generic() usrreq switches and put into separate functions - always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_RCVD with calls to pr_rcvd() @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.50 2014/08/05 07:55:31 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.50 2014/08/05 07:55:31 rtr Exp $"); a201 2 struct rawcb *rp = sotorawcb(so); int s, error = 0; d209 1 d221 1 d223 2 a224 8 s = splsoftnet(); KERNEL_LOCK(1, NULL); KASSERT(!control); if (rp == NULL) { error = EINVAL; goto release; } d226 1 a226 14 switch (req) { /* * If a socket isn't bound to a single address, * the raw input routine will hand it anything * within that protocol family (assuming there's * nothing else around it should go to). */ case PRU_CONNECT2: error = EOPNOTSUPP; break; default: panic("raw_usrreq"); } d228 1 a228 4 release: KERNEL_UNLOCK_ONE(NULL); splx(s); return (error); @ 1.50 log @split PRU_SEND function out of pr_generic() usrreq switches and put into separate functions xxx_send(struct socket *, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *) - always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_SEND with calls to pr_send() rename existing functions that operate on PCB for consistency (and to free up their names for xxx_send() PRUs - l2cap_send() -> l2cap_send_pcb() - sco_send() -> sco_send_pcb() - rfcomm_send() -> rfcomm_send_pcb() patch reviewed by rmind @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.49 2014/08/05 05:24:26 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.49 2014/08/05 05:24:26 rtr Exp $"); d218 1 a242 4 case PRU_RCVD: error = EOPNOTSUPP; break; @ 1.49 log @revert the removal of struct lwp * parameter from bind, listen and connect user requests. this should resolve the issue relating to nfs client hangs presented recently by wiz on current-users@@ @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.48 2014/07/31 05:13:53 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.48 2014/07/31 05:13:53 rtr Exp $"); d157 42 d219 1 d225 1 a225 1 KASSERT(!control || req == PRU_SEND); a245 33 /* * Ship a packet out. The appropriate raw output * routine handles any massaging necessary. */ case PRU_SEND: if (control && control->m_len) { m_freem(control); m_freem(m); error = EINVAL; break; } if (nam) { if ((so->so_state & SS_ISCONNECTED) != 0) { error = EISCONN; goto die; } error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam, l); if (error) { die: m_freem(m); break; } } else { if ((so->so_state & SS_ISCONNECTED) == 0) { error = ENOTCONN; goto die; } } error = (*so->so_proto->pr_output)(m, so); if (nam) raw_disconnect(rp); break; @ 1.48 log @fix missed conversion to call to pr_connect() from pr_generic() when PRU_CONNECT split was done. - error = (*so->so_proto->pr_usrreqs->pr_generic)(so, - PRU_CONNECT, NULL, nam, NULL, l); + error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam); without this change KASSERT() would be triggered if raw send needs to perform a connect. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.47 2014/07/31 03:39:35 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.47 2014/07/31 03:39:35 rtr Exp $"); d219 1 a219 1 error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam); @ 1.47 log @split PRU_DISCONNECT, PRU_SHUTDOWN and PRU_ABORT function out of pr_generic() usrreq switches and put into separate functions xxx_disconnect(struct socket *) xxx_shutdown(struct socket *) xxx_abort(struct socket *) - always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_{DISCONNECT,SHUTDOWN,ABORT} with calls to pr_{disconnect,shutdown,abort}() respectively rename existing internal functions used to implement above functionality to permit use of the names for xxx_{disconnect,shutdown,abort}(). - {l2cap,sco,rfcomm}_disconnect() -> {l2cap,sco,rfcomm}_disconnect_pcb() - {unp,rip,tcp}_disconnect() -> {unp,rip,tcp}_disconnect1() - unp_shutdown() -> unp_shutdown1() patch reviewed by rmind @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.46 2014/07/30 10:04:26 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.46 2014/07/30 10:04:26 rtr Exp $"); d219 1 a219 2 error = (*so->so_proto->pr_usrreqs->pr_generic)(so, PRU_CONNECT, NULL, nam, NULL, l); @ 1.46 log @split PRU_CONNECT function out of pr_generic() usrreq switches and put into seaparate functions xxx_listen(struct socket *, struct mbuf *) - always KASSERT(solocked(so)) and KASSERT(nam != NULL) - replace calls to pr_generic() with req = PRU_CONNECT with pr_connect() - rename existin {l2cap,sco,rfcomm}_connect() to {l2cap,sco,rfcomm}_connect_pcb() respectively to permit naming consistency with other protocols functions. - drop struct lwp * parameter from unp_connect() and at_pcbconnect() and use curlwp instead where appropriate. patch reviewed by rmind @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.45 2014/07/24 15:12:03 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.45 2014/07/24 15:12:03 rtr Exp $"); d169 3 a198 12 case PRU_DISCONNECT: soisdisconnected(so); raw_disconnect(rp); break; /* * Mark the connection as being incapable of further input. */ case PRU_SHUTDOWN: socantsendmore(so); break; @ 1.45 log @split PRU_BIND and PRU_LISTEN function out of pr_generic() usrreq switches and put into separate functions xxx_bind(struct socket *, struct mbuf *) xxx_listen(struct socket *) - always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_BIND with call to pr_bind() - replace calls to pr_generic() with req = PRU_LISTEN with call to pr_listen() - drop struct lwp * parameter from at_pcbsetaddr(), in_pcbbind() and unp_bind() and always use curlwp. rename existing functions that operate on PCB for consistency (and to free up their names for xxx_{bind,listen}() PRUs - l2cap_{bind,listen}() -> l2cap_{bind,listen}_pcb() - sco_{bind,listen}() -> sco_{bind,listen}_pcb() - rfcomm_{bind,listen}() -> rfcomm_{bind,listen}_pcb() patch reviewed by rmind welcome to netbsd 6.99.48 @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.44 2014/07/23 13:17:18 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.44 2014/07/23 13:17:18 rtr Exp $"); d168 1 a191 1 case PRU_CONNECT: @ 1.44 log @split PRU_SENDOOB and PRU_RCVOOB function out of pr_generic() usrreq switches and put into separate functions xxx_sendoob(struct socket *, struct mbuf *, struct mbuf *) xxx_recvoob(struct socket *, struct mbuf *, int) - always KASSERT(solocked(so)) even if request is not implemented - replace calls to pr_generic() with req = PRU_{SEND,RCV}OOB with calls to pr_{send,recv}oob() respectively. there is still some tweaking of m_freem(m) and m_freem(control) to come for consistency. not performed with this commit for clarity. reviewed by rmind @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.43 2014/07/09 14:41:42 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.43 2014/07/09 14:41:42 rtr Exp $"); d166 2 a190 2 case PRU_BIND: case PRU_LISTEN: @ 1.43 log @* split PRU_ACCEPT function out of pr_generic() usrreq switches and put into a separate function xxx_accept(struct socket *, struct mbuf *) note: future cleanup will take place to remove struct mbuf parameter type and replace it with a more appropriate type. patch reviewed by rmind @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.42 2014/07/09 04:54:03 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.42 2014/07/09 04:54:03 rtr Exp $"); d170 2 d176 1 a176 1 KASSERT(!control || (req == PRU_SEND || req == PRU_SENDOOB)); a245 13 /* * Not supported. */ case PRU_RCVOOB: error = EOPNOTSUPP; break; case PRU_SENDOOB: m_freem(control); m_freem(m); error = EOPNOTSUPP; break; @ 1.42 log @* split PRU_PEERADDR and PRU_SOCKADDR function out of pr_generic() usrreq switches and put into separate functions xxx_{peer,sock}addr(struct socket *, struct mbuf *). - KASSERT(solocked(so)) always in new functions even if request is not implemented - KASSERT(pcb != NULL) and KASSERT(nam) if the request is implemented and not for tcp. * for tcp roll #ifdef KPROF and #ifdef DEBUG code from tcp_usrreq() into easier to cut & paste functions tcp_debug_capture() and tcp_debug_trace() - functions provided by rmind - remaining use of PRU_{PEER,SOCK}ADDR #define to be removed in a future commit. * rename netbt functions to permit consistency of pru function names (as has been done with other requests already split out). - l2cap_{peer,sock}addr() -> l2cap_{peer,sock}_addr_pcb() - rfcomm_{peer,sock}addr() -> rfcomm_{peer,sock}_addr_pcb() - sco_{peer,sock}addr() -> sco_{peer,sock}_addr_pcb() * split/refactor do_sys_getsockname(lwp, fd, which, nam) into two functions do_sys_get{peer,sock}name(fd, nam). - move PRU_PEERADDR handling into do_sys_getpeername() from do_sys_getsockname() - have svr4_stream directly call do_sys_get{sock,peer}name() respectively instead of providing `which' & fix a DPRINTF string that incorrectly wrote "getpeername" when it meant "getsockname" - fix sys_getpeername() and sys_getsockname() to call do_sys_get{sock,peer}name() without `which' and `lwp' & adjust comments - bump kernel version for removal of lwp & which parameters from do_sys_getsockname() note: future cleanup to remove struct mbuf * abuse in xxx_{peer,sock}name() still to come, not done in this commit since it is easier to do post split. patch reviewed by rmind welcome to 6.99.47 @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.41 2014/07/06 03:33:33 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.41 2014/07/06 03:33:33 rtr Exp $"); d165 1 @ 1.41 log @* split PRU_SENSE functionality out of xxx_usrreq() switches and place into separate xxx_stat(struct socket *, struct stat *) functions. * replace calls using pr_generic with req == PRU_SENSE with pr_stat(). further change will follow that cleans up the pattern used to extract the pcb and test for its presence. reviewed by rmind @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.40 2014/06/22 08:10:18 rtr Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.40 2014/06/22 08:10:18 rtr Exp $"); d167 2 a255 16 case PRU_SOCKADDR: if (rp->rcb_laddr == NULL) { error = EINVAL; break; } raw_setsockaddr(rp, nam); break; case PRU_PEERADDR: if (rp->rcb_faddr == NULL) { error = ENOTCONN; break; } raw_setpeeraddr(rp, nam); break; @ 1.40 log @* split PRU_CONTROL functionality out of xxx_userreq() switches and place into separate xxx_ioctl() functions. * place KASSERT(req != PRU_CONTROL) inside xxx_userreq() as it is now inappropriate for req = PRU_CONTROL in xxx_userreq(). * replace calls to pr_generic() with req = PRU_CONTROL with pr_ioctl(). * remove & fixup references to PRU_CONTROL xxx_userreq() function comments. * fix various comments references for xxx_userreq() that mentioned PRU_CONTROL as xxx_userreq() no longer handles the request. a further change will follow to fix parameter and naming inconsistencies retained from original code. Reviewed by rmind@@ @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.39 2014/05/19 02:51:24 rmind Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.39 2014/05/19 02:51:24 rmind Exp $"); d166 1 a240 7 case PRU_SENSE: /* * stat: don't bother with a blocksize. */ error = 0; break; @ 1.39 log @- Split off PRU_ATTACH and PRU_DETACH logic into separate functions. - Replace malloc with kmem and eliminate M_PCB while here. - Sprinkle more asserts. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.38 2014/05/18 14:46:16 rmind Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.38 2014/05/18 14:46:16 rmind Exp $"); d165 1 a165 3 if (req == PRU_CONTROL) return EOPNOTSUPP; @ 1.38 log @Add struct pr_usrreqs with a pr_generic function and prepare for the dismantling of pr_usrreq in the protocols; no functional change intended. PRU_ATTACH/PRU_DETACH changes will follow soon. Bump for struct protosw. Welcome to 6.99.62! @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.37 2011/07/17 20:54:52 joerg Exp $ */ d34 4 d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.37 2011/07/17 20:54:52 joerg Exp $"); a56 3 /* * Initialize raw connection block q. */ a59 1 d70 2 a71 6 * Raw protocol input routine. Find the socket * associated with the packet(s) and move them over. If * nothing exists for this packet, drop it. */ /* * Raw protocol interface. a129 1 /*ARGSUSED*/ a155 1 /*ARGSUSED*/ d160 5 a164 3 struct rawcb *rp; int s; int error = 0; d167 1 a167 1 return (EOPNOTSUPP); d171 3 a173 6 rp = sotorawcb(so); #ifdef DIAGNOSTIC if (req != PRU_SEND && req != PRU_SENDOOB && control) panic("raw_usrreq: unexpected control mbuf"); #endif if (rp == NULL && req != PRU_ATTACH) { a178 24 /* * Allocate a raw control block and fill in the * necessary info to allow packets to be routed to * the appropriate raw interface routine. */ case PRU_ATTACH: sosetlock(so); if (l == NULL) break; /* XXX: raw socket permissions are checked in socreate() */ error = raw_attach(so, (int)(long)nam); break; /* * Destroy state just before socket deallocation. * Flush data or not depending on the options. */ case PRU_DETACH: raw_detach(rp); break; @ 1.37 log @Retire varargs.h support. Move machine/stdarg.h logic into MI sys/stdarg.h and expect compiler to provide proper builtins, defaulting to the GCC interface. lint still has a special fallback. Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and derive va_list as required by standards. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.36 2011/01/11 10:52:42 pooka Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.36 2011/01/11 10:52:42 pooka Exp $"); d255 2 a256 2 error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT, NULL, nam, NULL, l); @ 1.37.12.1 log @Rebase to HEAD as of a few days ago. @ text @d1 1 a1 1 /* $NetBSD$ */ a33 4 /* * Raw protocol interface. */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD$"); d53 3 d59 1 d70 6 a75 2 * raw_input: find the socket associated with the packet and move it over. * If nothing exists for this packet, drop it. d134 1 d161 1 d163 1 a163 1 raw_send(struct socket *so, struct mbuf *m, struct mbuf *nam, d166 2 a167 1 struct rawcb *rp = sotorawcb(so); d170 68 a237 1 KASSERT(rp != NULL); d243 3 a245 13 if (control && control->m_len) { m_freem(control); m_freem(m); return EINVAL; } if (nam) { if ((so->so_state & SS_ISCONNECTED) != 0) { error = EISCONN; goto die; } error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam, l); if (error) { die: d247 2 a248 1 return error; d250 17 a266 4 } else { if ((so->so_state & SS_ISCONNECTED) == 0) { error = ENOTCONN; goto die; d268 11 a278 4 } error = (*so->so_proto->pr_output)(m, so); if (nam) raw_disconnect(rp); d280 6 a285 2 return error; } d287 5 a291 4 int raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { d293 7 a299 19 KASSERT(req != PRU_ATTACH); KASSERT(req != PRU_DETACH); KASSERT(req != PRU_ACCEPT); KASSERT(req != PRU_BIND); KASSERT(req != PRU_LISTEN); KASSERT(req != PRU_CONNECT); KASSERT(req != PRU_CONNECT2); KASSERT(req != PRU_DISCONNECT); KASSERT(req != PRU_SHUTDOWN); KASSERT(req != PRU_ABORT); KASSERT(req != PRU_CONTROL); KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); KASSERT(req != PRU_RCVD); KASSERT(req != PRU_RCVOOB); KASSERT(req != PRU_SEND); KASSERT(req != PRU_SENDOOB); KASSERT(req != PRU_PURGEIF); d301 7 a307 2 if (sotorawcb(so) == NULL) return EINVAL; d309 3 a311 1 panic("raw_usrreq"); d313 4 a316 1 return 0; @ 1.37.12.2 log @update from HEAD @ text @d57 6 d82 2 a83 1 struct rawcbhead *rawcbhead; a88 1 rawcbhead = va_arg(ap, struct rawcbhead *); d92 1 a92 1 LIST_FOREACH(rp, rawcbhead, rcb_list) { a109 3 /* Run any filtering that may have been installed. */ if (rp->rcb_filter != NULL && rp->rcb_filter(m, proto, rp) != 0) continue; d141 1 a141 1 raw_setsockaddr(struct rawcb *rp, struct sockaddr *nam) d144 2 a145 1 memcpy(nam, rp->rcb_laddr, rp->rcb_laddr->sa_len); d149 1 a149 1 raw_setpeeraddr(struct rawcb *rp, struct sockaddr *nam) d152 2 a153 1 memcpy(nam, rp->rcb_faddr, rp->rcb_faddr->sa_len); d157 2 a158 3 raw_send(struct socket *so, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct lwp *l, int (*output)(struct mbuf *, struct socket *)) d191 1 a191 1 error = (*output)(m, so); @ 1.37.26.1 log @Rebase. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.52 2014/08/09 05:33:01 rtr Exp $ */ a33 4 /* * Raw protocol interface. */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.52 2014/08/09 05:33:01 rtr Exp $"); d53 3 d59 1 d70 6 a75 2 * raw_input: find the socket associated with the packet and move it over. * If nothing exists for this packet, drop it. d134 1 d161 1 d163 1 a163 1 raw_send(struct socket *so, struct mbuf *m, struct mbuf *nam, d166 2 a167 1 struct rawcb *rp = sotorawcb(so); d170 68 a237 1 KASSERT(rp != NULL); d243 3 a245 13 if (control && control->m_len) { m_freem(control); m_freem(m); return EINVAL; } if (nam) { if ((so->so_state & SS_ISCONNECTED) != 0) { error = EISCONN; goto die; } error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam, l); if (error) { die: d247 2 a248 1 return error; d250 17 a266 4 } else { if ((so->so_state & SS_ISCONNECTED) == 0) { error = ENOTCONN; goto die; d268 11 a278 4 } error = (*so->so_proto->pr_output)(m, so); if (nam) raw_disconnect(rp); d280 6 a285 2 return error; } d287 5 a291 4 int raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { d293 7 a299 19 KASSERT(req != PRU_ATTACH); KASSERT(req != PRU_DETACH); KASSERT(req != PRU_ACCEPT); KASSERT(req != PRU_BIND); KASSERT(req != PRU_LISTEN); KASSERT(req != PRU_CONNECT); KASSERT(req != PRU_CONNECT2); KASSERT(req != PRU_DISCONNECT); KASSERT(req != PRU_SHUTDOWN); KASSERT(req != PRU_ABORT); KASSERT(req != PRU_CONTROL); KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); KASSERT(req != PRU_RCVD); KASSERT(req != PRU_RCVOOB); KASSERT(req != PRU_SEND); KASSERT(req != PRU_SENDOOB); KASSERT(req != PRU_PURGEIF); d301 7 a307 2 if (sotorawcb(so) == NULL) return EINVAL; d309 3 a311 1 panic("raw_usrreq"); d313 4 a316 1 return 0; @ 1.37.16.1 log @Checkpoint work in progress: - Initial split of the protocol user-request method into the following methods: pr_attach, pr_detach and pr_generic for old the pr_usrreq. - Adjust socreate(9) and sonewconn(9) to call pr_attach without the socket lock held (as a preparation for the locking scheme adjustment). - Adjust all pr_attach routines to assert that PCB is not set. - Sprinkle various comments, document some routines and their locking. - Remove M_PCB, replace with kmem(9). - Fix few bugs spotted on the way. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.37 2011/07/17 20:54:52 joerg Exp $ */ a33 4 /* * Raw protocol interface. */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.37 2011/07/17 20:54:52 joerg Exp $"); d53 3 d59 1 d70 6 a75 2 * raw_input: find the socket associated with the packet and move it over. * If nothing exists for this packet, drop it. d134 1 d161 1 d166 3 a168 5 struct rawcb *rp = sotorawcb(so); int s, error = 0; KASSERT(req != PRU_ATTACH); KASSERT(req != PRU_DETACH); d171 1 a171 1 return EOPNOTSUPP; d175 6 a180 3 KASSERT(!control || (req == PRU_SEND || req == PRU_SENDOOB)); if (rp == NULL) { d186 24 d255 2 a256 2 error = (*so->so_proto->pr_usrreqs->pr_generic)(so, PRU_CONNECT, NULL, nam, NULL, l); @ 1.36 log @Apply patch from PR kern/44369 by Wolfgang Stukenbrock. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.35 2008/05/29 17:26:56 dyoung Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.35 2008/05/29 17:26:56 dyoung Exp $"); a52 2 #include @ 1.35 log @Delete local variable 'sockets', whose value is never used. Reported by J.T. Conklin. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.34 2008/04/24 11:38:37 ad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.34 2008/04/24 11:38:37 ad Exp $"); d279 2 a280 1 return (0); @ 1.35.20.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD$ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD$"); d279 1 a279 2 error = 0; break; @ 1.35.14.1 log @Pull up following revision(s) (requested by pooka in ticket #1529): sys/net/raw_usrreq.c: revision 1.36 Apply patch from PR kern/44369 by Wolfgang Stukenbrock. @ text @d1 1 a1 1 /* $NetBSD$ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD$"); d279 1 a279 2 error = 0; break; @ 1.35.22.1 log @Pull up following revision(s) (requested by pooka in ticket #1529): sys/net/raw_usrreq.c: revision 1.36 Apply patch from PR kern/44369 by Wolfgang Stukenbrock. @ text @d1 1 a1 1 /* $NetBSD$ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD$"); d279 1 a279 2 error = 0; break; @ 1.35.8.1 log @Pull up following revision(s) (requested by pooka in ticket #1529): sys/net/raw_usrreq.c: revision 1.36 Apply patch from PR kern/44369 by Wolfgang Stukenbrock. @ text @d1 1 a1 1 /* $NetBSD$ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD$"); d279 1 a279 2 error = 0; break; @ 1.34 log @Merge the socket locking patch: - Socket layer becomes MP safe. - Unix protocols become MP safe. - Allows protocol processing interrupts to safely block on locks. - Fixes a number of race conditions. With much feedback from matt@@ and plunky@@. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.33 2007/05/06 06:21:26 dyoung Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.33 2007/05/06 06:21:26 dyoung Exp $"); a83 1 int sockets = 0; a124 1 sockets++; a132 1 sockets++; @ 1.34.2.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.34 2008/04/24 11:38:37 ad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.34 2008/04/24 11:38:37 ad Exp $"); d84 1 d126 1 d135 1 @ 1.34.4.1 log @Sync w/ -current. 34 merge conflicts to follow. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.34 2008/04/24 11:38:37 ad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.34 2008/04/24 11:38:37 ad Exp $"); d84 1 d126 1 d135 1 @ 1.33 log @Cosmetic: make the macro 'equal' into an inline subroutine, bcmp -> memcmp, bcopy -> memcpy, 0 -> NULL, shorten staircases, remove needless cast to int. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.32 2007/03/04 06:03:18 christos Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.32 2007/03/04 06:03:18 christos Exp $"); d54 1 d90 2 d179 1 d198 1 d318 1 @ 1.33.28.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD$ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD$"); a53 1 d83 1 a88 2 KASSERT(mutex_owned(softnet_lock)); d123 1 d132 1 a175 1 KERNEL_LOCK(1, NULL); a193 1 sosetlock(so); a312 1 KERNEL_UNLOCK_ONE(NULL); @ 1.33.30.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.33 2007/05/06 06:21:26 dyoung Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.33 2007/05/06 06:21:26 dyoung Exp $"); a53 1 a88 2 KASSERT(mutex_owned(softnet_lock)); a175 1 KERNEL_LOCK(1, NULL); a193 1 sosetlock(so); a312 1 KERNEL_UNLOCK_ONE(NULL); @ 1.33.30.2 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.33.30.1 2008/05/18 12:35:28 yamt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.33.30.1 2008/05/18 12:35:28 yamt Exp $"); d84 1 d126 1 d135 1 @ 1.32 log @Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.31 2007/02/17 22:34:10 dyoung Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.31 2007/02/17 22:34:10 dyoung Exp $"); d64 5 d95 1 a95 1 last = 0; a109 2 #define equal(a1, a2) \ (bcmp((void *)(a1), (void *)(a2), a1->sa_len) == 0) d114 1 a114 1 if (last) { d116 8 a123 9 if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { if (sbappendaddr(&last->so_rcv, src, n, (struct mbuf *)0) == 0) /* should notify about lost packet */ m_freem(n); else { sorwakeup(last); sockets++; } d128 1 a128 9 if (last) { if (sbappendaddr(&last->so_rcv, src, m, (struct mbuf *)0) == 0) m_freem(m); else { sorwakeup(last); sockets++; } } else d130 4 d152 1 a152 1 bcopy(rp->rcb_laddr, mtod(nam, void *), (size_t)nam->m_len); d160 1 a160 1 bcopy(rp->rcb_faddr, mtod(nam, void *), (size_t)nam->m_len); d181 1 a181 1 if (rp == 0 && req != PRU_ATTACH) { d256 1 a256 1 (struct mbuf *)0, nam, (struct mbuf *)0, l); d293 1 a293 1 if (rp->rcb_laddr == 0) { d301 1 a301 1 if (rp->rcb_faddr == 0) { @ 1.32.4.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.33 2007/05/06 06:21:26 dyoung Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.33 2007/05/06 06:21:26 dyoung Exp $"); a63 5 static inline int equal(const struct sockaddr *a1, const struct sockaddr *a2) { return memcmp(a1, a2, a1->sa_len) == 0; } d90 1 a90 1 last = NULL; d105 2 d111 1 a111 1 if (last != NULL) { d113 9 a121 8 if ((n = m_copy(m, 0, M_COPYALL)) == NULL) ; else if (sbappendaddr(&last->so_rcv, src, n, NULL) == 0) /* should notify about lost packet */ m_freem(n); else { sorwakeup(last); sockets++; d126 9 a134 1 if (last == NULL || sbappendaddr(&last->so_rcv, src, m, NULL) == 0) a135 4 else { sorwakeup(last); sockets++; } d154 1 a154 1 memcpy(mtod(nam, void *), rp->rcb_laddr, (size_t)nam->m_len); d162 1 a162 1 memcpy(mtod(nam, void *), rp->rcb_faddr, (size_t)nam->m_len); d183 1 a183 1 if (rp == NULL && req != PRU_ATTACH) { d258 1 a258 1 NULL, nam, NULL, l); d295 1 a295 1 if (rp->rcb_laddr == NULL) { d303 1 a303 1 if (rp->rcb_faddr == NULL) { @ 1.32.2.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.32 2007/03/04 06:03:18 christos Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.32 2007/03/04 06:03:18 christos Exp $"); a63 5 static inline int equal(const struct sockaddr *a1, const struct sockaddr *a2) { return memcmp(a1, a2, a1->sa_len) == 0; } d90 1 a90 1 last = NULL; d105 2 d111 1 a111 1 if (last != NULL) { d113 9 a121 8 if ((n = m_copy(m, 0, M_COPYALL)) == NULL) ; else if (sbappendaddr(&last->so_rcv, src, n, NULL) == 0) /* should notify about lost packet */ m_freem(n); else { sorwakeup(last); sockets++; d126 9 a134 1 if (last == NULL || sbappendaddr(&last->so_rcv, src, m, NULL) == 0) a135 4 else { sorwakeup(last); sockets++; } d154 1 a154 1 memcpy(mtod(nam, void *), rp->rcb_laddr, (size_t)nam->m_len); d162 1 a162 1 memcpy(mtod(nam, void *), rp->rcb_faddr, (size_t)nam->m_len); d183 1 a183 1 if (rp == NULL && req != PRU_ATTACH) { d258 1 a258 1 NULL, nam, NULL, l); d295 1 a295 1 if (rp->rcb_laddr == NULL) { d303 1 a303 1 if (rp->rcb_faddr == NULL) { @ 1.31 log @KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous parentheses in return statements. Cosmetic: don't open-code TAILQ_FOREACH(). Cosmetic: change types of variables to avoid oodles of casts: in in6_src.c, avoid casts by changing several route_in6 pointers to struct route pointers. Remove unnecessary casts to caddr_t elsewhere. Pave the way for eliminating address family-specific route caches: soon, struct route will not embed a sockaddr, but it will hold a reference to an external sockaddr, instead. We will set the destination sockaddr using rtcache_setdst(). (I created a stub for it, but it isn't used anywhere, yet.) rtcache_free() will free the sockaddr. I have extracted from rtcache_free() a helper subroutine, rtcache_clear(). rtcache_clear() will "forget" a cached route, but it will not forget the destination by releasing the sockaddr. I use rtcache_clear() instead of rtcache_free() in rtcache_update(), because rtcache_update() is not supposed to forget the destination. Constify: 1 Introduce const accessor for route->ro_dst, rtcache_getdst(). 2 Constify the 'dst' argument to ifnet->if_output(). This led me to constify a lot of code called by output routines. 3 Constify the sockaddr argument to protosw->pr_ctlinput. This led me to constify a lot of code called by ctlinput routines. 4 Introduce const macros for converting from a generic sockaddr to family-specific sockaddrs, e.g., sockaddr_in: satocsin6, satocsin, et cetera. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.30 2006/11/16 01:33:40 christos Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.30 2006/11/16 01:33:40 christos Exp $"); d106 1 a106 1 (bcmp((caddr_t)(a1), (caddr_t)(a2), a1->sa_len) == 0) d154 1 a154 1 bcopy(rp->rcb_laddr, mtod(nam, caddr_t), (size_t)nam->m_len); d162 1 a162 1 bcopy(rp->rcb_faddr, mtod(nam, caddr_t), (size_t)nam->m_len); @ 1.30 log @__unused removal on arguments; approved by core. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.29 2006/10/25 22:49:23 elad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.29 2006/10/25 22:49:23 elad Exp $"); d140 1 a140 1 raw_ctlinput(int cmd, struct sockaddr *arg, void *d) @ 1.30.4.1 log @- sync with head. - move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.30 2006/11/16 01:33:40 christos Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.30 2006/11/16 01:33:40 christos Exp $"); d140 1 a140 1 raw_ctlinput(int cmd, const struct sockaddr *arg, void *d) @ 1.30.4.2 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.30.4.1 2007/02/27 16:54:46 yamt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.30.4.1 2007/02/27 16:54:46 yamt Exp $"); d106 1 a106 1 (bcmp((void *)(a1), (void *)(a2), a1->sa_len) == 0) d154 1 a154 1 bcopy(rp->rcb_laddr, mtod(nam, void *), (size_t)nam->m_len); d162 1 a162 1 bcopy(rp->rcb_faddr, mtod(nam, void *), (size_t)nam->m_len); @ 1.30.4.3 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.30.4.2 2007/03/12 05:59:15 rmind Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.30.4.2 2007/03/12 05:59:15 rmind Exp $"); a63 5 static inline int equal(const struct sockaddr *a1, const struct sockaddr *a2) { return memcmp(a1, a2, a1->sa_len) == 0; } d90 1 a90 1 last = NULL; d105 2 d111 1 a111 1 if (last != NULL) { d113 9 a121 8 if ((n = m_copy(m, 0, M_COPYALL)) == NULL) ; else if (sbappendaddr(&last->so_rcv, src, n, NULL) == 0) /* should notify about lost packet */ m_freem(n); else { sorwakeup(last); sockets++; d126 9 a134 1 if (last == NULL || sbappendaddr(&last->so_rcv, src, m, NULL) == 0) a135 4 else { sorwakeup(last); sockets++; } d154 1 a154 1 memcpy(mtod(nam, void *), rp->rcb_laddr, (size_t)nam->m_len); d162 1 a162 1 memcpy(mtod(nam, void *), rp->rcb_faddr, (size_t)nam->m_len); d183 1 a183 1 if (rp == NULL && req != PRU_ATTACH) { d258 1 a258 1 NULL, nam, NULL, l); d295 1 a295 1 if (rp->rcb_laddr == NULL) { d303 1 a303 1 if (rp->rcb_faddr == NULL) { @ 1.29 log @Introduce KAUTH_REQ_NETWORK_SOCKET_OPEN, to check if opening a socket is allowed. It takes three int * arguments indicating domain, type, and protocol. Replace previous KAUTH_REQ_NETWORK_SOCKET_RAWSOCK with it (but keep it still). Places that used to explicitly check for privileged context now don't need it anymore, so I replaced these with XXX comment indiacting it for future reference. Documented and updated examples as well. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.28 2006/10/12 01:32:30 christos Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.28 2006/10/12 01:32:30 christos Exp $"); d140 1 a140 1 raw_ctlinput(int cmd, struct sockaddr *arg __unused, void *d __unused) @ 1.28 log @- sprinkle __unused on function decls. - fix a couple of unused bugs - no more -Wno-unused for i386 @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.27 2006/07/23 22:06:13 ad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.27 2006/07/23 22:06:13 ad Exp $"); d196 1 a196 3 if (l == 0 || (error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag))) { error = EACCES; d198 3 a200 1 } @ 1.27 log @Use the LWP cached credentials where sane. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.26 2006/05/14 21:19:33 elad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.26 2006/05/14 21:19:33 elad Exp $"); d140 1 a140 1 raw_ctlinput(int cmd, struct sockaddr *arg, void *d) @ 1.27.4.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.30 2006/11/16 01:33:40 christos Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.30 2006/11/16 01:33:40 christos Exp $"); d196 3 a198 1 if (l == NULL) d200 1 a200 3 /* XXX: raw socket permissions are checked in socreate() */ @ 1.27.6.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.27 2006/07/23 22:06:13 ad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.27 2006/07/23 22:06:13 ad Exp $"); d140 1 a140 1 raw_ctlinput(int cmd, struct sockaddr *arg __unused, void *d __unused) @ 1.27.6.2 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.27.6.1 2006/10/22 06:07:25 yamt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.27.6.1 2006/10/22 06:07:25 yamt Exp $"); d140 1 a140 1 raw_ctlinput(int cmd, struct sockaddr *arg, void *d) d196 3 a198 1 if (l == NULL) d200 1 a200 3 /* XXX: raw socket permissions are checked in socreate() */ @ 1.26 log @integrate kauth. @ text @d1 1 a1 1 /* $NetBSD$ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD$"); a170 1 struct proc *p; a176 1 p = l ? l->l_proc : NULL; d196 2 a197 1 if (p == 0 || (error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag))) { @ 1.25 log @ANSI function decls and application of static. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.24 2005/12/11 12:24:52 christos Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.24 2005/12/11 12:24:52 christos Exp $"); d46 1 d198 1 a198 1 if (p == 0 || (error = suser(p->p_ucred, &p->p_acflag))) { @ 1.25.4.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.27 2006/07/23 22:06:13 ad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.27 2006/07/23 22:06:13 ad Exp $"); a45 1 #include d170 1 d177 1 d197 1 a197 2 if (l == 0 || (error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag))) { @ 1.25.6.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.25 2005/12/11 23:05:25 thorpej Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.25 2005/12/11 23:05:25 thorpej Exp $"); a45 1 #include d197 1 a197 1 if (p == 0 || (error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag))) { @ 1.25.12.1 log @Merge 2006-05-24 NetBSD-current into the "peter-altq" branch. @ text @d1 1 a1 1 /* $NetBSD$ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD$"); a45 1 #include d197 1 a197 1 if (p == 0 || (error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag))) { @ 1.25.8.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.25 2005/12/11 23:05:25 thorpej Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.25 2005/12/11 23:05:25 thorpej Exp $"); a45 1 #include d197 1 a197 1 if (p == 0 || (error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag))) { @ 1.25.8.2 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.25.8.1 2006/05/24 10:58:56 yamt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.25.8.1 2006/05/24 10:58:56 yamt Exp $"); d171 1 d178 1 d198 1 a198 2 if (l == 0 || (error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag))) { @ 1.25.10.1 log @Adapt to kernel authorization KPI. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.25 2005/12/11 23:05:25 thorpej Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.25 2005/12/11 23:05:25 thorpej Exp $"); d197 1 a197 1 if (p == 0 || (error = generic_authorize(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag))) { @ 1.25.10.2 log @generic_authorize() -> kauth_authorize_generic(). @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.25.10.1 2006/03/08 01:11:55 elad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.25.10.1 2006/03/08 01:11:55 elad Exp $"); d197 1 a197 1 if (p == 0 || (error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag))) { @ 1.25.10.3 log @- Move kauth_cred_t declaration to - Cleanup struct ucred; forward declarations that are unused. - Don't include in any header, but include it in the c files that need it. Approved by core. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.25.10.2 2006/03/10 15:05:23 elad Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.25.10.2 2006/03/10 15:05:23 elad Exp $"); a45 1 #include @ 1.24 log @merge ktrace-lwp. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.19.2.5 2005/03/04 16:53:00 skrll Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.19.2.5 2005/03/04 16:53:00 skrll Exp $"); d57 1 a57 1 raw_init() d139 1 a139 4 raw_ctlinput(cmd, arg, d) int cmd; struct sockaddr *arg; void *d; d149 1 a149 3 raw_setsockaddr(rp, nam) struct rawcb *rp; struct mbuf *nam; d157 1 a157 3 raw_setpeeraddr(rp, nam) struct rawcb *rp; struct mbuf *nam; d166 2 a167 5 raw_usrreq(so, req, m, nam, control, l) struct socket *so; int req; struct mbuf *m, *nam, *control; struct lwp *l; @ 1.23 log @nuke trailing whitespace @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.22 2004/04/26 01:41:15 matt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.22 2004/04/26 01:41:15 matt Exp $"); d173 1 a173 1 raw_usrreq(so, req, m, nam, control, p) d177 1 a177 1 struct proc *p; d180 1 d187 1 d268 1 a268 1 (struct mbuf *)0, nam, (struct mbuf *)0, p); @ 1.23.4.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.23 2005/02/26 22:45:09 perry Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.23 2005/02/26 22:45:09 perry Exp $"); a45 1 #include d57 1 a57 1 raw_init(void) d139 4 a142 1 raw_ctlinput(int cmd, struct sockaddr *arg, void *d) d152 3 a154 1 raw_setsockaddr(struct rawcb *rp, struct mbuf *nam) d162 3 a164 1 raw_setpeeraddr(struct rawcb *rp, struct mbuf *nam) d173 5 a177 2 raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) a179 1 struct proc *p; a185 1 p = l ? l->l_proc : NULL; d205 1 a205 1 if (p == 0 || (error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag))) { d266 1 a266 1 (struct mbuf *)0, nam, (struct mbuf *)0, l); @ 1.23.4.2 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.23.4.1 2006/06/21 15:10:27 yamt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.23.4.1 2006/06/21 15:10:27 yamt Exp $"); d171 1 d178 1 d198 2 a199 1 if (l == NULL) d201 1 a201 3 /* XXX: raw socket permissions are checked in socreate() */ @ 1.23.4.3 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.23.4.2 2006/12/30 20:50:20 yamt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.23.4.2 2006/12/30 20:50:20 yamt Exp $"); d140 1 a140 1 raw_ctlinput(int cmd, const struct sockaddr *arg, void *d) @ 1.23.4.4 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.23.4.3 2007/02/26 09:11:37 yamt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.23.4.3 2007/02/26 09:11:37 yamt Exp $"); a63 5 static inline int equal(const struct sockaddr *a1, const struct sockaddr *a2) { return memcmp(a1, a2, a1->sa_len) == 0; } d90 1 a90 1 last = NULL; d105 2 d111 1 a111 1 if (last != NULL) { d113 9 a121 8 if ((n = m_copy(m, 0, M_COPYALL)) == NULL) ; else if (sbappendaddr(&last->so_rcv, src, n, NULL) == 0) /* should notify about lost packet */ m_freem(n); else { sorwakeup(last); sockets++; d126 9 a134 1 if (last == NULL || sbappendaddr(&last->so_rcv, src, m, NULL) == 0) a135 4 else { sorwakeup(last); sockets++; } d154 1 a154 1 memcpy(mtod(nam, void *), rp->rcb_laddr, (size_t)nam->m_len); d162 1 a162 1 memcpy(mtod(nam, void *), rp->rcb_faddr, (size_t)nam->m_len); d183 1 a183 1 if (rp == NULL && req != PRU_ATTACH) { d258 1 a258 1 NULL, nam, NULL, l); d295 1 a295 1 if (rp->rcb_laddr == NULL) { d303 1 a303 1 if (rp->rcb_faddr == NULL) { @ 1.22 log @Remove #else of #if __STDC__ @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.21 2003/09/30 00:01:18 christos Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.21 2003/09/30 00:01:18 christos Exp $"); d82 1 a82 1 d224 1 a224 1 * nothing else around it should go to). @ 1.22.4.1 log @sync with -current @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.23 2005/02/26 22:45:09 perry Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.23 2005/02/26 22:45:09 perry Exp $"); d82 1 a82 1 d224 1 a224 1 * nothing else around it should go to). @ 1.22.6.1 log @sync with head. xen and whitespace. xen part is not finished. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.22 2004/04/26 01:41:15 matt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.22 2004/04/26 01:41:15 matt Exp $"); d82 1 a82 1 d224 1 a224 1 * nothing else around it should go to). @ 1.21 log @Fix off-by-one in PRC_NCMDS check. From FreeBSD via OpenBSD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.20 2003/08/07 16:32:57 agc Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.20 2003/08/07 16:32:57 agc Exp $"); a72 1 #if __STDC__ a73 5 #else raw_input(m0, va_alist) struct mbuf *m0; va_dcl #endif @ 1.20 log @Move UCB-licensed code from 4-clause to 3-clause licence. Patches provided by Joel Baker in PR 22364, verified by myself. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.19 2003/06/29 22:31:52 fvdl Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.19 2003/06/29 22:31:52 fvdl Exp $"); d151 1 a151 1 if (cmd < 0 || cmd > PRC_NCMDS) @ 1.19 log @Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.17 2001/11/12 23:49:48 lukem Exp $ */ d15 1 a15 5 * 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 d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.17 2001/11/12 23:49:48 lukem Exp $"); @ 1.19.2.1 log @Apply the aborted ktrace-lwp changes to a specific branch. This is just for others to review, I'm concerned that patch fuziness may have resulted in some errant code being generated but I'll look at that later by comparing the diff from the base to the branch with the file I attempt to apply to it. This will, at the very least, put the changes in a better context for others to review them and attempt to tinker with removing passing of 'struct lwp' through the kernel. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.19 2003/06/29 22:31:52 fvdl Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.19 2003/06/29 22:31:52 fvdl Exp $"); d183 1 a183 1 raw_usrreq(so, req, m, nam, control, l) d187 1 a187 1 struct lwp *l; a189 1 struct proc *p; a195 1 p = l ? l->l_proc : NULL; d276 1 a276 1 (struct mbuf *)0, nam, (struct mbuf *)0, l); @ 1.19.2.2 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.19.2.1 2003/07/02 15:26:57 darrenr Exp $ */ d15 5 a19 1 * 3. Neither the name of the University nor the names of its contributors d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.19.2.1 2003/07/02 15:26:57 darrenr Exp $"); d77 1 d79 5 d155 1 a155 1 if ((unsigned)cmd >= PRC_NCMDS) @ 1.19.2.3 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.22 2004/04/26 01:41:15 matt Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.22 2004/04/26 01:41:15 matt Exp $"); d173 1 a173 1 raw_usrreq(so, req, m, nam, control, p) d177 1 a177 1 struct proc *p; d180 1 d187 1 d268 1 a268 1 (struct mbuf *)0, nam, (struct mbuf *)0, p); @ 1.19.2.4 log @Fix the sync with head I botched. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.19.2.2 2004/08/03 10:54:19 skrll Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.19.2.2 2004/08/03 10:54:19 skrll Exp $"); d173 1 a173 1 raw_usrreq(so, req, m, nam, control, l) d177 1 a177 1 struct lwp *l; a179 1 struct proc *p; a185 1 p = l ? l->l_proc : NULL; d266 1 a266 1 (struct mbuf *)0, nam, (struct mbuf *)0, l); @ 1.19.2.5 log @Sync with HEAD. Hi Perry! @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.19.2.4 2004/09/21 13:36:42 skrll Exp $ */ d35 1 a35 1 __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.19.2.4 2004/09/21 13:36:42 skrll Exp $"); d82 1 a82 1 d226 1 a226 1 * nothing else around it should go to). @ 1.18 log @Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed. Bump the kernel rev up to 1.6V @ text @d183 1 a183 1 raw_usrreq(so, req, m, nam, control, l) d187 1 a187 1 struct lwp *l; a189 1 struct proc *p; a195 1 p = l ? l->l_proc : NULL; d276 1 a276 1 (struct mbuf *)0, nam, (struct mbuf *)0, l); @ 1.17 log @add RCSIDs @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.16 2001/11/05 18:02:16 matt Exp $ */ d39 1 a39 1 __KERNEL_RCSID(0, "$NetBSD$"); d183 1 a183 1 raw_usrreq(so, req, m, nam, control, p) d187 1 a187 1 struct proc *p; d190 1 d197 1 d278 1 a278 1 (struct mbuf *)0, nam, (struct mbuf *)0, p); @ 1.16 log @Switch to using queue access macros instead of refering to the member fields explicitly. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.15 2000/03/30 09:45:40 augustss Exp $ */ d37 3 @ 1.15 log @Kill some more register declarations. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.14 1996/05/28 23:24:23 pk Exp $ */ d97 1 a97 1 for (rp = rawcb.lh_first; rp != 0; rp = rp->rcb_list.le_next) { @ 1.15.8.1 log @Sync kqueue branch with -current. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.17 2001/11/12 23:49:48 lukem Exp $ */ a37 3 #include __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.17 2001/11/12 23:49:48 lukem Exp $"); d97 1 a97 1 LIST_FOREACH(rp, &rawcb, rcb_list) { @ 1.15.6.1 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.15 2000/03/30 09:45:40 augustss Exp $ */ a37 3 #include __KERNEL_RCSID(0, "$NetBSD$"); d97 1 a97 1 LIST_FOREACH(rp, &rawcb, rcb_list) { @ 1.15.12.1 log @Sync the thorpej-mips-cache branch with -current. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.16 2001/11/05 18:02:16 matt Exp $ */ d97 1 a97 1 LIST_FOREACH(rp, &rawcb, rcb_list) { @ 1.14 log @Remove unused variable. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.13 1996/05/23 18:26:26 mycroft Exp $ */ d82 3 a84 3 register struct rawcb *rp; register struct mbuf *m = m0; register int sockets = 0; d87 1 a87 1 register struct sockproto *proto; d160 1 a160 1 register struct rawcb *rp; d170 1 a170 1 register struct rawcb *rp; d186 1 a186 1 register struct rawcb *rp; d188 1 a188 1 register int error = 0; @ 1.14.28.1 log @Update thorpej_scsipi to -current as of a month ago @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.15 2000/03/30 09:45:40 augustss Exp $ */ d82 3 a84 3 struct rawcb *rp; struct mbuf *m = m0; int sockets = 0; d87 1 a87 1 struct sockproto *proto; d160 1 a160 1 struct rawcb *rp; d170 1 a170 1 struct rawcb *rp; d186 1 a186 1 struct rawcb *rp; d188 1 a188 1 int error = 0; @ 1.13 log @Fix race condition in PRU_DISCONNECT. Unimplement PRU_ABORT, as it's not needed and wasn't correct. Some stylistic cleanup. Make sure the control mbufs are freed in all cases. We must indirect through the higher-level protocol for PRU_{BIND,CONNECT} so that it can check the sockaddr. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.12 1996/05/22 13:55:15 mycroft Exp mycroft $ */ a188 1 int len; @ 1.12 log @Pass a proc pointer down to the usrreq and pcbbind functions for PRU_ATTACH, PRU_BIND and PRU_CONTROL. The usrreq interface really needs to be split up, but this will have to wait. Remove SS_PRIV completely. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.11 1996/02/13 22:00:43 christos Exp $ */ d158 20 d186 2 a187 1 register struct rawcb *rp = sotorawcb(so); d193 8 a200 5 if (control && control->m_len) { error = EOPNOTSUPP; goto release; } if (rp == 0) { d204 1 a224 4 if (rp == 0) { error = ENOTCONN; break; } a227 1 #ifdef notdef d234 2 a236 18 if (rp->rcb_faddr) { error = EISCONN; break; } nam = m_copym(nam, 0, M_COPYALL, M_WAIT); rp->rcb_faddr = mtod(nam, struct sockaddr *); soisconnected(so); break; case PRU_BIND: if (rp->rcb_laddr) { error = EINVAL; /* XXX */ break; } error = raw_bind(so, nam); break; #endif d239 1 a239 1 goto release; d242 1 a242 4 if (rp->rcb_faddr == 0) { error = ENOTCONN; break; } a243 1 soisdisconnected(so); d253 4 d262 6 d269 1 a269 1 if (rp->rcb_faddr) { d271 7 d280 5 a284 4 rp->rcb_faddr = mtod(nam, struct sockaddr *); } else if (rp->rcb_faddr == 0) { error = ENOTCONN; break; a286 1 m = NULL; d288 1 a288 7 rp->rcb_faddr = 0; break; case PRU_ABORT: raw_disconnect(rp); sofree(so); soisdisconnected(so); d301 2 a302 2 case PRU_RCVD: return(EOPNOTSUPP); a303 2 case PRU_LISTEN: case PRU_ACCEPT: d305 2 d315 1 a315 3 len = rp->rcb_laddr->sa_len; bcopy((caddr_t)rp->rcb_laddr, mtod(nam, caddr_t), (unsigned)len); nam->m_len = len; d323 1 a323 3 len = rp->rcb_faddr->sa_len; bcopy((caddr_t)rp->rcb_faddr, mtod(nam, caddr_t), (unsigned)len); nam->m_len = len; d329 1 d331 1 a331 2 if (m != NULL) m_freem(m); @ 1.11 log @Net prototypes @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.10 1995/06/12 00:46:55 mycroft Exp $ */ d46 1 d160 1 a160 1 raw_usrreq(so, req, m, nam, control) d164 1 d188 1 a188 1 if ((so->so_state & SS_PRIV) == 0) { @ 1.11.4.1 log @From trunk: Eliminate SS_PRIV; instead, pass down a proc pointer to the usrreq methods that need it. Fix numerous memory leaks and bogus return values. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.14 1996/05/28 23:24:23 pk Exp $ */ a45 1 #include a156 20 void raw_setsockaddr(rp, nam) register struct rawcb *rp; struct mbuf *nam; { nam->m_len = rp->rcb_laddr->sa_len; bcopy(rp->rcb_laddr, mtod(nam, caddr_t), (size_t)nam->m_len); } void raw_setpeeraddr(rp, nam) register struct rawcb *rp; struct mbuf *nam; { nam->m_len = rp->rcb_faddr->sa_len; bcopy(rp->rcb_faddr, mtod(nam, caddr_t), (size_t)nam->m_len); } d159 1 a159 1 raw_usrreq(so, req, m, nam, control, p) a162 1 struct proc *p; d164 1 a164 2 register struct rawcb *rp; int s; d166 1 d170 5 a174 8 s = splsoftnet(); rp = sotorawcb(so); #ifdef DIAGNOSTIC if (req != PRU_SEND && req != PRU_SENDOOB && control) panic("raw_usrreq: unexpected control mbuf"); #endif if (rp == 0 && req != PRU_ATTACH) { a177 1 d186 1 a186 1 if (p == 0 || (error = suser(p->p_ucred, &p->p_acflag))) { d198 4 d205 1 d212 10 d223 8 a230 2 case PRU_LISTEN: case PRU_CONNECT: d233 1 a233 1 break; d236 5 a241 1 raw_disconnect(rp); a250 4 case PRU_RCVD: error = EOPNOTSUPP; break; a255 6 if (control && control->m_len) { m_freem(control); m_freem(m); error = EINVAL; break; } d257 1 a257 1 if ((so->so_state & SS_ISCONNECTED) != 0) { a258 7 goto die; } error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT, (struct mbuf *)0, nam, (struct mbuf *)0, p); if (error) { die: m_freem(m); d261 4 a264 5 } else { if ((so->so_state & SS_ISCONNECTED) == 0) { error = ENOTCONN; goto die; } d267 1 d269 7 a275 1 raw_disconnect(rp); d288 2 a289 2 error = EOPNOTSUPP; break; d291 2 a293 2 m_freem(control); m_freem(m); d302 3 a304 1 raw_setsockaddr(rp, nam); d312 3 a314 1 raw_setpeeraddr(rp, nam); a319 1 d321 2 a322 1 splx(s); @ 1.10 log @Various cleanup, including: * Convert several data structures to use queue.h. * Split in_pcbnotify() into two parts; one for notifying a specific PCB, and one for notifying all PCBs for a particular foreign address. @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.9 1995/04/22 13:08:30 cgd Exp $ */ d45 1 d52 1 d73 4 a76 1 raw_input(m0, proto, src, dst) d78 2 a79 2 register struct sockproto *proto; struct sockaddr *src, *dst; d85 9 d118 1 a118 1 if (n = m_copy(m, 0, (int)M_COPYALL)) { d144 2 a145 2 void raw_ctlinput(cmd, arg) d148 1 d152 2 a153 1 return; @ 1.9 log @quiet compiler warning via (ugly) cast @ text @d1 1 a1 1 /* $NetBSD: raw_usrreq.c,v 1.8 1994/06/29 06:36:40 cgd Exp $ */ d58 1 a58 1 rawcb.rcb_next = rawcb.rcb_prev = &rawcb; d82 1 a82 1 for (rp = rawcb.rcb_next; rp != &rawcb; rp = rp->rcb_next) { @ 1.8 log @New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD' @ text @d1 1 a1 1 /* $NetBSD$ */ d174 1 a174 1 error = raw_attach(so, (int)nam); @ 1.7 log @Update to 4.4-Lite networking code, with a few local changes. @ text @d1 2 d35 1 a35 2 * from: @@(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93 * $Id: $ @ 1.6 log @include not @ text @d2 2 a3 2 * Copyright (c) 1980, 1986 Regents of the University of California. * All rights reserved. d33 2 a34 2 * from: @@(#)raw_usrreq.c 7.9 (Berkeley) 6/28/90 * $Id: raw_usrreq.c,v 1.5 1994/01/06 14:00:35 deraadt Exp $ a37 1 #include d41 1 a49 2 #include d53 1 a57 1 rawintrq.ifq_maxlen = IFQ_MAXLEN; d69 1 a125 1 return (sockets); d129 1 d141 1 a307 2 rawintr() {} /* XXX - referenced by locore. will soon go away */ @ 1.5 log @don't need to #include twice. @ text @d34 1 a34 1 * $Id: raw_usrreq.c,v 1.4 1993/12/18 00:41:01 mycroft Exp $ d50 1 a50 1 #include @ 1.4 log @Canonicalize all #includes. @ text @d34 1 a34 1 * $Id: raw_usrreq.c,v 1.3 1993/05/22 11:42:17 cgd Exp $ a41 1 #include @ 1.3 log @add include of select.h if necessary for protos, or delete if extraneous @ text @d34 1 a34 1 * $Id: raw_usrreq.c,v 1.2 1993/05/18 18:20:00 cgd Exp $ d37 8 a44 8 #include "param.h" #include "socket.h" #include "mbuf.h" #include "domain.h" #include "protosw.h" #include "socket.h" #include "socketvar.h" #include "errno.h" d46 4 a49 4 #include "if.h" #include "route.h" #include "netisr.h" #include "raw_cb.h" d51 1 a51 1 #include "machine/mtpr.h" @ 1.3.4.1 log @Nuke references to machine/mtpr.h. @ text @d34 1 a34 1 * $Id: raw_usrreq.c,v 1.3 1993/05/22 11:42:17 cgd Exp $ d50 2 @ 1.3.4.2 log @Canonicalize all #includes. @ text @d34 1 a34 1 * $Id: raw_usrreq.c,v 1.3.4.1 1993/10/16 10:49:31 mycroft Exp $ d37 8 a44 8 #include #include #include #include #include #include #include #include d46 4 a49 4 #include #include #include #include @ 1.2 log @make kernel select interface be one-stop shopping & clean it all up. @ text @d34 1 a34 1 * $Id$ a38 1 #include "select.h" @ 1.1 log @Initial revision @ text @d33 2 a34 1 * @@(#)raw_usrreq.c 7.9 (Berkeley) 6/28/90 d38 2 @ 1.1.1.1 log @initial import of 386bsd-0.1 sources @ text @@ 1.1.1.2 log @Import 4.4BSD-Lite for reference @ text @d2 2 a3 2 * Copyright (c) 1980, 1986, 1993 * The Regents of the University of California. All rights reserved. d33 1 a33 1 * @@(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93 d36 14 a49 12 #include #include #include #include #include #include #include #include #include #include #include a53 1 void d58 1 a69 1 void d126 1 a129 1 void a140 1 int d307 2 @