head 1.72; access; symbols netbsd-10-0-RELEASE:1.71.2.1 netbsd-10-0-RC6:1.71.2.1 netbsd-10-0-RC5:1.71.2.1 netbsd-10-0-RC4:1.71.2.1 netbsd-10-0-RC3:1.71.2.1 netbsd-10-0-RC2:1.71.2.1 thorpej-ifq:1.72.0.4 thorpej-ifq-base:1.72 thorpej-altq-separation:1.72.0.2 thorpej-altq-separation-base:1.72 netbsd-10-0-RC1:1.71.2.1 netbsd-10:1.71.0.2 netbsd-10-base:1.71 bouyer-sunxi-drm:1.70.0.2 bouyer-sunxi-drm-base:1.70 netbsd-9-3-RELEASE:1.65.4.1 thorpej-i2c-spi-conf2:1.67.0.20 thorpej-i2c-spi-conf2-base:1.67 thorpej-futex2:1.67.0.18 thorpej-futex2-base:1.67 thorpej-cfargs2:1.67.0.16 thorpej-cfargs2-base:1.67 cjep_sun2x-base1:1.67 cjep_sun2x:1.67.0.14 cjep_sun2x-base:1.67 cjep_staticlib_x-base1:1.67 netbsd-9-2-RELEASE:1.65 cjep_staticlib_x:1.67.0.12 cjep_staticlib_x-base:1.67 thorpej-i2c-spi-conf:1.67.0.10 thorpej-i2c-spi-conf-base:1.67 thorpej-cfargs:1.67.0.8 thorpej-cfargs-base:1.67 thorpej-futex:1.67.0.6 thorpej-futex-base:1.67 netbsd-9-1-RELEASE:1.65 bouyer-xenpvh-base2:1.67 phil-wifi-20200421:1.67 bouyer-xenpvh-base1:1.67 phil-wifi-20200411:1.67 bouyer-xenpvh:1.67.0.4 bouyer-xenpvh-base:1.67 is-mlppp:1.67.0.2 is-mlppp-base:1.67 phil-wifi-20200406:1.67 netbsd-8-2-RELEASE:1.63 ad-namecache-base3:1.67 netbsd-9-0-RELEASE:1.65 netbsd-9-0-RC2:1.65 ad-namecache-base2:1.66 ad-namecache-base1:1.66 ad-namecache:1.66.0.2 ad-namecache-base:1.66 netbsd-9-0-RC1:1.65 phil-wifi-20191119:1.66 netbsd-9:1.65.0.4 netbsd-9-base:1.65 phil-wifi-20190609:1.65 netbsd-8-1-RELEASE:1.63 netbsd-8-1-RC1:1.63 isaki-audio2:1.65.0.2 isaki-audio2-base:1.65 pgoyette-compat-merge-20190127:1.64.2.1 pgoyette-compat-20190127:1.65 pgoyette-compat-20190118:1.64 pgoyette-compat-1226:1.64 pgoyette-compat-1126:1.64 pgoyette-compat-1020:1.64 pgoyette-compat-0930:1.64 pgoyette-compat-0906:1.64 netbsd-7-2-RELEASE:1.58 pgoyette-compat-0728:1.64 netbsd-8-0-RELEASE:1.63 phil-wifi:1.64.0.4 phil-wifi-base:1.64 pgoyette-compat-0625:1.64 netbsd-8-0-RC2:1.63 pgoyette-compat-0521:1.64 pgoyette-compat-0502:1.64 pgoyette-compat-0422:1.64 netbsd-8-0-RC1:1.63 pgoyette-compat-0415:1.64 pgoyette-compat-0407:1.64 pgoyette-compat-0330:1.64 pgoyette-compat-0322:1.64 pgoyette-compat-0315:1.64 netbsd-7-1-2-RELEASE:1.58 pgoyette-compat:1.64.0.2 pgoyette-compat-base:1.64 netbsd-7-1-1-RELEASE:1.58 tls-maxphys-base-20171202:1.63 matt-nb8-mediatek:1.63.0.12 matt-nb8-mediatek-base:1.63 nick-nhusb-base-20170825:1.63 perseant-stdc-iso10646:1.63.0.10 perseant-stdc-iso10646-base:1.63 netbsd-8:1.63.0.8 netbsd-8-base:1.63 prg-localcount2-base3:1.63 prg-localcount2-base2:1.63 prg-localcount2-base1:1.63 prg-localcount2:1.63.0.6 prg-localcount2-base:1.63 pgoyette-localcount-20170426:1.63 bouyer-socketcan-base1:1.63 jdolecek-ncq:1.63.0.4 jdolecek-ncq-base:1.63 pgoyette-localcount-20170320:1.63 netbsd-7-1:1.58.0.10 netbsd-7-1-RELEASE:1.58 netbsd-7-1-RC2:1.58 nick-nhusb-base-20170204:1.63 netbsd-7-nhusb-base-20170116:1.58 bouyer-socketcan:1.63.0.2 bouyer-socketcan-base:1.63 pgoyette-localcount-20170107:1.63 netbsd-7-1-RC1:1.58 nick-nhusb-base-20161204:1.63 pgoyette-localcount-20161104:1.63 netbsd-7-0-2-RELEASE:1.58 nick-nhusb-base-20161004:1.63 localcount-20160914:1.62 netbsd-7-nhusb:1.58.0.8 netbsd-7-nhusb-base:1.58 pgoyette-localcount-20160806:1.61 pgoyette-localcount-20160726:1.61 pgoyette-localcount:1.61.0.2 pgoyette-localcount-base:1.61 nick-nhusb-base-20160907:1.61 nick-nhusb-base-20160529:1.59 netbsd-7-0-1-RELEASE:1.58 nick-nhusb-base-20160422:1.59 nick-nhusb-base-20160319:1.59 nick-nhusb-base-20151226:1.59 netbsd-7-0:1.58.0.6 netbsd-7-0-RELEASE:1.58 nick-nhusb-base-20150921:1.59 netbsd-7-0-RC3:1.58 netbsd-7-0-RC2:1.58 netbsd-7-0-RC1:1.58 nick-nhusb-base-20150606:1.58 nick-nhusb-base-20150406:1.58 nick-nhusb:1.58.0.4 nick-nhusb-base:1.58 netbsd-5-2-3-RELEASE:1.53 netbsd-5-1-5-RELEASE:1.53 netbsd-6-0-6-RELEASE:1.57 netbsd-6-1-5-RELEASE:1.57 netbsd-7:1.58.0.2 netbsd-7-base:1.58 yamt-pagecache-base9:1.57 yamt-pagecache-tag8:1.57 netbsd-6-1-4-RELEASE:1.57 netbsd-6-0-5-RELEASE:1.57 tls-earlyentropy:1.57.0.32 tls-earlyentropy-base:1.58 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.57 riastradh-drm2-base3:1.57 netbsd-6-1-3-RELEASE:1.57 netbsd-6-0-4-RELEASE:1.57 netbsd-5-2-2-RELEASE:1.53 netbsd-5-1-4-RELEASE:1.53 netbsd-6-1-2-RELEASE:1.57 netbsd-6-0-3-RELEASE:1.57 netbsd-5-2-1-RELEASE:1.53 netbsd-5-1-3-RELEASE:1.53 rmind-smpnet-nbase:1.57 netbsd-6-1-1-RELEASE:1.57 riastradh-drm2-base2:1.57 riastradh-drm2-base1:1.57 riastradh-drm2:1.57.0.30 riastradh-drm2-base:1.57 rmind-smpnet:1.57.0.22 rmind-smpnet-base:1.57 netbsd-6-1:1.57.0.28 netbsd-6-0-2-RELEASE:1.57 netbsd-6-1-RELEASE:1.57 khorben-n900:1.57.0.26 netbsd-6-1-RC4:1.57 netbsd-6-1-RC3:1.57 agc-symver:1.57.0.24 agc-symver-base:1.57 netbsd-6-1-RC2:1.57 netbsd-6-1-RC1:1.57 yamt-pagecache-base8:1.57 netbsd-5-2:1.53.0.22 netbsd-6-0-1-RELEASE:1.57 yamt-pagecache-base7:1.57 netbsd-5-2-RELEASE:1.53 netbsd-5-2-RC1:1.53 matt-nb6-plus-nbase:1.57 yamt-pagecache-base6:1.57 netbsd-6-0:1.57.0.20 netbsd-6-0-RELEASE:1.57 netbsd-6-0-RC2:1.57 tls-maxphys:1.57.0.18 tls-maxphys-base:1.58 matt-nb6-plus:1.57.0.16 matt-nb6-plus-base:1.57 netbsd-6-0-RC1:1.57 jmcneill-usbmp-base10:1.57 yamt-pagecache-base5:1.57 jmcneill-usbmp-base9:1.57 yamt-pagecache-base4:1.57 jmcneill-usbmp-base8:1.57 jmcneill-usbmp-base7:1.57 jmcneill-usbmp-base6:1.57 jmcneill-usbmp-base5:1.57 jmcneill-usbmp-base4:1.57 jmcneill-usbmp-base3:1.57 jmcneill-usbmp-pre-base2:1.57 jmcneill-usbmp-base2:1.57 netbsd-6:1.57.0.14 netbsd-6-base:1.57 netbsd-5-1-2-RELEASE:1.53 netbsd-5-1-1-RELEASE:1.53 jmcneill-usbmp:1.57.0.12 jmcneill-usbmp-base:1.57 jmcneill-audiomp3:1.57.0.10 jmcneill-audiomp3-base:1.57 yamt-pagecache-base3:1.57 yamt-pagecache-base2:1.57 yamt-pagecache:1.57.0.8 yamt-pagecache-base:1.57 rmind-uvmplock-nbase:1.57 cherry-xenmp:1.57.0.6 cherry-xenmp-base:1.57 bouyer-quota2-nbase:1.57 bouyer-quota2:1.57.0.4 bouyer-quota2-base:1.57 jruoho-x86intr:1.57.0.2 jruoho-x86intr-base:1.57 matt-mips64-premerge-20101231:1.57 matt-nb5-mips64-premerge-20101231:1.53 matt-nb5-pq3:1.53.0.20 matt-nb5-pq3-base:1.53 netbsd-5-1:1.53.0.18 netbsd-5-1-RELEASE:1.53 uebayasi-xip-base4:1.57 uebayasi-xip-base3:1.57 yamt-nfs-mp-base11:1.57 netbsd-5-1-RC4:1.53 matt-nb5-mips64-k15:1.53 uebayasi-xip-base2:1.57 yamt-nfs-mp-base10:1.57 netbsd-5-1-RC3:1.53 netbsd-5-1-RC2:1.53 uebayasi-xip-base1:1.57 netbsd-5-1-RC1:1.53 rmind-uvmplock:1.56.0.4 rmind-uvmplock-base:1.57 yamt-nfs-mp-base9:1.56 uebayasi-xip:1.56.0.2 uebayasi-xip-base:1.56 netbsd-5-0-2-RELEASE:1.53 matt-nb5-mips64-premerge-20091211:1.53 matt-premerge-20091211:1.55 yamt-nfs-mp-base8:1.55 matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.53 matt-nb4-mips64-k7-u2a-k9b:1.53 matt-nb5-mips64-u1-k1-k5:1.53 yamt-nfs-mp-base7:1.55 matt-nb5-mips64:1.53.0.16 netbsd-5-0-1-RELEASE:1.53 jymxensuspend-base:1.55 yamt-nfs-mp-base6:1.55 yamt-nfs-mp-base5:1.55 yamt-nfs-mp-base4:1.55 jym-xensuspend-nbase:1.55 yamt-nfs-mp-base3:1.54 nick-hppapmap-base4:1.54 nick-hppapmap-base3:1.54 netbsd-5-0:1.53.0.14 netbsd-5-0-RELEASE:1.53 netbsd-5-0-RC4:1.53 netbsd-5-0-RC3:1.53 nick-hppapmap-base2:1.53 netbsd-5-0-RC2:1.53 jym-xensuspend:1.53.0.12 jym-xensuspend-base:1.55 netbsd-5-0-RC1:1.53 haad-dm-base2:1.53 haad-nbase2:1.53 ad-audiomp2:1.53.0.10 ad-audiomp2-base:1.53 netbsd-5:1.53.0.8 netbsd-5-base:1.53 nick-hppapmap:1.53.0.6 nick-hppapmap-base:1.54 matt-mips64-base2:1.53 matt-mips64:1.47.0.24 haad-dm-base1:1.53 wrstuden-revivesa-base-4:1.53 netbsd-4-0-1-RELEASE:1.45 wrstuden-revivesa-base-3:1.53 wrstuden-revivesa-base-2:1.53 wrstuden-fixsa-newbase:1.45 nick-csl-alignment-base5:1.47 haad-dm:1.53.0.4 haad-dm-base:1.53 wrstuden-revivesa-base-1:1.53 simonb-wapbl-nbase:1.53 yamt-pf42-base4:1.53 simonb-wapbl:1.53.0.2 simonb-wapbl-base:1.53 yamt-pf42-base3:1.53 hpcarm-cleanup-nbase:1.52 yamt-pf42-baseX:1.52 yamt-pf42-base2:1.52 yamt-nfs-mp-base2:1.52 wrstuden-revivesa:1.52.0.12 wrstuden-revivesa-base:1.53 yamt-nfs-mp:1.52.0.10 yamt-nfs-mp-base:1.52 yamt-pf42:1.52.0.8 yamt-pf42-base:1.52 ad-socklock-base1:1.52 yamt-lazymbuf-base15:1.52 yamt-lazymbuf-base14:1.52 keiichi-mipv6-nbase:1.52 mjf-devfs2:1.52.0.6 mjf-devfs2-base:1.53 nick-net80211-sync:1.52.0.4 nick-net80211-sync-base:1.52 keiichi-mipv6:1.52.0.2 keiichi-mipv6-base:1.52 bouyer-xeni386-merge1:1.51 matt-armv6-prevmlocking:1.47.16.1 wrstuden-fixsa-base-1:1.45 vmlocking2-base3:1.51 netbsd-4-0:1.45.0.8 netbsd-4-0-RELEASE:1.45 bouyer-xeni386-nbase:1.51 yamt-kmem-base3:1.51 cube-autoconf:1.51.0.8 cube-autoconf-base:1.51 yamt-kmem-base2:1.51 bouyer-xeni386:1.51.0.6 bouyer-xeni386-base:1.51 yamt-kmem:1.51.0.4 yamt-kmem-base:1.51 vmlocking2-base2:1.51 reinoud-bufcleanup-nbase:1.51 vmlocking2:1.51.0.2 vmlocking2-base1:1.51 netbsd-4-0-RC5:1.45 matt-nb4-arm:1.45.0.6 matt-nb4-arm-base:1.45 matt-armv6-nbase:1.52 jmcneill-base:1.47 netbsd-4-0-RC4:1.45 mjf-devfs:1.47.0.22 mjf-devfs-base:1.51 bouyer-xenamd64-base2:1.50 vmlocking-nbase:1.51 yamt-x86pmap-base4:1.47 bouyer-xenamd64:1.47.0.20 bouyer-xenamd64-base:1.50 netbsd-4-0-RC3:1.45 yamt-x86pmap-base3:1.47 yamt-x86pmap-base2:1.47 netbsd-4-0-RC2:1.45 yamt-x86pmap:1.47.0.18 yamt-x86pmap-base:1.47 netbsd-4-0-RC1:1.45 matt-armv6:1.47.0.16 matt-armv6-base:1.51 matt-mips64-base:1.47 jmcneill-pm:1.47.0.14 jmcneill-pm-base:1.51 hpcarm-cleanup:1.47.0.12 hpcarm-cleanup-base:1.52 nick-csl-alignment:1.47.0.10 nick-csl-alignment-base:1.47 netbsd-3-1-1-RELEASE:1.35 netbsd-3-0-3-RELEASE:1.35 yamt-idlelwp-base8:1.47 wrstuden-fixsa:1.45.0.4 wrstuden-fixsa-base:1.45 thorpej-atomic:1.47.0.8 thorpej-atomic-base:1.47 reinoud-bufcleanup:1.47.0.6 reinoud-bufcleanup-base:1.51 mjf-ufs-trans:1.47.0.4 mjf-ufs-trans-base:1.47 vmlocking:1.47.0.2 vmlocking-base:1.47 ad-audiomp:1.46.0.4 ad-audiomp-base:1.46 yamt-idlelwp:1.46.0.2 post-newlock2-merge:1.46 newlock2-nbase:1.46 yamt-splraiseipl-base5:1.45 yamt-splraiseipl-base4:1.45 yamt-splraiseipl-base3:1.45 abandoned-netbsd-4-base:1.43 abandoned-netbsd-4:1.43.0.2 netbsd-3-1:1.35.0.6 netbsd-3-1-RELEASE:1.35 netbsd-3-0-2-RELEASE:1.35 yamt-splraiseipl-base2:1.44 netbsd-3-1-RC4:1.35 yamt-splraiseipl:1.43.0.6 yamt-splraiseipl-base:1.43 netbsd-3-1-RC3:1.35 yamt-pdpolicy-base9:1.43 newlock2:1.43.0.4 newlock2-base:1.46 yamt-pdpolicy-base8:1.43 netbsd-3-1-RC2:1.35 netbsd-3-1-RC1:1.35 yamt-pdpolicy-base7:1.43 netbsd-4:1.45.0.2 netbsd-4-base:1.45 yamt-pdpolicy-base6:1.42 chap-midi-nbase:1.42 netbsd-3-0-1-RELEASE:1.35 gdamore-uart:1.42.0.4 gdamore-uart-base:1.42 simonb-timcounters-final:1.41.6.1 yamt-pdpolicy-base5:1.42 chap-midi:1.42.0.2 chap-midi-base:1.42 yamt-pdpolicy-base4:1.41 yamt-pdpolicy-base3:1.41 peter-altq-base:1.41 peter-altq:1.41.0.12 yamt-pdpolicy-base2:1.41 elad-kernelauth-base:1.41 elad-kernelauth:1.41.0.10 yamt-pdpolicy:1.41.0.8 yamt-pdpolicy-base:1.41 yamt-uio_vmspace-base5:1.41 simonb-timecounters:1.41.0.6 simonb-timecounters-base:1.42 rpaulo-netinet-merge-pcb:1.41.0.4 rpaulo-netinet-merge-pcb-base:1.43 yamt-uio_vmspace:1.41.0.2 netbsd-3-0:1.35.0.4 netbsd-3-0-RELEASE:1.35 netbsd-3-0-RC6:1.35 yamt-readahead-base3:1.39 netbsd-3-0-RC5:1.35 netbsd-3-0-RC4:1.35 netbsd-3-0-RC3:1.35 yamt-readahead-base2:1.38 netbsd-3-0-RC2:1.35 yamt-readahead-pervnode:1.38 yamt-readahead-perfile:1.38 yamt-readahead:1.38.0.8 yamt-readahead-base:1.38 netbsd-3-0-RC1:1.35 yamt-vop-base3:1.38 netbsd-2-0-3-RELEASE:1.34 netbsd-2-1:1.34.0.14 yamt-vop-base2:1.38 thorpej-vnode-attr:1.38.0.6 thorpej-vnode-attr-base:1.38 netbsd-2-1-RELEASE:1.34 yamt-vop:1.38.0.4 yamt-vop-base:1.38 netbsd-2-1-RC6:1.34 netbsd-2-1-RC5:1.34 netbsd-2-1-RC4:1.34 netbsd-2-1-RC3:1.34 netbsd-2-1-RC2:1.34 netbsd-2-1-RC1:1.34 yamt-lazymbuf:1.38.0.2 yamt-km-base4:1.35 netbsd-2-0-2-RELEASE:1.34 yamt-km-base3:1.35 netbsd-3:1.35.0.2 netbsd-3-base:1.35 yamt-km-base2:1.34 yamt-km:1.34.0.10 yamt-km-base:1.34 kent-audio2:1.34.0.8 kent-audio2-base:1.35 netbsd-2-0-1-RELEASE:1.34 kent-audio1-beforemerge:1.34 netbsd-2:1.34.0.6 netbsd-2-base:1.34 kent-audio1:1.34.0.4 kent-audio1-base:1.34 netbsd-2-0-RELEASE:1.34 netbsd-2-0-RC5:1.34 netbsd-2-0-RC4:1.34 netbsd-2-0-RC3:1.34 netbsd-2-0-RC2:1.34 netbsd-2-0-RC1:1.34 netbsd-2-0:1.34.0.2 netbsd-2-0-base:1.34 netbsd-1-6-PATCH002-RELEASE:1.30 netbsd-1-6-PATCH002:1.30 netbsd-1-6-PATCH002-RC4:1.30 netbsd-1-6-PATCH002-RC3:1.30 netbsd-1-6-PATCH002-RC2:1.30 netbsd-1-6-PATCH002-RC1:1.30 ktrace-lwp:1.33.0.2 ktrace-lwp-base:1.39 netbsd-1-6-PATCH001:1.30 netbsd-1-6-PATCH001-RELEASE:1.30 netbsd-1-6-PATCH001-RC3:1.30 netbsd-1-6-PATCH001-RC2:1.30 netbsd-1-6-PATCH001-RC1:1.30 nathanw_sa_end:1.23.2.9 nathanw_sa_before_merge:1.32 fvdl_fs64_base:1.32 gmcgarry_ctxsw:1.32.0.4 gmcgarry_ctxsw_base:1.32 gmcgarry_ucred:1.32.0.2 gmcgarry_ucred_base:1.32 nathanw_sa_base:1.32 kqueue-aftermerge:1.32 kqueue-beforemerge:1.32 netbsd-1-6-RELEASE:1.30 netbsd-1-6-RC3:1.30 netbsd-1-6-RC2:1.30 netbsd-1-6-RC1:1.30 netbsd-1-6:1.30.0.6 netbsd-1-6-base:1.30 gehenna-devsw:1.30.0.4 gehenna-devsw-base:1.31 netbsd-1-5-PATCH003:1.20 eeh-devprop:1.30.0.2 eeh-devprop-base:1.30 newlock:1.29.0.2 newlock-base:1.29 ifpoll-base:1.28 thorpej-mips-cache:1.26.0.4 thorpej-mips-cache-base:1.26 thorpej-devvp-base3:1.26 thorpej-devvp-base2:1.26 post-chs-ubcperf:1.26 pre-chs-ubcperf:1.26 thorpej-devvp:1.26.0.2 thorpej-devvp-base:1.26 netbsd-1-5-PATCH002:1.20 kqueue:1.25.0.2 kqueue-base:1.32 netbsd-1-5-PATCH001:1.20 thorpej_scsipi_beforemerge:1.24 nathanw_sa:1.23.0.2 thorpej_scsipi_nbase:1.24 netbsd-1-5-RELEASE:1.20 netbsd-1-5-BETA2:1.20 netbsd-1-5-BETA:1.20 netbsd-1-4-PATCH003:1.15 netbsd-1-5-ALPHA2:1.20 netbsd-1-5:1.20.0.4 netbsd-1-5-base:1.20 minoura-xpg4dl-base:1.20 minoura-xpg4dl:1.20.0.2 netbsd-1-4-PATCH002:1.15 chs-ubc2-newbase:1.18 wrstuden-devbsize-19991221:1.18 wrstuden-devbsize:1.18.0.8 wrstuden-devbsize-base:1.18 kame_141_19991130:1.15 comdex-fall-1999:1.18.0.6 comdex-fall-1999-base:1.18 fvdl-softdep:1.18.0.4 fvdl-softdep-base:1.18 thorpej_scsipi:1.18.0.2 thorpej_scsipi_base:1.24 netbsd-1-4-PATCH001:1.15 kame_14_19990705:1.15 kame_14_19990628:1.15 kame:1.15.0.6 chs-ubc2:1.15.0.4 chs-ubc2-base:1.17 netbsd-1-4-RELEASE:1.15 netbsd-1-4:1.15.0.2 netbsd-1-4-base:1.15 netbsd-1-3-PATCH003:1.13 netbsd-1-3-PATCH003-CANDIDATE2:1.13 kenh-if-detach:1.14.0.4 kenh-if-detach-base:1.14 netbsd-1-3-PATCH003-CANDIDATE1:1.13 netbsd-1-3-PATCH003-CANDIDATE0:1.13 chs-ubc:1.14.0.2 chs-ubc-base:1.14 eeh-paddr_t:1.13.0.10 eeh-paddr_t-base:1.13 netbsd-1-3-PATCH002:1.13 netbsd-1-3-PATCH001:1.13 netbsd-1-3-RELEASE:1.13 netbsd-1-3-BETA:1.13 netbsd-1-3:1.13.0.8 netbsd-1-3-base:1.13 thorpej-signal:1.13.0.6 thorpej-signal-base:1.13 marc-pcmcia:1.13.0.4 marc-pcmcia-bp:1.13 marc-pcmcia-base:1.13 bouyer-scsipi:1.13.0.2 is-newarp-before-merge:1.11 netbsd-1-2-PATCH001:1.6 mrg-vm-swap:1.10.0.6 is-newarp:1.10.0.4 is-newarp-base:1.10 thorpej-setroot:1.10.0.2 netbsd-1-2-RELEASE:1.6 netbsd-1-2-BETA:1.6 netbsd-1-2:1.6.0.4 netbsd-1-2-base:1.6 date-03-may-96:1.1.1.1 netbsd:1.1.1 netbsd-1-1-PATCH001:1.3 netbsd-1-1-RELEASE:1.3 netbsd-1-1:1.3.0.2 netbsd-1-1-base:1.3; locks; strict; comment @ * @; 1.72 date 2022.12.21.19.08.22; author chs; state Exp; branches; next 1.71; commitid J2QhyDiWt8Ncts6E; 1.71 date 2022.10.26.23.42.56; author riastradh; state Exp; branches 1.71.2.1; next 1.70; commitid sjlLikKBXHh6NhZD; 1.70 date 2022.05.04.07.48.35; author andvar; state Exp; branches; next 1.69; commitid kHxWQx01suGd8ICD; 1.69 date 2021.12.13.02.53.43; author msaitoh; state Exp; branches; next 1.68; commitid GmCuslvxRV864rkD; 1.68 date 2021.09.27.07.13.30; author msaitoh; state Exp; branches; next 1.67; commitid SIPuChrDt9AIYyaD; 1.67 date 2020.01.29.04.28.27; author thorpej; state Exp; branches; next 1.66; commitid 5uH8WW48hxhUzxUB; 1.66 date 2019.09.20.08.45.29; author maxv; state Exp; branches 1.66.2.1; next 1.65; commitid tp0iPnONVg6cdJDB; 1.65 date 2019.01.24.09.31.09; author knakahara; state Exp; branches 1.65.4.1; next 1.64; commitid tD08WH7EK2bZ819B; 1.64 date 2018.02.07.06.19.43; author mrg; state Exp; branches 1.64.2.1 1.64.4.1; next 1.63; commitid V4A2vWON32vPmTpA; 1.63 date 2016.10.02.14.17.07; author christos; state Exp; branches 1.63.6.1 1.63.8.1; next 1.62; 1.62 date 2016.08.06.02.35.06; author pgoyette; state Exp; branches; next 1.61; 1.61 date 2016.06.20.06.46.37; author knakahara; state Exp; branches 1.61.2.1; next 1.60; 1.60 date 2016.06.10.13.27.16; author ozaki-r; state Exp; branches; next 1.59; 1.59 date 2015.08.24.22.21.26; author pooka; state Exp; branches; next 1.58; 1.58 date 2014.05.22.16.31.19; author dholland; state Exp; branches 1.58.4.1; next 1.57; 1.57 date 2010.04.05.07.22.24; author joerg; state Exp; branches 1.57.18.1 1.57.32.1; next 1.56; 1.56 date 2010.01.19.22.08.01; author pooka; state Exp; branches 1.56.2.1 1.56.4.1; next 1.55; 1.55 date 2009.05.07.18.01.57; author elad; state Exp; branches; next 1.54; 1.54 date 2009.04.15.20.44.25; author elad; state Exp; branches; next 1.53; 1.53 date 2008.05.25.19.22.21; author ad; state Exp; branches 1.53.6.1 1.53.12.1; next 1.52; 1.52 date 2008.02.20.17.05.53; author matt; state Exp; branches 1.52.6.1 1.52.8.1 1.52.10.1 1.52.12.1; next 1.51; 1.51 date 2007.11.28.21.44.11; author ad; state Exp; branches; next 1.50; 1.50 date 2007.11.12.14.20.40; author ad; state Exp; branches; next 1.49; 1.49 date 2007.11.10.18.29.36; author ad; state Exp; branches; next 1.48; 1.48 date 2007.11.07.15.56.22; author ad; state Exp; branches; next 1.47; 1.47 date 2007.03.04.06.03.17; author christos; state Exp; branches 1.47.2.1 1.47.14.1 1.47.16.1 1.47.20.1 1.47.22.1; next 1.46; 1.46 date 2007.01.04.19.07.03; author elad; state Exp; branches 1.46.2.1; next 1.45; 1.45 date 2006.11.16.01.33.40; author christos; state Exp; branches; next 1.44; 1.44 date 2006.10.12.01.32.30; author christos; state Exp; branches; next 1.43; 1.43 date 2006.07.23.22.06.13; author ad; state Exp; branches 1.43.4.1 1.43.6.1; next 1.42; 1.42 date 2006.05.14.21.19.33; author elad; state Exp; branches; next 1.41; 1.41 date 2005.12.11.23.05.25; author thorpej; state Exp; branches 1.41.4.1 1.41.6.1 1.41.8.1 1.41.10.1 1.41.12.1; next 1.40; 1.40 date 2005.12.11.12.24.51; author christos; state Exp; branches; next 1.39; 1.39 date 2005.11.27.05.35.52; author thorpej; state Exp; branches; next 1.38; 1.38 date 2005.06.11.22.26.42; author christos; state Exp; branches 1.38.2.1 1.38.8.1; next 1.37; 1.37 date 2005.05.29.21.22.53; author christos; state Exp; branches; next 1.36; 1.36 date 2005.05.17.04.14.58; author christos; state Exp; branches; next 1.35; 1.35 date 2005.02.26.22.45.09; author perry; state Exp; branches; next 1.34; 1.34 date 2003.09.01.16.51.27; author christos; state Exp; branches 1.34.8.1 1.34.10.1; next 1.33; 1.33 date 2003.02.26.06.31.13; author matt; state Exp; branches 1.33.2.1; next 1.32; 1.32 date 2002.09.06.13.18.43; author gehenna; state Exp; branches; next 1.31; 1.31 date 2002.07.01.22.09.35; author itojun; state Exp; branches; next 1.30; 1.30 date 2002.03.17.19.41.11; author atatat; state Exp; branches 1.30.4.1; next 1.29; 1.29 date 2002.03.05.04.13.01; author itojun; state Exp; branches; next 1.28; 1.28 date 2001.11.13.00.49.36; author lukem; state Exp; branches; next 1.27; 1.27 date 2001.11.12.23.49.47; author lukem; state Exp; branches; next 1.26; 1.26 date 2001.07.18.16.43.10; author thorpej; state Exp; branches 1.26.2.1; next 1.25; 1.25 date 2001.06.14.05.44.25; author itojun; state Exp; branches 1.25.2.1; next 1.24; 1.24 date 2001.03.31.00.35.24; author enami; state Exp; branches; next 1.23; 1.23 date 2001.01.18.20.28.20; author jdolecek; state Exp; branches 1.23.2.1; next 1.22; 1.22 date 2000.12.12.18.00.31; author thorpej; state Exp; branches; next 1.21; 1.21 date 2000.11.02.15.51.18; author itojun; state Exp; branches; next 1.20; 1.20 date 2000.03.30.09.45.37; author augustss; state Exp; branches; next 1.19; 1.19 date 2000.03.23.07.03.26; author thorpej; state Exp; branches; next 1.18; 1.18 date 99.08.25.02.04.06; author christos; state Exp; branches 1.18.2.1; next 1.17; 1.17 date 99.05.24.20.12.10; author tron; state Exp; branches; next 1.16; 1.16 date 99.05.11.02.18.52; author thorpej; state Exp; branches; next 1.15; 1.15 date 98.12.12.18.21.32; author christos; state Exp; branches 1.15.4.1; next 1.14; 1.14 date 98.08.02.15.09.50; author sommerfe; state Exp; branches 1.14.4.1; next 1.13; 1.13 date 97.03.25.22.33.25; author christos; state Exp; branches; next 1.12; 1.12 date 97.03.24.21.23.10; author christos; state Exp; branches; next 1.11; 1.11 date 97.03.12.20.27.01; author christos; state Exp; branches; next 1.10; 1.10 date 96.10.13.02.11.09; author christos; state Exp; branches; next 1.9; 1.9 date 96.10.10.22.59.54; author christos; state Exp; branches; next 1.8; 1.8 date 96.09.07.12.41.27; author mycroft; state Exp; branches; next 1.7; 1.7 date 96.06.14.22.22.02; author cgd; state Exp; branches; next 1.6; 1.6 date 96.05.07.02.40.51; author thorpej; state Exp; branches; next 1.5; 1.5 date 96.03.15.02.28.10; author paulus; state Exp; branches; next 1.4; 1.4 date 96.02.13.22.00.30; author christos; state Exp; branches; next 1.3; 1.3 date 95.10.05.05.55.14; author mycroft; state Exp; branches; next 1.2; 1.2 date 95.07.04.23.26.10; author paulus; state Exp; branches; next 1.1; 1.1 date 95.07.04.06.28.27; author paulus; state Exp; branches; next ; 1.71.2.1 date 2022.12.21.19.58.15; author martin; state Exp; branches; next ; commitid dDXqLZtGV66rKs6E; 1.66.2.1 date 2020.02.29.20.21.06; author ad; state Exp; branches; next ; commitid OjSb8ro7YQETQBYB; 1.65.4.1 date 2022.01.29.17.03.53; author martin; state Exp; branches; next ; commitid rahYaKkbv91jgyqD; 1.64.2.1 date 2019.01.26.22.00.37; author pgoyette; state Exp; branches; next ; commitid JKpcmvSjdT25dl9B; 1.64.4.1 date 2019.06.10.22.09.45; author christos; state Exp; branches; next 1.64.4.2; commitid jtc8rnCzWiEEHGqB; 1.64.4.2 date 2020.04.08.14.08.57; author martin; state Exp; branches; next 1.64.4.3; commitid Qli2aW9E74UFuA3C; 1.64.4.3 date 2020.04.13.08.05.15; author martin; state Exp; branches; next ; commitid X01YhRUPVUDaec4C; 1.63.6.1 date 2017.04.27.05.36.38; author pgoyette; state Exp; branches; next ; 1.63.8.1 date 2022.01.29.17.05.44; author martin; state Exp; branches; next ; commitid w25qACeLWhJWgyqD; 1.61.2.1 date 2016.07.20.23.47.57; author pgoyette; state Exp; branches; next 1.61.2.2; 1.61.2.2 date 2016.11.04.14.49.21; author pgoyette; state Exp; branches; next ; 1.58.4.1 date 2015.09.22.12.06.10; author skrll; state Exp; branches; next 1.58.4.2; 1.58.4.2 date 2016.07.09.20.25.21; author skrll; state Exp; branches; next 1.58.4.3; 1.58.4.3 date 2016.10.05.20.56.08; author skrll; state Exp; branches; next ; 1.57.18.1 date 2014.08.20.00.04.34; author tls; state Exp; branches; next 1.57.18.2; 1.57.18.2 date 2017.12.03.11.39.02; author jdolecek; state Exp; branches; next ; commitid XcIYRZTAh1LmerhA; 1.57.32.1 date 2014.08.10.06.56.16; author tls; state Exp; branches; next ; 1.56.2.1 date 2010.04.30.14.44.20; author uebayasi; state Exp; branches; next ; 1.56.4.1 date 2010.05.30.05.18.01; author rmind; state Exp; branches; next ; 1.53.6.1 date 2009.04.28.07.37.17; author skrll; state Exp; branches; next ; 1.53.12.1 date 2009.05.13.17.22.20; author jym; state Exp; branches; next ; 1.52.6.1 date 2008.06.02.13.24.23; author mjf; state Exp; branches; next ; 1.52.8.1 date 2008.06.04.02.05.48; author yamt; state Exp; branches; next ; 1.52.10.1 date 2009.05.04.08.14.15; author yamt; state Exp; branches; next 1.52.10.2; 1.52.10.2 date 2009.05.16.10.41.49; author yamt; state Exp; branches; next 1.52.10.3; 1.52.10.3 date 2010.03.11.15.04.27; author yamt; state Exp; branches; next 1.52.10.4; 1.52.10.4 date 2010.08.11.22.54.55; author yamt; state Exp; branches; next ; 1.52.12.1 date 2008.06.23.04.31.58; author wrstuden; state Exp; branches; next ; 1.47.2.1 date 2007.04.05.21.57.51; author ad; state Exp; branches; next 1.47.2.2; 1.47.2.2 date 2007.10.23.20.17.18; author ad; state Exp; branches; next ; 1.47.14.1 date 2007.11.11.16.48.25; author joerg; state Exp; branches; next 1.47.14.2; 1.47.14.2 date 2007.11.14.19.04.49; author joerg; state Exp; branches; next 1.47.14.3; 1.47.14.3 date 2007.12.03.16.15.07; author joerg; state Exp; branches; next ; 1.47.16.1 date 2007.11.08.11.00.13; author matt; state Exp; branches; next 1.47.16.2; 1.47.16.2 date 2008.01.09.01.57.15; author matt; state Exp; branches; next 1.47.16.3; 1.47.16.3 date 2008.03.23.02.05.05; author matt; state Exp; branches; next ; 1.47.20.1 date 2007.11.13.16.02.47; author bouyer; state Exp; branches; next ; 1.47.22.1 date 2007.11.19.00.49.06; author mjf; state Exp; branches; next 1.47.22.2; 1.47.22.2 date 2007.12.08.18.21.07; author mjf; state Exp; branches; next ; 1.46.2.1 date 2007.03.12.05.59.15; author rmind; state Exp; branches; next ; 1.43.4.1 date 2006.11.18.21.39.30; author ad; state Exp; branches; next 1.43.4.2; 1.43.4.2 date 2007.01.12.01.04.12; author ad; state Exp; branches; next ; 1.43.6.1 date 2006.10.22.06.07.25; author yamt; state Exp; branches; next 1.43.6.2; 1.43.6.2 date 2006.12.10.07.19.00; author yamt; state Exp; branches; next ; 1.41.4.1 date 2006.09.09.02.58.06; author rpaulo; state Exp; branches; next ; 1.41.6.1 date 2006.06.01.22.38.38; author kardel; state Exp; branches; next ; 1.41.8.1 date 2006.05.24.10.58.56; author yamt; state Exp; branches; next 1.41.8.2; 1.41.8.2 date 2006.08.11.15.46.16; author yamt; state Exp; branches; next ; 1.41.10.1 date 2006.03.08.01.11.55; author elad; state Exp; branches; next 1.41.10.2; 1.41.10.2 date 2006.03.10.15.05.23; author elad; state Exp; branches; next 1.41.10.3; 1.41.10.3 date 2006.05.06.23.31.59; author christos; state Exp; branches; next ; 1.41.12.1 date 2006.05.24.15.50.44; author tron; state Exp; branches; next ; 1.38.2.1 date 2006.06.21.15.10.27; author yamt; state Exp; branches; next 1.38.2.2; 1.38.2.2 date 2006.12.30.20.50.20; author yamt; state Exp; branches; next 1.38.2.3; 1.38.2.3 date 2007.02.26.09.11.36; author yamt; state Exp; branches; next 1.38.2.4; 1.38.2.4 date 2007.09.03.14.42.23; author yamt; state Exp; branches; next 1.38.2.5; 1.38.2.5 date 2007.11.15.11.45.03; author yamt; state Exp; branches; next 1.38.2.6; 1.38.2.6 date 2007.12.07.17.34.19; author yamt; state Exp; branches; next 1.38.2.7; 1.38.2.7 date 2008.02.27.08.37.01; author yamt; state Exp; branches; next ; 1.38.8.1 date 2005.11.29.21.23.29; author yamt; state Exp; branches; next ; 1.34.8.1 date 2005.04.29.11.29.32; author kent; state Exp; branches; next ; 1.34.10.1 date 2005.03.19.08.36.32; author yamt; state Exp; branches; next ; 1.33.2.1 date 2004.08.03.10.54.19; author skrll; state Exp; branches; next 1.33.2.2; 1.33.2.2 date 2004.09.18.14.54.16; author skrll; state Exp; branches; next 1.33.2.3; 1.33.2.3 date 2004.09.21.13.36.42; author skrll; state Exp; branches; next 1.33.2.4; 1.33.2.4 date 2005.03.04.16.53.00; author skrll; state Exp; branches; next 1.33.2.5; 1.33.2.5 date 2005.11.10.14.10.33; author skrll; state Exp; branches; next 1.33.2.6; 1.33.2.6 date 2005.12.11.10.29.19; author christos; state Exp; branches; next ; 1.30.4.1 date 2002.05.16.03.58.47; author gehenna; state Exp; branches; next 1.30.4.2; 1.30.4.2 date 2002.07.15.10.36.52; author gehenna; state Exp; branches; next ; 1.26.2.1 date 2001.09.07.04.45.42; author thorpej; state Exp; branches; next 1.26.2.2; 1.26.2.2 date 2001.10.13.17.42.53; author fvdl; state Exp; branches; next ; 1.25.2.1 date 2001.08.03.04.13.52; author lukem; state Exp; branches; next 1.25.2.2; 1.25.2.2 date 2002.01.10.20.02.19; author thorpej; state Exp; branches; next 1.25.2.3; 1.25.2.3 date 2002.03.16.16.02.09; author jdolecek; state Exp; branches; next 1.25.2.4; 1.25.2.4 date 2002.06.23.17.50.32; author jdolecek; state Exp; branches; next 1.25.2.5; 1.25.2.5 date 2002.09.06.08.49.01; author jdolecek; state Exp; branches; next 1.25.2.6; 1.25.2.6 date 2002.10.10.18.43.50; author jdolecek; state Exp; branches; next ; 1.23.2.1 date 2001.03.05.22.49.55; author nathanw; state Exp; branches; next 1.23.2.2; 1.23.2.2 date 2001.04.09.01.58.17; author nathanw; state Exp; branches; next 1.23.2.3; 1.23.2.3 date 2001.06.21.20.08.19; author nathanw; state Exp; branches; next 1.23.2.4; 1.23.2.4 date 2001.08.24.00.12.18; author nathanw; state Exp; branches; next 1.23.2.5; 1.23.2.5 date 2001.11.14.19.17.29; author nathanw; state Exp; branches; next 1.23.2.6; 1.23.2.6 date 2002.04.01.07.48.26; author nathanw; state Exp; branches; next 1.23.2.7; 1.23.2.7 date 2002.06.24.22.11.42; author nathanw; state Exp; branches; next 1.23.2.8; 1.23.2.8 date 2002.08.01.02.46.43; author nathanw; state Exp; branches; next 1.23.2.9; 1.23.2.9 date 2002.09.17.21.22.58; author nathanw; state Exp; branches; next ; 1.18.2.1 date 2000.11.20.18.10.10; author bouyer; state Exp; branches; next 1.18.2.2; 1.18.2.2 date 2000.11.22.16.06.01; author bouyer; state Exp; branches; next 1.18.2.3; 1.18.2.3 date 2000.12.13.15.50.33; author bouyer; state Exp; branches; next 1.18.2.4; 1.18.2.4 date 2001.02.11.19.17.09; author bouyer; state Exp; branches; next 1.18.2.5; 1.18.2.5 date 2001.04.21.17.46.43; author bouyer; state Exp; branches; next ; 1.15.4.1 date 99.06.21.01.27.37; author thorpej; state Exp; branches; next ; 1.14.4.1 date 98.12.11.04.53.06; author kenh; state Exp; branches; next ; desc @@ 1.72 log @ppp: remove ioctls that never worked and crash the kernel Remove vestigial bits of PPP HDLC support that never worked on netbsd. The TIOCRCVFRAME ioctl was apparently intended to be called only from within the kernel, but nothing prevents user code from calling this ioctl and crashing the kernel. Reported-by: syzbot+53e4620d0d17a4dd08fa@@syzkaller.appspotmail.com Reported-by: syzbot+d3a8b784fed1e32e0768@@syzkaller.appspotmail.com Reported-by: syzbot+375bab63345a6a7a3331@@syzkaller.appspotmail.com Reported-by: syzbot+ba7ac85196274a20b54a@@syzkaller.appspotmail.com Reported-by: syzbot+57ddb63a3d1d3299ef18@@syzkaller.appspotmail.com @ text @/* $NetBSD: ppp_tty.c,v 1.71 2022/10/26 23:42:56 riastradh Exp $ */ /* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */ /* * ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous * tty devices. * * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The name "Carnegie Mellon University" must not be used to * endorse or promote products derived from this software without * prior written permission. For permission or any legal * details, please contact * Office of Technology Transfer * Carnegie Mellon University * 5000 Forbes Avenue * Pittsburgh, PA 15213-3890 * (412) 268-4387, fax: (412) 268-7395 * tech-transfer@@andrew.cmu.edu * * 4. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by Computing Services * at Carnegie Mellon University (http://www.cmu.edu/computing/)." * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Based on: * @@(#)if_sl.c 7.6.1.2 (Berkeley) 2/15/89 * * Copyright (c) 1987 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Serial Line interface * * Rick Adams * Center for Seismic Studies * 1300 N 17th Street, Suite 1450 * Arlington, Virginia 22209 * (703)276-7900 * rick@@seismo.ARPA * seismo!rick * * Pounded on heavily by Chris Torek (chris@@mimsy.umd.edu, umcp-cs!chris). * Converted to 4.3BSD Beta by Chris Torek. * Other changes made at Berkeley, based in part on code by Kirk Smith. * * Converted to 4.3BSD+ 386BSD by Brad Parker (brad@@cayman.com) * Added VJ tcp header compression; more unified ioctls * * Extensively modified by Paul Mackerras (paulus@@cs.anu.edu.au). * Cleaned up a lot of the mbuf-related code to fix bugs that * caused system crashes and packet corruption. Changed pppstart * so that it doesn't just give up with a "collision" if the whole * packet doesn't fit in the output ring buffer. * * Added priority queueing for interactive IP packets, following * the model of if_sl.c, plus hooks for bpf. * Paul Mackerras (paulus@@cs.anu.edu.au). */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ #include __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.71 2022/10/26 23:42:56 riastradh Exp $"); #ifdef _KERNEL_OPT #include "ppp.h" #include "opt_ppp.h" #endif #define VJC #define PPP_COMPRESS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef VJC #include #include #include #include #endif #include #include #include #include static int pppopen(dev_t dev, struct tty *tp); static int pppclose(struct tty *tp, int flag); static int pppread(struct tty *tp, struct uio *uio, int flag); static int pppwrite(struct tty *tp, struct uio *uio, int flag); static int ppptioctl(struct tty *tp, u_long cmd, void *data, int flag, struct lwp *); static int pppinput(int c, struct tty *tp); static int pppstart(struct tty *tp); struct linesw ppp_disc = { /* XXX should be static */ .l_name = "ppp", .l_open = pppopen, .l_close = pppclose, .l_read = pppread, .l_write = pppwrite, .l_ioctl = ppptioctl, .l_rint = pppinput, .l_start = pppstart, .l_modem = ttymodem, .l_poll = ttpoll }; static uint16_t pppfcs(uint16_t fcs, const uint8_t *cp, int len); static void pppasyncstart(struct ppp_softc *); static void pppasyncctlp(struct ppp_softc *); static void pppasyncrelinq(struct ppp_softc *); static void ppp_timeout(void *); static void pppgetm(struct ppp_softc *sc); static void pppdumpb(u_char *b, int l); static void ppplogchar(struct ppp_softc *, int); /* * Does c need to be escaped? */ #define ESCAPE_P(c) (sc->sc_asyncmap[(c) >> 5] & (1U << ((c) & 0x1F))) /* * Procedures for using an async tty interface for PPP. */ /* This is a NetBSD-1.0 or later kernel. */ #define CCOUNT(q) ((q)->c_cc) #define PPP_LOWAT 100 /* Process more output when < LOWAT on queue */ #define PPP_HIWAT 400 /* Don't start a new packet if HIWAT on que */ /* * Line specific open routine for async tty devices. * Attach the given tty to the first available ppp unit. * Called from device open routine or ttioctl. */ /* ARGSUSED */ static int pppopen(dev_t dev, struct tty *tp) { struct lwp *l = curlwp; /* XXX */ struct ppp_softc *sc; int error, s; error = kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE_PPP, KAUTH_REQ_NETWORK_INTERFACE_PPP_ADD, NULL, NULL, NULL); if (error) return (error); s = spltty(); if (tp->t_linesw == &ppp_disc) { sc = (struct ppp_softc *) tp->t_sc; if (sc != NULL && sc->sc_devp == (void *) tp) { splx(s); return (0); } } if ((sc = pppalloc(l->l_proc->p_pid)) == NULL) { splx(s); return ENXIO; } if (sc->sc_relinq) (*sc->sc_relinq)(sc); /* get previous owner to relinquish the unit */ /* Switch DLT to PPP-over-serial. */ bpf_change_type(&sc->sc_if, DLT_PPP_SERIAL, PPP_HDRLEN); sc->sc_ilen = 0; sc->sc_m = NULL; memset(sc->sc_asyncmap, 0, sizeof(sc->sc_asyncmap)); sc->sc_asyncmap[0] = 0xffffffff; sc->sc_asyncmap[3] = 0x60000000; sc->sc_rasyncmap = 0; sc->sc_devp = (void *) tp; sc->sc_start = pppasyncstart; sc->sc_ctlp = pppasyncctlp; sc->sc_relinq = pppasyncrelinq; sc->sc_outm = NULL; pppgetm(sc); sc->sc_if.if_flags |= IFF_RUNNING; sc->sc_if.if_baudrate = tp->t_ospeed; tp->t_sc = (void *) sc; ttylock(tp); ttyflush(tp, FREAD | FWRITE); ttyunlock(tp); splx(s); return (0); } /* * Line specific close routine, called from device close routine * and from ttioctl. * Detach the tty from the ppp unit. * Mimics part of ttyclose(). */ static int pppclose(struct tty *tp, int flag) { struct ppp_softc *sc; int s; s = spltty(); ttylock(tp); ttyflush(tp, FREAD|FWRITE); ttyunlock(tp); /* XXX */ ttyldisc_release(tp->t_linesw); tp->t_linesw = ttyldisc_default(); sc = (struct ppp_softc *) tp->t_sc; if (sc != NULL) { tp->t_sc = NULL; if (tp == (struct tty *) sc->sc_devp) { pppasyncrelinq(sc); pppdealloc(sc); } } splx(s); return 0; } /* * Relinquish the interface unit to another device. */ static void pppasyncrelinq(struct ppp_softc *sc) { int s; /* Change DLT to back none. */ bpf_change_type(&sc->sc_if, DLT_NULL, 0); s = spltty(); if (sc->sc_outm) { m_freem(sc->sc_outm); sc->sc_outm = NULL; } if (sc->sc_m) { m_freem(sc->sc_m); sc->sc_m = NULL; } if (sc->sc_flags & SC_TIMEOUT) { callout_stop(&sc->sc_timo_ch); sc->sc_flags &= ~SC_TIMEOUT; } splx(s); } /* * Line specific (tty) read routine. */ static int pppread(struct tty *tp, struct uio *uio, int flag) { struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; struct mbuf *m, *m0; int error = 0; if (sc == NULL) return 0; /* * Loop waiting for input, checking that nothing disastrous * happens in the meantime. */ ttylock(tp); for (;;) { if (tp != (struct tty *) sc->sc_devp || tp->t_linesw != &ppp_disc) { ttyunlock(tp); return 0; } if (sc->sc_inq.ifq_head != NULL) break; if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0 && (tp->t_state & TS_ISOPEN)) { ttyunlock(tp); return 0; /* end of file */ } if (tp->t_state & TS_ASYNC || flag & IO_NDELAY) { ttyunlock(tp); return (EWOULDBLOCK); } error = ttysleep(tp, &tp->t_rawcv, true, 0); if (error) { ttyunlock(tp); return error; } } /* Pull place-holder byte out of canonical queue */ getc(&tp->t_canq); /* Get the packet from the input queue */ IF_DEQUEUE(&sc->sc_inq, m0); ttyunlock(tp); for (m = m0; m && uio->uio_resid; m = m->m_next) if ((error = uiomove(mtod(m, u_char *), m->m_len, uio)) != 0) break; m_freem(m0); return (error); } /* * Line specific (tty) write routine. */ static int pppwrite(struct tty *tp, struct uio *uio, int flag) { struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; struct mbuf *m, *m0; struct sockaddr dst; int len, error; if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0) return 0; /* wrote 0 bytes */ if (tp->t_linesw != &ppp_disc) return (EINVAL); if (sc == NULL || tp != (struct tty *) sc->sc_devp) return EIO; if (uio->uio_resid > sc->sc_if.if_mtu + PPP_HDRLEN || uio->uio_resid < PPP_HDRLEN) return (EMSGSIZE); MGETHDR(m0, M_WAIT, MT_DATA); if (m0 == NULL) return ENOBUFS; m0->m_len = 0; m0->m_pkthdr.len = uio->uio_resid; m_reset_rcvif(m0); if (uio->uio_resid >= MCLBYTES / 2) MCLGET(m0, M_DONTWAIT); for (m = m0; uio->uio_resid;) { len = M_TRAILINGSPACE(m); if (len > uio->uio_resid) len = uio->uio_resid; if ((error = uiomove(mtod(m, u_char *), len, uio)) != 0) { m_freem(m0); return (error); } m->m_len = len; if (uio->uio_resid == 0) break; MGET(m->m_next, M_WAIT, MT_DATA); if (m->m_next == NULL) { m_freem(m0); return ENOBUFS; } m = m->m_next; m->m_len = 0; } dst.sa_family = AF_UNSPEC; bcopy(mtod(m0, u_char *), dst.sa_data, PPP_HDRLEN); m_adj(m0, PPP_HDRLEN); return if_output_lock(&sc->sc_if, &sc->sc_if, m0, &dst, (struct rtentry *)0); } /* * Line specific (tty) ioctl routine. * This discipline requires that tty device drivers call * the line specific l_ioctl routine from their ioctl routines. */ /* ARGSUSED */ static int ppptioctl(struct tty *tp, u_long cmd, void *data, int flag, struct lwp *l) { struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc; int error, s; if (sc == NULL) return (EPASSTHROUGH); KERNEL_LOCK(1, NULL); if (tp != (struct tty *) sc->sc_devp) { error = EPASSTHROUGH; goto out; } error = 0; switch (cmd) { case PPPIOCSASYNCMAP: if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) break; sc->sc_asyncmap[0] = *(u_int *)data; break; case PPPIOCGASYNCMAP: *(u_int *)data = sc->sc_asyncmap[0]; break; case PPPIOCSRASYNCMAP: if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) break; sc->sc_rasyncmap = *(u_int *)data; break; case PPPIOCGRASYNCMAP: *(u_int *)data = sc->sc_rasyncmap; break; case PPPIOCSXASYNCMAP: if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) break; s = spltty(); bcopy(data, sc->sc_asyncmap, sizeof(sc->sc_asyncmap)); sc->sc_asyncmap[1] = 0; /* mustn't escape 0x20 - 0x3f */ sc->sc_asyncmap[2] &= ~0x40000000; /* mustn't escape 0x5e */ sc->sc_asyncmap[3] |= 0x60000000; /* must escape 0x7d, 0x7e */ splx(s); break; case PPPIOCGXASYNCMAP: bcopy(sc->sc_asyncmap, data, sizeof(sc->sc_asyncmap)); break; default: error = pppioctl(sc, cmd, data, flag, l); if (error == 0 && cmd == PPPIOCSMRU) pppgetm(sc); } out: KERNEL_UNLOCK_ONE(NULL); return error; } /* * FCS lookup table as calculated by genfcstab. */ static const uint16_t fcstab[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 }; /* * Calculate a new FCS given the current FCS and the new data. */ static uint16_t pppfcs(uint16_t fcs, const uint8_t *cp, int len) { while (len--) fcs = PPP_FCS(fcs, *cp++); return (fcs); } /* * This gets called at splsoftnet from if_ppp.c at various times * when there is data ready to be sent. */ static void pppasyncstart(struct ppp_softc *sc) { struct tty *tp = (struct tty *) sc->sc_devp; struct mbuf *m; int len; u_char *start, *stop, *cp; int n, ndone, done, idle; struct mbuf *m2; ttylock(tp); idle = 0; while (CCOUNT(&tp->t_outq) < PPP_HIWAT) { /* * See if we have an existing packet partly sent. * If not, get a new packet and start sending it. */ m = sc->sc_outm; if (m == NULL) { /* * Get another packet to be sent. */ m = ppp_dequeue(sc); if (m == NULL) { idle = 1; break; } /* * The extra PPP_FLAG will start up a new packet, and thus * will flush any accumulated garbage. We do this whenever * the line may have been idle for some time. */ if (CCOUNT(&tp->t_outq) == 0) { ++sc->sc_stats.ppp_obytes; (void) putc(PPP_FLAG, &tp->t_outq); } /* Calculate the FCS for the first mbuf's worth. */ sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, uint8_t *), m->m_len); } for (;;) { start = mtod(m, u_char *); len = m->m_len; stop = start + len; while (len > 0) { /* * Find out how many bytes in the string we can * handle without doing something special. */ for (cp = start; cp < stop; cp++) if (ESCAPE_P(*cp)) break; n = cp - start; if (n) { /* NetBSD (0.9 or later), 4.3-Reno or similar. */ ndone = n - b_to_q(start, n, &tp->t_outq); len -= ndone; start += ndone; sc->sc_stats.ppp_obytes += ndone; if (ndone < n) break; /* packet doesn't fit */ } /* * If there are characters left in the mbuf, * the first one must be special. * Put it out in a different form. */ if (len) { if (putc(PPP_ESCAPE, &tp->t_outq)) break; if (putc(*start ^ PPP_TRANS, &tp->t_outq)) { (void) unputc(&tp->t_outq); break; } sc->sc_stats.ppp_obytes += 2; start++; len--; } } /* * If we didn't empty this mbuf, remember where we're up to. * If we emptied the last mbuf, try to add the FCS and closing * flag, and if we can't, leave sc_outm pointing to m, but with * m->m_len == 0, to remind us to output the FCS and flag later. */ done = len == 0; if (done && m->m_next == NULL) { u_char *p, *q; int c; u_char endseq[8]; /* * We may have to escape the bytes in the FCS. */ p = endseq; c = ~sc->sc_outfcs & 0xFF; if (ESCAPE_P(c)) { *p++ = PPP_ESCAPE; *p++ = c ^ PPP_TRANS; } else *p++ = c; c = (~sc->sc_outfcs >> 8) & 0xFF; if (ESCAPE_P(c)) { *p++ = PPP_ESCAPE; *p++ = c ^ PPP_TRANS; } else *p++ = c; *p++ = PPP_FLAG; /* * Try to output the FCS and flag. If the bytes * don't all fit, back out. */ for (q = endseq; q < p; ++q) if (putc(*q, &tp->t_outq)) { done = 0; for (; q > endseq; --q) unputc(&tp->t_outq); break; } if (done) sc->sc_stats.ppp_obytes += q - endseq; } if (!done) { /* remember where we got to */ m->m_data = start; m->m_len = len; break; } /* Finished with this mbuf; free it and move on. */ m = m2 = m_free(m); if (m == NULL) { /* Finished a packet */ break; } sc->sc_outfcs = pppfcs(sc->sc_outfcs, mtod(m, uint8_t *), m->m_len); } /* * If m == NULL, we have finished a packet. * If m != NULL, we've either done as much work this time * as we need to, or else we've filled up the output queue. */ sc->sc_outm = m; if (m) break; } /* Call pppstart to start output again if necessary. */ pppstart(tp); /* * This timeout is needed for operation on a pseudo-tty, * because the pty code doesn't call pppstart after it has * drained the t_outq. */ if (!idle && (sc->sc_flags & SC_TIMEOUT) == 0) { callout_reset(&sc->sc_timo_ch, 1, ppp_timeout, sc); sc->sc_flags |= SC_TIMEOUT; } ttyunlock(tp); } /* * This gets called when a received packet is placed on * the inq, at splsoftnet. */ static void pppasyncctlp(struct ppp_softc *sc) { struct tty *tp; /* Put a placeholder byte in canq for ttselect()/ttnread(). */ tp = (struct tty *) sc->sc_devp; ttylock(tp); putc(0, &tp->t_canq); ttwakeup(tp); ttyunlock(tp); } /* * Start output on async tty interface. If the transmit queue * has drained sufficiently, arrange for pppasyncstart to be * called later at splsoftnet. * Called at spltty or higher. */ static int pppstart(struct tty *tp) { struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc; /* * If there is stuff in the output queue, send it now. * We are being called in lieu of ttstart and must do what it would. */ if (tp->t_oproc != NULL) (*tp->t_oproc)(tp); /* * If the transmit queue has drained and the tty has not hung up * or been disconnected from the ppp unit, then tell if_ppp.c that * we need more output. */ if ((CCOUNT(&tp->t_outq) >= PPP_LOWAT) && ((sc == NULL) || (sc->sc_flags & SC_TIMEOUT))) return 0; #ifdef ALTQ /* * if ALTQ is enabled, don't invoke NETISR_PPP. * pppintr() could loop without doing anything useful * under rate-limiting. */ if (ALTQ_IS_ENABLED(&sc->sc_if.if_snd)) return 0; #endif if (!((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0) && sc != NULL && tp == (struct tty *) sc->sc_devp) { ppp_restart(sc); } return 0; } /* * Timeout routine - try to start some more output. */ static void ppp_timeout(void *x) { struct ppp_softc *sc = (struct ppp_softc *) x; struct tty *tp = (struct tty *) sc->sc_devp; ttylock(tp); sc->sc_flags &= ~SC_TIMEOUT; pppstart(tp); ttyunlock(tp); } /* * Allocate enough mbuf to handle current MRU. */ static void pppgetm(struct ppp_softc *sc) { struct mbuf *m, **mp; int len; mp = &sc->sc_m; for (len = sc->sc_mru + PPP_HDRLEN + PPP_FCSLEN; len > 0; ){ if ((m = *mp) == NULL) { MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) break; *mp = m; MCLGET(m, M_DONTWAIT); } len -= M_BUFSIZE(m); mp = &m->m_next; } } /* * tty interface receiver interrupt. */ static const unsigned paritytab[8] = { 0x96696996, 0x69969669, 0x69969669, 0x96696996, 0x69969669, 0x96696996, 0x96696996, 0x69969669 }; static int pppinput(int c, struct tty *tp) { struct ppp_softc *sc; struct mbuf *m; int ilen, s; int result; sc = (struct ppp_softc *) tp->t_sc; if (sc == NULL || tp != (struct tty *) sc->sc_devp) return 0; ++tk_nin; ++sc->sc_stats.ppp_ibytes; if (c & TTY_FE) { /* framing error or overrun on this char - abort packet */ if (sc->sc_flags & SC_DEBUG) printf("%s: bad char %x\n", sc->sc_if.if_xname, c); goto flush; } c &= 0xff; /* * Handle software flow control of output. */ result = tty_try_xonxoff(tp, c); if (result == 0) { /* Character was recognized and consumed. */ return 0; } /* Character wasn't consumed, continue processing it. */ s = spltty(); if (c & 0x80) sc->sc_flags |= SC_RCV_B7_1; else sc->sc_flags |= SC_RCV_B7_0; if (paritytab[c >> 5] & (1U << (c & 0x1F))) sc->sc_flags |= SC_RCV_ODDP; else sc->sc_flags |= SC_RCV_EVNP; splx(s); ppplogchar(sc, c); if (c == PPP_FLAG) { ilen = sc->sc_ilen; sc->sc_ilen = 0; if ((sc->sc_flags & SC_LOG_RAWIN) && sc->sc_rawin.count > 0) ppplogchar(sc, -1); /* * If SC_ESCAPED is set, then we've seen the packet * abort sequence "}~". */ if (sc->sc_flags & (SC_FLUSH | SC_ESCAPED) || (ilen > 0 && sc->sc_fcs != PPP_GOODFCS)) { s = spltty(); sc->sc_flags |= SC_PKTLOST; /* note the dropped packet */ if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) == 0){ if (sc->sc_flags & SC_DEBUG) printf("%s: bad fcs %x\n", sc->sc_if.if_xname, sc->sc_fcs); if_statinc(&sc->sc_if, if_ierrors); sc->sc_stats.ppp_ierrors++; } else sc->sc_flags &= ~(SC_FLUSH | SC_ESCAPED); splx(s); return 0; } if (ilen < PPP_HDRLEN + PPP_FCSLEN) { if (ilen) { if (sc->sc_flags & SC_DEBUG) printf("%s: too short (%d)\n", sc->sc_if.if_xname, ilen); s = spltty(); if_statinc(&sc->sc_if, if_ierrors); sc->sc_stats.ppp_ierrors++; sc->sc_flags |= SC_PKTLOST; splx(s); } return 0; } /* * Remove FCS trailer. Somewhat painful... */ ilen -= 2; if (--sc->sc_mc->m_len == 0) { for (m = sc->sc_m; m->m_next != sc->sc_mc; m = m->m_next) ; sc->sc_mc = m; } sc->sc_mc->m_len--; /* excise this mbuf chain */ m = sc->sc_m; sc->sc_m = sc->sc_mc->m_next; sc->sc_mc->m_next = NULL; ppppktin(sc, m, sc->sc_flags & SC_PKTLOST); if (sc->sc_flags & SC_PKTLOST) { s = spltty(); sc->sc_flags &= ~SC_PKTLOST; splx(s); } pppgetm(sc); return 0; } if (sc->sc_flags & SC_FLUSH) { if (sc->sc_flags & SC_LOG_FLUSH) ppplogchar(sc, c); return 0; } if (c < 0x20 && (sc->sc_rasyncmap & (1U << c))) return 0; s = spltty(); if (sc->sc_flags & SC_ESCAPED) { sc->sc_flags &= ~SC_ESCAPED; c ^= PPP_TRANS; } else if (c == PPP_ESCAPE) { sc->sc_flags |= SC_ESCAPED; splx(s); return 0; } splx(s); /* * Initialize buffer on first octet received. * First octet could be address or protocol (when compressing * address/control). * Second octet is control. * Third octet is first or second (when compressing protocol) * octet of protocol. * Fourth octet is second octet of protocol. */ if (sc->sc_ilen == 0) { /* reset the first input mbuf */ if (sc->sc_m == NULL) { pppgetm(sc); if (sc->sc_m == NULL) { if (sc->sc_flags & SC_DEBUG) printf("%s: no input mbufs!\n", sc->sc_if.if_xname); goto flush; } } m = sc->sc_m; m->m_len = 0; MRESETDATA(m); sc->sc_mc = m; sc->sc_mp = mtod(m, char *); sc->sc_fcs = PPP_INITFCS; if (c != PPP_ALLSTATIONS) { if (sc->sc_flags & SC_REJ_COMP_AC) { if (sc->sc_flags & SC_DEBUG) printf("%s: garbage received: 0x%x (need 0xFF)\n", sc->sc_if.if_xname, c); goto flush; } *sc->sc_mp++ = PPP_ALLSTATIONS; *sc->sc_mp++ = PPP_UI; sc->sc_ilen += 2; m->m_len += 2; } } if (sc->sc_ilen == 1 && c != PPP_UI) { if (sc->sc_flags & SC_DEBUG) printf("%s: missing UI (0x3), got 0x%x\n", sc->sc_if.if_xname, c); goto flush; } if (sc->sc_ilen == 2 && (c & 1) == 1) { /* a compressed protocol */ *sc->sc_mp++ = 0; sc->sc_ilen++; sc->sc_mc->m_len++; } if (sc->sc_ilen == 3 && (c & 1) == 0) { if (sc->sc_flags & SC_DEBUG) printf("%s: bad protocol %x\n", sc->sc_if.if_xname, (sc->sc_mp[-1] << 8) + c); goto flush; } /* packet beyond configured mru? */ if (++sc->sc_ilen > sc->sc_mru + PPP_HDRLEN + PPP_FCSLEN) { if (sc->sc_flags & SC_DEBUG) printf("%s: packet too big\n", sc->sc_if.if_xname); goto flush; } /* is this mbuf full? */ m = sc->sc_mc; if (M_TRAILINGSPACE(m) <= 0) { if (m->m_next == NULL) { pppgetm(sc); if (m->m_next == NULL) { if (sc->sc_flags & SC_DEBUG) printf("%s: too few input mbufs!\n", sc->sc_if.if_xname); goto flush; } } sc->sc_mc = m = m->m_next; m->m_len = 0; MRESETDATA(m); sc->sc_mp = mtod(m, char *); } ++m->m_len; *sc->sc_mp++ = c; sc->sc_fcs = PPP_FCS(sc->sc_fcs, c); return 0; flush: if (!(sc->sc_flags & SC_FLUSH)) { s = spltty(); if_statinc(&sc->sc_if, if_ierrors); sc->sc_stats.ppp_ierrors++; sc->sc_flags |= SC_FLUSH; splx(s); if (sc->sc_flags & SC_LOG_FLUSH) ppplogchar(sc, c); } return 0; } #define MAX_DUMP_BYTES 128 static void ppplogchar(struct ppp_softc *sc, int c) { if (c >= 0) { sc->sc_rawin.buf[sc->sc_rawin_start++] = c; if (sc->sc_rawin.count < sizeof(sc->sc_rawin.buf)) sc->sc_rawin.count++; } if (sc->sc_rawin_start >= sizeof(sc->sc_rawin.buf) || (c < 0 && sc->sc_rawin_start > 0)) { if (sc->sc_flags & (SC_LOG_FLUSH|SC_LOG_RAWIN)) { printf("%s input: ", sc->sc_if.if_xname); pppdumpb(sc->sc_rawin.buf, sc->sc_rawin_start); } if (c < 0) sc->sc_rawin.count = 0; sc->sc_rawin_start = 0; } } static void pppdumpb(u_char *b, int l) { char bf[3*MAX_DUMP_BYTES+4]; char *bp = bf; while (l--) { if (bp >= bf + sizeof(bf) - 3) { *bp++ = '>'; break; } *bp++ = hexdigits[*b >> 4]; /* convert byte to ascii hex */ *bp++ = hexdigits[*b++ & 0xf]; *bp++ = ' '; } *bp = 0; printf("%s\n", bf); } @ 1.71 log @ppp(4): Convert to ttylock/ttyunlock. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.70 2022/05/04 07:48:35 andvar Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.70 2022/05/04 07:48:35 andvar Exp $"); a155 1 static void ppprcvframe(struct ppp_softc *sc, struct mbuf *m); a156 1 static void pppsyncstart(struct ppp_softc *sc); a163 1 static void pppdumpframe(struct ppp_softc *sc, struct mbuf* m, int xmit); a437 4 case TIOCRCVFRAME: ppprcvframe(sc,*((struct mbuf **)data)); break; a486 107 /* receive a complete ppp frame from device in synchronous * hdlc mode. caller gives up ownership of mbuf */ static void ppprcvframe(struct ppp_softc *sc, struct mbuf *m) { int len, s; struct mbuf *n; u_char hdr[4]; int hlen,count; for (n=m,len=0;n != NULL;n = n->m_next) len += n->m_len; if (len==0) { m_freem(m); return; } /* extract PPP header from mbuf chain (1 to 4 bytes) */ for (n=m,hlen=0;n!=NULL && hlenm_next) { count = (sizeof(hdr)-hlen) < n->m_len ? sizeof(hdr)-hlen : n->m_len; bcopy(mtod(n,u_char*),&hdr[hlen],count); hlen+=count; } s = spltty(); /* if AFCF compressed then prepend AFCF */ if (hdr[0] != PPP_ALLSTATIONS) { if (sc->sc_flags & SC_REJ_COMP_AC) { if (sc->sc_flags & SC_DEBUG) printf( "%s: garbage received: 0x%x (need 0xFF)\n", sc->sc_if.if_xname, hdr[0]); goto bail; } M_PREPEND(m,2,M_DONTWAIT); if (m==NULL) { splx(s); return; } hdr[3] = hdr[1]; hdr[2] = hdr[0]; hdr[0] = PPP_ALLSTATIONS; hdr[1] = PPP_UI; len += 2; } /* if protocol field compressed, add MSB of protocol field = 0 */ if (hdr[2] & 1) { /* a compressed protocol */ M_PREPEND(m,1,M_DONTWAIT); if (m==NULL) { splx(s); return; } hdr[3] = hdr[2]; hdr[2] = 0; len++; } /* valid LSB of protocol field has bit0 set */ if (!(hdr[3] & 1)) { if (sc->sc_flags & SC_DEBUG) printf("%s: bad protocol %x\n", sc->sc_if.if_xname, (hdr[2] << 8) + hdr[3]); goto bail; } /* packet beyond configured mru? */ if (len > sc->sc_mru + PPP_HDRLEN) { if (sc->sc_flags & SC_DEBUG) printf("%s: packet too big\n", sc->sc_if.if_xname); goto bail; } /* add expanded 4 byte header to mbuf chain */ for (n=m,hlen=0;n!=NULL && hlenm_next) { count = (sizeof(hdr)-hlen) < n->m_len ? sizeof(hdr)-hlen : n->m_len; bcopy(&hdr[hlen],mtod(n,u_char*),count); hlen+=count; } /* if_ppp.c requires the PPP header and IP header */ /* to be contiguous */ count = len < MHLEN ? len : MHLEN; if (m->m_len < count) { m = m_pullup(m,count); if (m==NULL) goto bail; } sc->sc_stats.ppp_ibytes += len; if (sc->sc_flags & SC_LOG_RAWIN) pppdumpframe(sc,m,0); ppppktin(sc, m, 0); splx(s); return; bail: m_freem(m); splx(s); } a535 36 /* This gets called at splsoftnet from pppasyncstart at various times * when there is data ready to be sent. */ static void pppsyncstart(struct ppp_softc *sc) { struct tty *tp = (struct tty *) sc->sc_devp; struct mbuf *m, *n; const struct cdevsw *cdev; int len; for(m = sc->sc_outm;;) { if (m == NULL) { m = ppp_dequeue(sc); /* get new packet */ if (m == NULL) break; /* no more packets */ if (sc->sc_flags & SC_DEBUG) pppdumpframe(sc,m,1); } for(n=m,len=0;n!=NULL;n=n->m_next) len += n->m_len; /* call device driver IOCTL to transmit a frame */ cdev = cdevsw_lookup(tp->t_dev); if (cdev == NULL || (*cdev->d_ioctl)(tp->t_dev, TIOCXMTFRAME, (void *)&m, 0, 0)) { /* busy or error, set as current packet */ sc->sc_outm = m; break; } sc->sc_outm = m = NULL; sc->sc_stats.ppp_obytes += len; } } a549 5 if (sc->sc_flags & SC_SYNC){ pppsyncstart(sc); return; } a1090 41 static void pppdumpframe(struct ppp_softc *sc, struct mbuf *m, int xmit) { int i,lcount,copycount,count; char lbuf[16]; char *data; if (m == NULL) return; for(count=m->m_len,data=mtod(m,char*);m != NULL;) { /* build a line of output */ for(lcount=0;lcount < sizeof(lbuf);lcount += copycount) { if (!count) { m = m->m_next; if (m == NULL) break; count = m->m_len; data = mtod(m,char*); } copycount = (count > sizeof(lbuf)-lcount) ? sizeof(lbuf)-lcount : count; bcopy(data,&lbuf[lcount],copycount); data += copycount; count -= copycount; } /* output line (hex 1st, then ascii) */ printf("%s %s:", sc->sc_if.if_xname, xmit ? "output" : "input "); for(i=0;i= 040 && lbuf[i] <= 0176) ? lbuf[i] : '.'); printf("\n"); } } @ 1.71.2.1 log @Pull up following revision(s) (requested by chs in ticket #19): external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc: revision 1.5 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_netbsd.h: revision 1.8 sys/sys/ttycom.h: revision 1.22 sys/net/ppp_tty.c: revision 1.72 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_netbsd.cc: revision 1.9 ppp: remove ioctls that never worked and crash the kernel Remove vestigial bits of PPP HDLC support that never worked on netbsd. The TIOCRCVFRAME ioctl was apparently intended to be called only from within the kernel, but nothing prevents user code from calling this ioctl and crashing the kernel. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.71 2022/10/26 23:42:56 riastradh Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.71 2022/10/26 23:42:56 riastradh Exp $"); d156 1 d158 1 d166 1 d441 4 d494 107 d650 36 d700 5 d1246 41 @ 1.70 log @fix various typos in comments and log messages. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.69 2021/12/13 02:53:43 msaitoh Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.69 2021/12/13 02:53:43 msaitoh Exp $"); d238 1 a238 1 mutex_spin_enter(&tty_lock); d240 1 a240 1 mutex_spin_exit(&tty_lock); d259 1 a259 1 mutex_spin_enter(&tty_lock); d261 1 a261 1 mutex_spin_exit(&tty_lock); /* XXX */ d319 1 a319 1 mutex_spin_enter(&tty_lock); d323 1 a323 1 mutex_spin_exit(&tty_lock); d330 1 a330 1 mutex_spin_exit(&tty_lock); d334 1 a334 1 mutex_spin_exit(&tty_lock); d339 1 a339 1 mutex_spin_exit(&tty_lock); d349 1 a349 1 mutex_spin_exit(&tty_lock); d705 1 a705 1 mutex_spin_enter(&tty_lock); d863 1 a863 1 mutex_spin_exit(&tty_lock); a875 1 mutex_spin_enter(&tty_lock); d877 1 d880 1 a880 1 mutex_spin_exit(&tty_lock); d935 1 a935 1 mutex_spin_enter(&tty_lock); d938 1 a938 1 mutex_spin_exit(&tty_lock); @ 1.69 log @Use unsigned to avoid undefined behavior. Found by kUBSan. Reported-by: syzbot+699ce32cd32e2a670788@@syzkaller.appspotmail.com @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.68 2021/09/27 07:13:30 msaitoh Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.68 2021/09/27 07:13:30 msaitoh Exp $"); d316 1 a316 1 * Loop waiting for input, checking that nothing disasterous @ 1.68 log @Use unsigned to avoid undefined behavior in pppasyncstart(). Reported-by: syzbot+7c8c7977e2756ac13f0a@@syzkaller.appspotmail.com @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.67 2020/01/29 04:28:27 thorpej Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.67 2020/01/29 04:28:27 thorpej Exp $"); d1011 1 a1011 1 if (paritytab[c >> 5] & (1 << (c & 0x1F))) d1092 1 a1092 1 if (c < 0x20 && (sc->sc_rasyncmap & (1 << c))) @ 1.67 log @Adopt . @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $"); d171 1 a171 1 #define ESCAPE_P(c) (sc->sc_asyncmap[(c) >> 5] & (1 << ((c) & 0x1F))) @ 1.66 log @dedup @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $"); d1038 1 a1038 1 sc->sc_if.if_ierrors++; d1051 1 a1051 1 sc->sc_if.if_ierrors++; d1195 1 a1195 1 sc->sc_if.if_ierrors++; @ 1.66.2.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.67 2020/01/29 04:28:27 thorpej Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.67 2020/01/29 04:28:27 thorpej Exp $"); d1038 1 a1038 1 if_statinc(&sc->sc_if, if_ierrors); d1051 1 a1051 1 if_statinc(&sc->sc_if, if_ierrors); d1195 1 a1195 1 if_statinc(&sc->sc_if, if_ierrors); @ 1.65 log @Add KERNEL_LOCK in ppptioctl() to protect struct ppp_softc members. struct linesw.i_ioctl can be called without any preservation when the caller's struct cdevsw is set D_MPSAFE such as ucom(4). @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.64 2018/02/07 06:19:43 mrg Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.64 2018/02/07 06:19:43 mrg Exp $"); a168 13 * Some useful mbuf macros not in mbuf.h. */ #define M_IS_CLUSTER(m) ((m)->m_flags & M_EXT) #define M_DATASTART(m) \ (M_IS_CLUSTER(m) ? (m)->m_ext.ext_buf : \ (m)->m_flags & M_PKTHDR ? (m)->m_pktdat : (m)->m_dat) #define M_DATASIZE(m) \ (M_IS_CLUSTER(m) ? (m)->m_ext.ext_size : \ (m)->m_flags & M_PKTHDR ? MHLEN: MLEN) /* d959 1 a959 1 len -= M_DATASIZE(m); d1127 1 a1127 1 m->m_data = M_DATASTART(sc->sc_m); d1183 1 a1183 1 m->m_data = M_DATASTART(m); @ 1.65.4.1 log @Pull up following revision(s) (requested by msaitoh in ticket #1411): sys/net/ppp_tty.c: revision 1.68 sys/net/ppp_tty.c: revision 1.69 Use unsigned to avoid undefined behavior in pppasyncstart(). Use unsigned to avoid undefined behavior. Found by kUBSan. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $"); d184 1 a184 1 #define ESCAPE_P(c) (sc->sc_asyncmap[(c) >> 5] & (1U << ((c) & 0x1F))) d1024 1 a1024 1 if (paritytab[c >> 5] & (1U << (c & 0x1F))) d1105 1 a1105 1 if (c < 0x20 && (sc->sc_rasyncmap & (1U << c))) @ 1.64 log @ppprcvframe() has indentation issues. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $"); d442 9 a450 2 if (sc == NULL || tp != (struct tty *) sc->sc_devp) return (EPASSTHROUGH); d502 2 @ 1.64.4.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $"); d442 2 a443 9 if (sc == NULL) return (EPASSTHROUGH); KERNEL_LOCK(1, NULL); if (tp != (struct tty *) sc->sc_devp) { error = EPASSTHROUGH; goto out; } a494 2 out: KERNEL_UNLOCK_ONE(NULL); @ 1.64.4.2 log @Merge changes from current as of 20200406 @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD$"); d1051 1 a1051 1 if_statinc(&sc->sc_if, if_ierrors); d1064 1 a1064 1 if_statinc(&sc->sc_if, if_ierrors); d1208 1 a1208 1 if_statinc(&sc->sc_if, if_ierrors); @ 1.64.4.3 log @Mostly merge changes from HEAD upto 20200411 @ text @d169 13 d972 1 a972 1 len -= M_BUFSIZE(m); d1140 1 a1140 1 MRESETDATA(m); d1196 1 a1196 1 MRESETDATA(m); @ 1.64.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.64 2018/02/07 06:19:43 mrg Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.64 2018/02/07 06:19:43 mrg Exp $"); d442 2 a443 9 if (sc == NULL) return (EPASSTHROUGH); KERNEL_LOCK(1, NULL); if (tp != (struct tty *) sc->sc_devp) { error = EPASSTHROUGH; goto out; } a494 2 out: KERNEL_UNLOCK_ONE(NULL); @ 1.63 log @MFREE -> m_free @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.62 2016/08/06 02:35:06 pgoyette Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.62 2016/08/06 02:35:06 pgoyette Exp $"); d533 2 a534 2 goto bail; } d565 1 a565 1 goto bail; @ 1.63.8.1 log @Pull up following revision(s) (requested by msaitoh in ticket #1727): sys/net/ppp_tty.c: revision 1.68 sys/net/ppp_tty.c: revision 1.69 Use unsigned to avoid undefined behavior in pppasyncstart(). Use unsigned to avoid undefined behavior. Found by kUBSan. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $"); d184 1 a184 1 #define ESCAPE_P(c) (sc->sc_asyncmap[(c) >> 5] & (1U << ((c) & 0x1F))) d1015 1 a1015 1 if (paritytab[c >> 5] & (1U << (c & 0x1F))) d1096 1 a1096 1 if (c < 0x20 && (sc->sc_rasyncmap & (1U << c))) @ 1.63.6.1 log @Restore all work from the former pgoyette-localcount branch (which is now abandoned doe to cvs merge botch). The branch now builds, and installs via anita. There are still some problems (cgd is non-functional and all atf tests time-out) but they will get resolved soon. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $"); d99 1 d677 1 a677 1 cdev = cdevsw_lookup_acquire(tp->t_dev); a686 2 if (cdev != NULL) cdevsw_release(cdev); @ 1.62 log @Modularize the ppp driver, and adjust dependencies of the compressor modules. For now, this is still included as a built-in module in GENERIC kernels. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.61 2016/06/20 06:46:37 knakahara Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.61 2016/06/20 06:46:37 knakahara Exp $"); d836 1 a836 2 MFREE(m, m2); m = m2; @ 1.61 log @apply if_output_lock() to L3 callers which call ifp->if_output() of L2(or L3 tunneling). @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.60 2016/06/10 13:27:16 ozaki-r Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.60 2016/06/10 13:27:16 ozaki-r Exp $"); d98 1 a99 2 #ifdef _KERNEL_OPT @ 1.61.2.1 log @Adapt machine-independant code to the new {b,c}devsw reference-counting (using localcount(9)). All callers of {b,c}devsw_lookup() now call {b,c}devsw_lookup_acquire() which retains a reference on the 'struct {b,c}devsw'. This reference must be released by the caller once it is finished with the structure's content (or other data that would disappear if the 'struct {b,c}devsw' were to disappear). @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.61 2016/06/20 06:46:37 knakahara Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.61 2016/06/20 06:46:37 knakahara Exp $"); d678 1 a678 1 cdev = cdevsw_lookup_acquire(tp->t_dev); a687 2 if (cdev != NULL) cdevsw_release(cdev); @ 1.61.2.2 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $ */ d96 3 a98 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.63 2016/10/02 14:17:07 christos Exp $"); d839 2 a840 1 m = m2 = m_free(m); @ 1.60 log @Introduce m_set_rcvif and m_reset_rcvif The API is used to set (or reset) a received interface of a mbuf. They are counterpart of m_get_rcvif, which will come in another commit, hide internal of rcvif operation, and reduce the diff of the upcoming change. No functional change. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.59 2015/08/24 22:21:26 pooka Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.59 2015/08/24 22:21:26 pooka Exp $"); d428 1 a428 1 return ((*sc->sc_if.if_output)(&sc->sc_if, m0, &dst, (struct rtentry *)0)); @ 1.59 log @sprinkle _KERNEL_OPT @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.58 2014/05/22 16:31:19 dholland Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.58 2014/05/22 16:31:19 dholland Exp $"); d399 1 a399 1 m0->m_pkthdr.rcvif = NULL; @ 1.58 log @Use accessor functions for the tty's table of control characters. (at least from outside the core tty sources) Move some xon/xoff code from net/ppp_tty.c to kern/tty.c. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.57 2010/04/05 07:22:24 joerg Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.57 2010/04/05 07:22:24 joerg Exp $"); d100 1 d102 1 @ 1.58.4.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.59 2015/08/24 22:21:26 pooka Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.59 2015/08/24 22:21:26 pooka Exp $"); a99 1 #ifdef _KERNEL_OPT a100 1 #endif @ 1.58.4.2 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.58.4.1 2015/09/22 12:06:10 skrll Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.58.4.1 2015/09/22 12:06:10 skrll Exp $"); d399 1 a399 1 m_reset_rcvif(m0); d428 1 a428 1 return if_output_lock(&sc->sc_if, &sc->sc_if, m0, &dst, (struct rtentry *)0); @ 1.58.4.3 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.58.4.2 2016/07/09 20:25:21 skrll Exp $ */ d96 3 a98 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.58.4.2 2016/07/09 20:25:21 skrll Exp $"); a100 1 #include "ppp.h" d837 2 a838 1 m = m2 = m_free(m); @ 1.57 log @Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf check into the inline functions as well the fourth argument for bpf_attach. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.56 2010/01/19 22:08:01 pooka Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.56 2010/01/19 22:08:01 pooka Exp $"); a980 1 const struct cdevsw *cdev; d982 1 d1003 3 a1005 17 if (tp->t_iflag & IXON) { if (c == tp->t_cc[VSTOP] && tp->t_cc[VSTOP] != _POSIX_VDISABLE) { if ((tp->t_state & TS_TTSTOP) == 0) { tp->t_state |= TS_TTSTOP; cdev = cdevsw_lookup(tp->t_dev); if (cdev != NULL) (*cdev->d_stop)(tp, 0); } return 0; } if (c == tp->t_cc[VSTART] && tp->t_cc[VSTART] != _POSIX_VDISABLE) { tp->t_state &= ~TS_TTSTOP; if (tp->t_oproc != NULL) { mutex_spin_enter(&tty_lock); /* XXX */ (*tp->t_oproc)(tp); mutex_spin_exit(&tty_lock); /* XXX */ } a1006 1 } d1008 1 @ 1.57.18.1 log @Rebase to HEAD as of a few days ago. @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD$"); d981 1 a982 1 int result; d1003 17 a1019 3 result = tty_try_xonxoff(tp, c); if (result == 0) { /* Character was recognized and consumed. */ d1021 1 a1022 1 /* Character wasn't consumed, continue processing it. */ @ 1.57.18.2 log @update from HEAD @ text @a97 1 #ifdef _KERNEL_OPT d99 1 a100 1 #endif d397 1 a397 1 m_reset_rcvif(m0); d426 1 a426 1 return if_output_lock(&sc->sc_if, &sc->sc_if, m0, &dst, (struct rtentry *)0); d835 2 a836 1 m = m2 = m_free(m); @ 1.57.32.1 log @Rebase. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.58 2014/05/22 16:31:19 dholland Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.58 2014/05/22 16:31:19 dholland Exp $"); d981 1 a982 1 int result; d1003 17 a1019 3 result = tty_try_xonxoff(tp, c); if (result == 0) { /* Character was recognized and consumed. */ d1021 1 a1022 1 /* Character wasn't consumed, continue processing it. */ @ 1.56 log @Redefine bpf linkage through an always present op vector, i.e. #if NBPFILTER is no longer required in the client. This change doesn't yet add support for loading bpf as a module, since drivers can register before bpf is attached. However, callers of bpf can now be modularized. Dynamically loadable bpf could probably be done fairly easily with coordination from the stub driver and the real driver by registering attachments in the stub before the real driver is loaded and doing a handoff. ... and I'm not going to ponder the depths of unload here. Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.55 2009/05/07 18:01:57 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.55 2009/05/07 18:01:57 elad Exp $"); d232 1 a232 1 bpf_ops->bpf_change_type(&sc->sc_if, DLT_PPP_SERIAL, PPP_HDRLEN); d297 1 a297 1 bpf_ops->bpf_change_type(&sc->sc_if, DLT_NULL, 0); @ 1.56.4.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.56 2010/01/19 22:08:01 pooka Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.56 2010/01/19 22:08:01 pooka Exp $"); d232 1 a232 1 bpf_change_type(&sc->sc_if, DLT_PPP_SERIAL, PPP_HDRLEN); d297 1 a297 1 bpf_change_type(&sc->sc_if, DLT_NULL, 0); @ 1.56.2.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD$"); d232 1 a232 1 bpf_change_type(&sc->sc_if, DLT_PPP_SERIAL, PPP_HDRLEN); d297 1 a297 1 bpf_change_type(&sc->sc_if, DLT_NULL, 0); @ 1.55 log @Introduce actions/requests to handle authorization for ppp(4), sl(4), strip(4), btuart(4) and bcsp(4) network interfaces and devices. Mailing list reference: http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004955.html @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.54 2009/04/15 20:44:25 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.54 2009/04/15 20:44:25 elad Exp $"); a127 2 #include "bpfilter.h" #if NBPFILTER > 0 || defined(PPP_FILTER) a128 1 #endif a230 1 #if NBPFILTER > 0 d232 1 a232 2 bpf_change_type(&sc->sc_if, DLT_PPP_SERIAL, PPP_HDRLEN); #endif a295 1 #if NBPFILTER > 0 d297 1 a297 2 bpf_change_type(&sc->sc_if, DLT_NULL, 0); #endif @ 1.54 log @Remove a few KAUTH_GENERIC_ISSUSER in favor of more descriptive alternatives. Discussed on tech-kern: http://mail-index.netbsd.org/tech-kern/2009/04/11/msg004798.html Input from ad@@, christos@@, dyoung@@, tsutsui@@. Okay ad@@. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.53 2008/05/25 19:22:21 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.53 2008/05/25 19:22:21 ad Exp $"); d211 3 a213 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, NULL)) != 0) @ 1.53 log @Properly fix the "hanging in tty" bug that was worked around with cv_wakeup() some time again. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.52 2008/02/20 17:05:53 matt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.52 2008/02/20 17:05:53 matt Exp $"); d457 2 a458 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, NULL)) != 0) d468 2 a469 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, NULL)) != 0) d479 2 a480 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, NULL)) != 0) @ 1.53.12.1 log @Sync with HEAD. Commit is split, to avoid a "too many arguments" protocol error. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.55 2009/05/07 18:01:57 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.55 2009/05/07 18:01:57 elad Exp $"); d211 2 a212 3 error = kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE_PPP, KAUTH_REQ_NETWORK_INTERFACE_PPP_ADD, NULL, NULL, NULL); if (error) d457 2 a458 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) d468 2 a469 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) d479 2 a480 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) @ 1.53.6.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.54 2009/04/15 20:44:25 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.54 2009/04/15 20:44:25 elad Exp $"); d457 2 a458 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) d468 2 a469 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) d479 2 a480 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) @ 1.52 log @s/u_\(int[0-9]*_t\)/u\1/g (change u_int*_t to uint*_t) @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.51 2007/11/28 21:44:11 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.51 2007/11/28 21:44:11 ad Exp $"); d355 1 a355 1 error = ttysleep(tp, &tp->t_rawq.c_cv, true, 0); @ 1.52.10.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.52 2008/02/20 17:05:53 matt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.52 2008/02/20 17:05:53 matt Exp $"); d355 1 a355 1 error = ttysleep(tp, &tp->t_rawcv, true, 0); d457 2 a458 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) d468 2 a469 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) d479 2 a480 2 if ((error = kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_PRIVSET, tp)) != 0) @ 1.52.10.2 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.52.10.1 2009/05/04 08:14:15 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.52.10.1 2009/05/04 08:14:15 yamt Exp $"); d211 2 a212 3 error = kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE_PPP, KAUTH_REQ_NETWORK_INTERFACE_PPP_ADD, NULL, NULL, NULL); if (error) @ 1.52.10.3 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.52.10.2 2009/05/16 10:41:49 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.52.10.2 2009/05/16 10:41:49 yamt Exp $"); d128 2 d131 1 d234 1 d236 2 a237 1 bpf_ops->bpf_change_type(&sc->sc_if, DLT_PPP_SERIAL, PPP_HDRLEN); d301 1 d303 2 a304 1 bpf_ops->bpf_change_type(&sc->sc_if, DLT_NULL, 0); @ 1.52.10.4 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.52.10.3 2010/03/11 15:04:27 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.52.10.3 2010/03/11 15:04:27 yamt Exp $"); d232 1 a232 1 bpf_change_type(&sc->sc_if, DLT_PPP_SERIAL, PPP_HDRLEN); d297 1 a297 1 bpf_change_type(&sc->sc_if, DLT_NULL, 0); @ 1.52.12.1 log @Sync w/ -current. 34 merge conflicts to follow. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.52 2008/02/20 17:05:53 matt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.52 2008/02/20 17:05:53 matt Exp $"); d355 1 a355 1 error = ttysleep(tp, &tp->t_rawcv, true, 0); @ 1.52.8.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.52 2008/02/20 17:05:53 matt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.52 2008/02/20 17:05:53 matt Exp $"); d355 1 a355 1 error = ttysleep(tp, &tp->t_rawcv, true, 0); @ 1.52.6.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD$"); d355 1 a355 1 error = ttysleep(tp, &tp->t_rawcv, true, 0); @ 1.51 log @Grab tty_lock in more places. Noted and tested by degroote@@. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.50 2007/11/12 14:20:40 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.50 2007/11/12 14:20:40 ad Exp $"); d159 1 a159 1 static u_int16_t pppfcs(u_int16_t fcs, u_char *cp, int len); d613 1 a613 1 static const u_int16_t fcstab[256] = { d651 2 a652 2 static u_int16_t pppfcs(u_int16_t fcs, u_char *cp, int len) d744 1 a744 1 sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), m->m_len); d847 1 a847 1 sc->sc_outfcs = pppfcs(sc->sc_outfcs, mtod(m, u_char *), m->m_len); @ 1.50 log @Call ttwakeup() with tty_lock held. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.49 2007/11/10 18:29:36 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.49 2007/11/10 18:29:36 ad Exp $"); a707 1 int s; d714 2 d776 1 a776 3 s = spltty(); if (putc(PPP_ESCAPE, &tp->t_outq)) { splx(s); a777 1 } a779 1 splx(s); a781 1 splx(s); a821 1 s = spltty(); a828 1 splx(s); a860 1 s = spltty(); d873 1 a873 1 splx(s); a943 1 int s; d945 1 a945 1 s = spltty(); d948 1 a948 1 splx(s); d1021 2 a1022 1 if (tp->t_oproc != NULL) d1024 2 @ 1.49 log @Call ttyflush() with tty_lock held. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.48 2007/11/07 15:56:22 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.48 2007/11/07 15:56:22 ad Exp $"); a890 1 int s; d893 1 a893 1 s = spltty(); d897 1 a897 1 splx(s); @ 1.48 log @Merge tty changes from the vmlocking branch. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.47 2007/03/04 06:03:17 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.47 2007/03/04 06:03:17 christos Exp $"); d254 1 d256 1 d275 1 d277 1 @ 1.47 log @Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.46 2007/01/04 19:07:03 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.46 2007/01/04 19:07:03 elad Exp $"); a324 1 int s; d333 1 a333 1 s = spltty(); d337 1 a337 1 splx(s); d344 1 a344 1 splx(s); d348 1 a348 1 splx(s); d351 1 a351 1 error = ttysleep(tp, (void *)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0); d353 1 a353 1 splx(s); d363 1 a363 1 splx(s); @ 1.47.22.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.50 2007/11/12 14:20:40 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.50 2007/11/12 14:20:40 ad Exp $"); a253 1 mutex_spin_enter(&tty_lock); a254 1 mutex_spin_exit(&tty_lock); a272 1 mutex_spin_enter(&tty_lock); a273 1 mutex_spin_exit(&tty_lock); /* XXX */ d325 1 d334 1 a334 1 mutex_spin_enter(&tty_lock); d338 1 a338 1 mutex_spin_exit(&tty_lock); d345 1 a345 1 mutex_spin_exit(&tty_lock); d349 1 a349 1 mutex_spin_exit(&tty_lock); d352 1 a352 1 error = ttysleep(tp, &tp->t_rawq.c_cv, true, 0); d354 1 a354 1 mutex_spin_exit(&tty_lock); d364 1 a364 1 mutex_spin_exit(&tty_lock); d888 1 d891 1 a891 1 mutex_spin_enter(&tty_lock); d895 1 a895 1 mutex_spin_exit(&tty_lock); @ 1.47.22.2 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.51 2007/11/28 21:44:11 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.51 2007/11/28 21:44:11 ad Exp $"); d708 1 a714 2 mutex_spin_enter(&tty_lock); d775 3 a777 1 if (putc(PPP_ESCAPE, &tp->t_outq)) d779 1 d782 1 d785 1 d826 1 d834 1 d867 1 d880 1 a880 1 mutex_spin_exit(&tty_lock); d951 1 d953 1 a953 1 mutex_spin_enter(&tty_lock); d956 1 a956 1 mutex_spin_exit(&tty_lock); d1029 1 a1029 2 if (tp->t_oproc != NULL) { mutex_spin_enter(&tty_lock); /* XXX */ a1030 2 mutex_spin_exit(&tty_lock); /* XXX */ } @ 1.47.20.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD$"); a253 1 mutex_spin_enter(&tty_lock); a254 1 mutex_spin_exit(&tty_lock); a272 1 mutex_spin_enter(&tty_lock); a273 1 mutex_spin_exit(&tty_lock); /* XXX */ d325 1 d334 1 a334 1 mutex_spin_enter(&tty_lock); d338 1 a338 1 mutex_spin_exit(&tty_lock); d345 1 a345 1 mutex_spin_exit(&tty_lock); d349 1 a349 1 mutex_spin_exit(&tty_lock); d352 1 a352 1 error = ttysleep(tp, &tp->t_rawq.c_cv, true, 0); d354 1 a354 1 mutex_spin_exit(&tty_lock); d364 1 a364 1 mutex_spin_exit(&tty_lock); d888 1 d891 1 a891 1 mutex_spin_enter(&tty_lock); d895 1 a895 1 mutex_spin_exit(&tty_lock); @ 1.47.14.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.49 2007/11/10 18:29:36 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.49 2007/11/10 18:29:36 ad Exp $"); a253 1 mutex_spin_enter(&tty_lock); a254 1 mutex_spin_exit(&tty_lock); a272 1 mutex_spin_enter(&tty_lock); a273 1 mutex_spin_exit(&tty_lock); /* XXX */ d325 1 d334 1 a334 1 mutex_spin_enter(&tty_lock); d338 1 a338 1 mutex_spin_exit(&tty_lock); d345 1 a345 1 mutex_spin_exit(&tty_lock); d349 1 a349 1 mutex_spin_exit(&tty_lock); d352 1 a352 1 error = ttysleep(tp, &tp->t_rawq.c_cv, true, 0); d354 1 a354 1 mutex_spin_exit(&tty_lock); d364 1 a364 1 mutex_spin_exit(&tty_lock); @ 1.47.14.2 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.47.14.1 2007/11/11 16:48:25 joerg Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.47.14.1 2007/11/11 16:48:25 joerg Exp $"); d891 1 d894 1 a894 1 mutex_spin_enter(&tty_lock); d898 1 a898 1 mutex_spin_exit(&tty_lock); @ 1.47.14.3 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.47.14.2 2007/11/14 19:04:49 joerg Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.47.14.2 2007/11/14 19:04:49 joerg Exp $"); d708 1 a714 2 mutex_spin_enter(&tty_lock); d775 3 a777 1 if (putc(PPP_ESCAPE, &tp->t_outq)) d779 1 d782 1 d785 1 d826 1 d834 1 d867 1 d880 1 a880 1 mutex_spin_exit(&tty_lock); d951 1 d953 1 a953 1 mutex_spin_enter(&tty_lock); d956 1 a956 1 mutex_spin_exit(&tty_lock); d1029 1 a1029 2 if (tp->t_oproc != NULL) { mutex_spin_enter(&tty_lock); /* XXX */ a1030 2 mutex_spin_exit(&tty_lock); /* XXX */ } @ 1.47.16.1 log @sync with -HEAD @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD$"); d325 1 d334 1 a334 1 mutex_spin_enter(&tty_lock); d338 1 a338 1 mutex_spin_exit(&tty_lock); d345 1 a345 1 mutex_spin_exit(&tty_lock); d349 1 a349 1 mutex_spin_exit(&tty_lock); d352 1 a352 1 error = ttysleep(tp, &tp->t_rawq.c_cv, true, 0); d354 1 a354 1 mutex_spin_exit(&tty_lock); d364 1 a364 1 mutex_spin_exit(&tty_lock); @ 1.47.16.2 log @sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.47.16.1 2007/11/08 11:00:13 matt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.47.16.1 2007/11/08 11:00:13 matt Exp $"); a253 1 mutex_spin_enter(&tty_lock); a254 1 mutex_spin_exit(&tty_lock); a272 1 mutex_spin_enter(&tty_lock); a273 1 mutex_spin_exit(&tty_lock); /* XXX */ d704 1 a710 2 mutex_spin_enter(&tty_lock); d771 3 a773 1 if (putc(PPP_ESCAPE, &tp->t_outq)) d775 1 d778 1 d781 1 d822 1 d830 1 d863 1 d876 1 a876 1 mutex_spin_exit(&tty_lock); d887 1 d890 1 a890 1 mutex_spin_enter(&tty_lock); d894 1 a894 1 mutex_spin_exit(&tty_lock); d948 1 d950 1 a950 1 mutex_spin_enter(&tty_lock); d953 1 a953 1 mutex_spin_exit(&tty_lock); d1026 1 a1026 2 if (tp->t_oproc != NULL) { mutex_spin_enter(&tty_lock); /* XXX */ a1027 2 mutex_spin_exit(&tty_lock); /* XXX */ } @ 1.47.16.3 log @sync with HEAD @ text @d1 1 a1 1 /* ppp_tty.c,v 1.47.16.2 2008/01/09 01:57:15 matt Exp */ d96 1 a96 1 __KERNEL_RCSID(0, "ppp_tty.c,v 1.47.16.2 2008/01/09 01:57:15 matt Exp"); d159 1 a159 1 static uint16_t pppfcs(uint16_t fcs, const uint8_t *cp, int len); d613 1 a613 1 static const uint16_t fcstab[256] = { d651 2 a652 2 static uint16_t pppfcs(uint16_t fcs, const uint8_t *cp, int len) d744 1 a744 1 sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, uint8_t *), m->m_len); d847 1 a847 1 sc->sc_outfcs = pppfcs(sc->sc_outfcs, mtod(m, uint8_t *), m->m_len); @ 1.47.2.1 log @Compile fixes. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.47 2007/03/04 06:03:17 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.47 2007/03/04 06:03:17 christos Exp $"); d325 1 d334 1 a334 1 mutex_enter(&tp->t_lock); d338 1 a338 1 mutex_exit(&tp->t_lock); d345 1 a345 1 mutex_exit(&tp->t_lock); d349 1 a349 1 mutex_exit(&tp->t_lock); d352 1 a352 1 error = ttysleep(tp, &tp->t_rawq.c_cv, true, 0); d354 1 a354 1 mutex_exit(&tp->t_lock); d364 1 a364 1 mutex_exit(&tp->t_lock); @ 1.47.2.2 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.47.2.1 2007/04/05 21:57:51 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.47.2.1 2007/04/05 21:57:51 ad Exp $"); d333 1 a333 1 mutex_spin_enter(&tty_lock); d337 1 a337 1 mutex_spin_exit(&tty_lock); d344 1 a344 1 mutex_spin_exit(&tty_lock); d348 1 a348 1 mutex_spin_exit(&tty_lock); d353 1 a353 1 mutex_spin_exit(&tty_lock); d363 1 a363 1 mutex_spin_exit(&tty_lock); @ 1.46 log @Consistent usage of KAUTH_GENERIC_ISSUSER. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.45 2006/11/16 01:33:40 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.45 2006/11/16 01:33:40 christos Exp $"); d140 1 a140 1 static int ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, d253 1 a253 1 tp->t_sc = (caddr_t) sc; d352 1 a352 1 error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0); d439 1 a439 1 ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct lwp *l) d681 1 a681 1 (*cdev->d_ioctl)(tp->t_dev, TIOCXMTFRAME, (caddr_t)&m, @ 1.46.2.1 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.46 2007/01/04 19:07:03 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.46 2007/01/04 19:07:03 elad Exp $"); d140 1 a140 1 static int ppptioctl(struct tty *tp, u_long cmd, void *data, int flag, d253 1 a253 1 tp->t_sc = (void *) sc; d352 1 a352 1 error = ttysleep(tp, (void *)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0); d439 1 a439 1 ppptioctl(struct tty *tp, u_long cmd, void *data, int flag, struct lwp *l) d681 1 a681 1 (*cdev->d_ioctl)(tp->t_dev, TIOCXMTFRAME, (void *)&m, @ 1.45 log @__unused removal on arguments; approved by core. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.44 2006/10/12 01:32:30 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.44 2006/10/12 01:32:30 christos Exp $"); d212 1 a212 1 &l->l_acflag)) != 0) d455 1 a455 1 KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d466 1 a466 1 KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d477 1 a477 1 KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) @ 1.44 log @- sprinkle __unused on function decls. - fix a couple of unused bugs - no more -Wno-unused for i386 @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.43 2006/07/23 22:06:13 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.43 2006/07/23 22:06:13 ad Exp $"); d205 1 a205 1 pppopen(dev_t dev __unused, struct tty *tp) d267 1 a267 1 pppclose(struct tty *tp, int flag __unused) d377 1 a377 1 pppwrite(struct tty *tp, struct uio *uio, int flag __unused) @ 1.43 log @Use the LWP cached credentials where sane. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.42 2006/05/14 21:19:33 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.42 2006/05/14 21:19:33 elad Exp $"); d205 1 a205 1 pppopen(dev_t dev, struct tty *tp) d267 1 a267 1 pppclose(struct tty *tp, int flag) d377 1 a377 1 pppwrite(struct tty *tp, struct uio *uio, int flag) @ 1.43.4.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.45 2006/11/16 01:33:40 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.45 2006/11/16 01:33:40 christos Exp $"); @ 1.43.4.2 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.46 2007/01/04 19:07:03 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.46 2007/01/04 19:07:03 elad Exp $"); d212 1 a212 1 NULL)) != 0) d455 1 a455 1 KAUTH_GENERIC_ISSUSER, NULL)) != 0) d466 1 a466 1 KAUTH_GENERIC_ISSUSER, NULL)) != 0) d477 1 a477 1 KAUTH_GENERIC_ISSUSER, NULL)) != 0) @ 1.43.6.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.43 2006/07/23 22:06:13 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.43 2006/07/23 22:06:13 ad Exp $"); d205 1 a205 1 pppopen(dev_t dev __unused, struct tty *tp) d267 1 a267 1 pppclose(struct tty *tp, int flag __unused) d377 1 a377 1 pppwrite(struct tty *tp, struct uio *uio, int flag __unused) @ 1.43.6.2 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.43.6.1 2006/10/22 06:07:25 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.43.6.1 2006/10/22 06:07:25 yamt Exp $"); d205 1 a205 1 pppopen(dev_t dev, struct tty *tp) d267 1 a267 1 pppclose(struct tty *tp, int flag) d377 1 a377 1 pppwrite(struct tty *tp, struct uio *uio, int flag) @ 1.42 log @integrate kauth. @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD$"); d207 1 a207 1 struct proc *p = curproc; /* XXX */ d211 2 a212 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d225 1 a225 1 if ((sc = pppalloc(p->p_pid)) == NULL) { a442 1 struct proc *p = l->l_proc; d454 2 a455 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d465 2 a466 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d476 2 a477 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d492 1 a492 1 error = pppioctl(sc, cmd, data, flag, p); @ 1.41 log @ANSI function decls and application of static. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.40 2005/12/11 12:24:51 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.40 2005/12/11 12:24:51 christos Exp $"); d116 1 d211 1 a211 1 if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) d454 1 a454 1 if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) d464 1 a464 1 if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) d474 1 a474 1 if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) @ 1.41.4.1 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.43 2006/07/23 22:06:13 ad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.43 2006/07/23 22:06:13 ad Exp $"); a115 1 #include d206 1 a206 1 struct lwp *l = curlwp; /* XXX */ d210 1 a210 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d223 1 a223 1 if ((sc = pppalloc(l->l_proc->p_pid)) == NULL) { d441 1 d453 1 a453 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d463 1 a463 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d473 1 a473 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d488 1 a488 1 error = pppioctl(sc, cmd, data, flag, l); @ 1.41.6.1 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.41 2005/12/11 23:05:25 thorpej Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.41 2005/12/11 23:05:25 thorpej Exp $"); a115 1 #include d210 1 a210 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d453 1 a453 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d463 1 a463 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d473 1 a473 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) @ 1.41.12.1 log @Merge 2006-05-24 NetBSD-current into the "peter-altq" branch. @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD$"); a115 1 #include d210 1 a210 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d453 1 a453 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d463 1 a463 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d473 1 a473 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) @ 1.41.8.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.41 2005/12/11 23:05:25 thorpej Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.41 2005/12/11 23:05:25 thorpej Exp $"); a115 1 #include d210 1 a210 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d453 1 a453 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d463 1 a463 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d473 1 a473 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) @ 1.41.8.2 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.41.8.1 2006/05/24 10:58:56 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.41.8.1 2006/05/24 10:58:56 yamt Exp $"); d207 1 a207 1 struct lwp *l = curlwp; /* XXX */ d211 1 a211 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d224 1 a224 1 if ((sc = pppalloc(l->l_proc->p_pid)) == NULL) { d442 1 d454 1 a454 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d464 1 a464 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d474 1 a474 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d489 1 a489 1 error = pppioctl(sc, cmd, data, flag, l); @ 1.41.10.1 log @Adapt to kernel authorization KPI. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.41 2005/12/11 23:05:25 thorpej Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.41 2005/12/11 23:05:25 thorpej Exp $"); d210 1 a210 1 if ((error = generic_authorize(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d453 1 a453 1 if ((error = generic_authorize(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d463 1 a463 1 if ((error = generic_authorize(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d473 1 a473 1 if ((error = generic_authorize(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) @ 1.41.10.2 log @generic_authorize() -> kauth_authorize_generic(). @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.41.10.1 2006/03/08 01:11:55 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.41.10.1 2006/03/08 01:11:55 elad Exp $"); d210 1 a210 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d453 1 a453 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d463 1 a463 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d473 1 a473 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) @ 1.41.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: ppp_tty.c,v 1.41.10.2 2006/03/10 15:05:23 elad Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.41.10.2 2006/03/10 15:05:23 elad Exp $"); a115 1 #include @ 1.40 log @merge ktrace-lwp. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.39 2005/11/27 05:35:52 thorpej Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.39 2005/11/27 05:35:52 thorpej Exp $"); d135 8 a142 8 int pppopen __P((dev_t dev, struct tty *tp)); int pppclose __P((struct tty *tp, int flag)); int pppread __P((struct tty *tp, struct uio *uio, int flag)); int pppwrite __P((struct tty *tp, struct uio *uio, int flag)); int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data, int flag, struct lwp *)); int pppinput __P((int c, struct tty *tp)); int pppstart __P((struct tty *tp)); d144 1 a144 1 struct linesw ppp_disc = { d157 11 a167 12 static void ppprcvframe __P((struct ppp_softc *sc, struct mbuf *m)); static u_int16_t pppfcs __P((u_int16_t fcs, u_char *cp, int len)); static void pppsyncstart __P((struct ppp_softc *sc)); static void pppasyncstart __P((struct ppp_softc *)); static void pppasyncctlp __P((struct ppp_softc *)); static void pppasyncrelinq __P((struct ppp_softc *)); static void ppp_timeout __P((void *)); static void pppgetm __P((struct ppp_softc *sc)); static void pppdumpb __P((u_char *b, int l)); static void ppplogchar __P((struct ppp_softc *, int)); static void pppdumpframe __P((struct ppp_softc *sc, struct mbuf* m, int xmit)); d203 2 a204 4 int pppopen(dev, tp) dev_t dev; struct tty *tp; d264 2 a265 4 int pppclose(tp, flag) struct tty *tp; int flag; d290 1 a290 2 pppasyncrelinq(sc) struct ppp_softc *sc; d318 2 a319 5 int pppread(tp, uio, flag) struct tty *tp; struct uio *uio; int flag; d374 2 a375 5 int pppwrite(tp, uio, flag) struct tty *tp; struct uio *uio; int flag; d436 2 a437 7 int ppptioctl(tp, cmd, data, flag, l) struct tty *tp; u_long cmd; caddr_t data; int flag; struct lwp *l; d500 1 a500 3 ppprcvframe(sc, m) struct ppp_softc *sc; struct mbuf *m; d645 1 a645 4 pppfcs(fcs, cp, len) u_int16_t fcs; u_char *cp; int len; d656 1 a656 2 pppsyncstart(sc) struct ppp_softc *sc; d693 1 a693 2 pppasyncstart(sc) struct ppp_softc *sc; d881 1 a881 2 pppasyncctlp(sc) struct ppp_softc *sc; d900 2 a901 3 int pppstart(tp) struct tty *tp; d941 1 a941 2 ppp_timeout(x) void *x; d957 1 a957 2 pppgetm(sc) struct ppp_softc *sc; d984 2 a985 4 int pppinput(c, tp) int c; struct tty *tp; d1231 1 a1231 3 ppplogchar(sc, c) struct ppp_softc *sc; int c; d1251 1 a1251 3 pppdumpb(b, l) u_char *b; int l; d1271 1 a1271 4 pppdumpframe(sc, m, xmit) struct ppp_softc *sc; struct mbuf* m; int xmit; @ 1.39 log @Overhaul how TTY line disciplines are handled: - Replace references to linesw[0] with a ttyldisc_default() function that returns the default ("termios") line discipline. - The linesw[] array is gone, replaced by a linked list. - ttyldisc_add() and ttyldisc_remove() have been replaced by ttyldisc_attach() and ttyldisc_detach(). - Things that provide line disciplines are now responsible for registering those disciplines with the system. The linesw structures are no longer declared in tty_conf.c - Line disciplines are now refcounted; a lookup causes a reference to be held. ttyldisc_release() releases the reference. Attempts to detach an in-use line discipline result in EBUSY. - Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c that was masked by the old tty_conf.c - tty_init() is no longer necessary; delete it and its call from main(). @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38 2005/06/11 22:26:42 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38 2005/06/11 22:26:42 christos Exp $"); d140 1 a140 1 struct proc *)); d449 1 a449 1 ppptioctl(tp, cmd, data, flag, p) d454 1 a454 1 struct proc *p; d458 1 @ 1.38 log @30393/Miles Nordin: PF/ALTQ does not work on ppp(4) interfaces This is because the mbuf chain created did not have a header. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.37 2005/05/29 21:22:53 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.37 2005/05/29 21:22:53 christos Exp $"); d144 13 d218 1 a218 1 if (tp->t_linesw->l_no == PPPDISC) { d277 2 a278 1 tp->t_linesw = linesw[0]; /* default line discipline */ d344 1 a344 1 tp->t_linesw->l_no != PPPDISC) { d396 1 a396 1 if (tp->t_linesw->l_no != PPPDISC) @ 1.38.2.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38 2005/06/11 22:26:42 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38 2005/06/11 22:26:42 christos Exp $"); a115 1 #include d135 21 a155 33 static int pppopen(dev_t dev, struct tty *tp); static int pppclose(struct tty *tp, int flag); static int pppread(struct tty *tp, struct uio *uio, int flag); static int pppwrite(struct tty *tp, struct uio *uio, int flag); static int ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct lwp *); static int pppinput(int c, struct tty *tp); static int pppstart(struct tty *tp); struct linesw ppp_disc = { /* XXX should be static */ .l_name = "ppp", .l_open = pppopen, .l_close = pppclose, .l_read = pppread, .l_write = pppwrite, .l_ioctl = ppptioctl, .l_rint = pppinput, .l_start = pppstart, .l_modem = ttymodem, .l_poll = ttpoll }; static void ppprcvframe(struct ppp_softc *sc, struct mbuf *m); static u_int16_t pppfcs(u_int16_t fcs, u_char *cp, int len); static void pppsyncstart(struct ppp_softc *sc); static void pppasyncstart(struct ppp_softc *); static void pppasyncctlp(struct ppp_softc *); static void pppasyncrelinq(struct ppp_softc *); static void ppp_timeout(void *); static void pppgetm(struct ppp_softc *sc); static void pppdumpb(u_char *b, int l); static void ppplogchar(struct ppp_softc *, int); static void pppdumpframe(struct ppp_softc *sc, struct mbuf* m, int xmit); d191 4 a194 2 static int pppopen(dev_t dev, struct tty *tp) d200 1 a200 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d205 1 a205 1 if (tp->t_linesw == &ppp_disc) { d254 4 a257 2 static int pppclose(struct tty *tp, int flag) d264 1 a264 2 ttyldisc_release(tp->t_linesw); tp->t_linesw = ttyldisc_default(); d281 2 a282 1 pppasyncrelinq(struct ppp_softc *sc) d310 5 a314 2 static int pppread(struct tty *tp, struct uio *uio, int flag) d330 1 a330 1 tp->t_linesw != &ppp_disc) { d369 5 a373 2 static int pppwrite(struct tty *tp, struct uio *uio, int flag) d382 1 a382 1 if (tp->t_linesw != &ppp_disc) d434 7 a440 2 static int ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct lwp *l) a443 1 struct proc *p = l->l_proc; d455 1 a455 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d465 1 a465 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d475 1 a475 1 if ((error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER, &p->p_acflag)) != 0) d502 3 a504 1 ppprcvframe(struct ppp_softc *sc, struct mbuf *m) d649 4 a652 1 pppfcs(u_int16_t fcs, u_char *cp, int len) d663 2 a664 1 pppsyncstart(struct ppp_softc *sc) d701 2 a702 1 pppasyncstart(struct ppp_softc *sc) d890 2 a891 1 pppasyncctlp(struct ppp_softc *sc) d910 3 a912 2 static int pppstart(struct tty *tp) d952 2 a953 1 ppp_timeout(void *x) d969 2 a970 1 pppgetm(struct ppp_softc *sc) d997 4 a1000 2 static int pppinput(int c, struct tty *tp) d1246 3 a1248 1 ppplogchar(struct ppp_softc *sc, int c) d1268 3 a1270 1 pppdumpb(u_char *b, int l) d1290 4 a1293 1 pppdumpframe(struct ppp_softc *sc, struct mbuf *m, int xmit) @ 1.38.2.2 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38.2.1 2006/06/21 15:10:27 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38.2.1 2006/06/21 15:10:27 yamt Exp $"); d207 1 a207 1 struct lwp *l = curlwp; /* XXX */ d211 1 a211 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d224 1 a224 1 if ((sc = pppalloc(l->l_proc->p_pid)) == NULL) { d442 1 d454 1 a454 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d464 1 a464 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d474 1 a474 2 if ((error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, &l->l_acflag)) != 0) d489 1 a489 1 error = pppioctl(sc, cmd, data, flag, l); @ 1.38.2.3 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38.2.2 2006/12/30 20:50:20 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38.2.2 2006/12/30 20:50:20 yamt Exp $"); d212 1 a212 1 NULL)) != 0) d455 1 a455 1 KAUTH_GENERIC_ISSUSER, NULL)) != 0) d466 1 a466 1 KAUTH_GENERIC_ISSUSER, NULL)) != 0) d477 1 a477 1 KAUTH_GENERIC_ISSUSER, NULL)) != 0) @ 1.38.2.4 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38.2.3 2007/02/26 09:11:36 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38.2.3 2007/02/26 09:11:36 yamt Exp $"); d140 1 a140 1 static int ppptioctl(struct tty *tp, u_long cmd, void *data, int flag, d253 1 a253 1 tp->t_sc = (void *) sc; d352 1 a352 1 error = ttysleep(tp, (void *)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0); d439 1 a439 1 ppptioctl(struct tty *tp, u_long cmd, void *data, int flag, struct lwp *l) d681 1 a681 1 (*cdev->d_ioctl)(tp->t_dev, TIOCXMTFRAME, (void *)&m, @ 1.38.2.5 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38.2.4 2007/09/03 14:42:23 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38.2.4 2007/09/03 14:42:23 yamt Exp $"); a253 1 mutex_spin_enter(&tty_lock); a254 1 mutex_spin_exit(&tty_lock); a272 1 mutex_spin_enter(&tty_lock); a273 1 mutex_spin_exit(&tty_lock); /* XXX */ d325 1 d334 1 a334 1 mutex_spin_enter(&tty_lock); d338 1 a338 1 mutex_spin_exit(&tty_lock); d345 1 a345 1 mutex_spin_exit(&tty_lock); d349 1 a349 1 mutex_spin_exit(&tty_lock); d352 1 a352 1 error = ttysleep(tp, &tp->t_rawq.c_cv, true, 0); d354 1 a354 1 mutex_spin_exit(&tty_lock); d364 1 a364 1 mutex_spin_exit(&tty_lock); d888 1 d891 1 a891 1 mutex_spin_enter(&tty_lock); d895 1 a895 1 mutex_spin_exit(&tty_lock); @ 1.38.2.6 log @sync with head @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38.2.5 2007/11/15 11:45:03 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38.2.5 2007/11/15 11:45:03 yamt Exp $"); d708 1 a714 2 mutex_spin_enter(&tty_lock); d775 3 a777 1 if (putc(PPP_ESCAPE, &tp->t_outq)) d779 1 d782 1 d785 1 d826 1 d834 1 d867 1 d880 1 a880 1 mutex_spin_exit(&tty_lock); d951 1 d953 1 a953 1 mutex_spin_enter(&tty_lock); d956 1 a956 1 mutex_spin_exit(&tty_lock); d1029 1 a1029 2 if (tp->t_oproc != NULL) { mutex_spin_enter(&tty_lock); /* XXX */ a1030 2 mutex_spin_exit(&tty_lock); /* XXX */ } @ 1.38.2.7 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38.2.6 2007/12/07 17:34:19 yamt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38.2.6 2007/12/07 17:34:19 yamt Exp $"); d159 1 a159 1 static uint16_t pppfcs(uint16_t fcs, const uint8_t *cp, int len); d613 1 a613 1 static const uint16_t fcstab[256] = { d651 2 a652 2 static uint16_t pppfcs(uint16_t fcs, const uint8_t *cp, int len) d744 1 a744 1 sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, uint8_t *), m->m_len); d847 1 a847 1 sc->sc_outfcs = pppfcs(sc->sc_outfcs, mtod(m, uint8_t *), m->m_len); @ 1.38.8.1 log @sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.38 2005/06/11 22:26:42 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.38 2005/06/11 22:26:42 christos Exp $"); a143 13 struct linesw ppp_disc = { .l_name = "ppp", .l_open = pppopen, .l_close = pppclose, .l_read = pppread, .l_write = pppwrite, .l_ioctl = ppptioctl, .l_rint = pppinput, .l_start = pppstart, .l_modem = ttymodem, .l_poll = ttpoll }; d205 1 a205 1 if (tp->t_linesw == &ppp_disc) { d264 1 a264 2 ttyldisc_release(tp->t_linesw); tp->t_linesw = ttyldisc_default(); d330 1 a330 1 tp->t_linesw != &ppp_disc) { d382 1 a382 1 if (tp->t_linesw != &ppp_disc) @ 1.37 log @- sprinkle const - remove unneeded casts - use more mem*() instead of b*() funcs. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.36 2005/05/17 04:14:58 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.36 2005/05/17 04:14:58 christos Exp $"); d376 1 a376 1 struct mbuf *m, *m0, **mp; d389 13 a401 9 for (mp = &m0; uio->uio_resid; mp = &m->m_next) { m = m_get(M_WAIT, MT_DATA); if ((*mp = m) == NULL) { m_freem(m0); return (ENOBUFS); } m->m_len = 0; if (uio->uio_resid >= MCLBYTES / 2) MCLGET(m, M_DONTWAIT); d410 11 d424 1 a424 2 m0->m_data += PPP_HDRLEN; m0->m_len -= PPP_HDRLEN; @ 1.36 log @Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to implement, xtoa(), but I think defining the samestring 50 times is a bit too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it... @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.35 2005/02/26 22:45:09 perry Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.35 2005/02/26 22:45:09 perry Exp $"); d1258 2 a1259 2 char buf[3*MAX_DUMP_BYTES+4]; char *bp = buf; d1262 1 a1262 1 if (bp >= buf + sizeof(buf) - 3) { d1272 1 a1272 1 printf("%s\n", buf); @ 1.35 log @nuke trailing whitespace @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.34 2003/09/01 16:51:27 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.34 2003/09/01 16:51:27 christos Exp $"); a1259 1 static char digits[] = "0123456789abcdef"; d1266 2 a1267 2 *bp++ = digits[*b >> 4]; /* convert byte to ascii hex */ *bp++ = digits[*b++ & 0xf]; @ 1.34 log @Add a new ioctl PPPIOCGRAWIN to get the last characters we got from the remote site. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.33 2003/02/26 06:31:13 matt Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.33 2003/02/26 06:31:13 matt Exp $"); d439 1 a439 1 d496 1 a496 1 d503 1 a503 1 d511 1 a511 1 d513 1 a513 1 d523 1 a523 1 M_PREPEND(m,2,M_DONTWAIT); d538 1 a538 1 M_PREPEND(m,1,M_DONTWAIT); d546 2 a547 2 } d555 1 a555 1 d562 1 a562 1 d570 1 a570 1 d579 1 a579 1 d581 1 a581 1 d584 1 a584 1 d588 1 a588 1 bail: d656 1 a656 1 d667 1 a667 1 d702 1 a702 1 d1047 1 a1047 1 if ((sc->sc_flags & SC_LOG_RAWIN) && sc->sc_rawin.count > 0) d1285 1 a1285 1 d1288 1 a1288 1 d1306 1 a1306 1 /* output line (hex 1st, then ascii) */ d1314 1 a1314 1 printf("%c",(lbuf[i] >= 040 && @ 1.34.8.1 log @sync with -current @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.35 2005/02/26 22:45:09 perry Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.35 2005/02/26 22:45:09 perry Exp $"); d439 1 a439 1 d496 1 a496 1 d503 1 a503 1 d511 1 a511 1 d513 1 a513 1 d523 1 a523 1 M_PREPEND(m,2,M_DONTWAIT); d538 1 a538 1 M_PREPEND(m,1,M_DONTWAIT); d546 2 a547 2 } d555 1 a555 1 d562 1 a562 1 d570 1 a570 1 d579 1 a579 1 d581 1 a581 1 d584 1 a584 1 d588 1 a588 1 bail: d656 1 a656 1 d667 1 a667 1 d702 1 a702 1 d1047 1 a1047 1 if ((sc->sc_flags & SC_LOG_RAWIN) && sc->sc_rawin.count > 0) d1285 1 a1285 1 d1288 1 a1288 1 d1306 1 a1306 1 /* output line (hex 1st, then ascii) */ d1314 1 a1314 1 printf("%c",(lbuf[i] >= 040 && @ 1.34.10.1 log @sync with head. xen and whitespace. xen part is not finished. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.34 2003/09/01 16:51:27 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.34 2003/09/01 16:51:27 christos Exp $"); d439 1 a439 1 d496 1 a496 1 d503 1 a503 1 d511 1 a511 1 d513 1 a513 1 d523 1 a523 1 M_PREPEND(m,2,M_DONTWAIT); d538 1 a538 1 M_PREPEND(m,1,M_DONTWAIT); d546 2 a547 2 } d555 1 a555 1 d562 1 a562 1 d570 1 a570 1 d579 1 a579 1 d581 1 a581 1 d584 1 a584 1 d588 1 a588 1 bail: d656 1 a656 1 d667 1 a667 1 d702 1 a702 1 d1047 1 a1047 1 if ((sc->sc_flags & SC_LOG_RAWIN) && sc->sc_rawin.count > 0) d1285 1 a1285 1 d1288 1 a1288 1 d1306 1 a1306 1 /* output line (hex 1st, then ascii) */ d1314 1 a1314 1 printf("%c",(lbuf[i] >= 040 && @ 1.33 log @Add MBUFTRACE kernel option. Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *) to m_get*(M_WAIT, *). These are not performance critical and making them call m_get saves considerable space. Add m_clget analogue of MCLGET and make corresponding change for M_WAIT uses. Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE. Begin to change netstat to use sysctl. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.32 2002/09/06 13:24:03 gehenna Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.32 2002/09/06 13:24:03 gehenna Exp $"); d1041 1 a1041 2 if (sc->sc_flags & SC_LOG_RAWIN) ppplogchar(sc, c); d1047 1 a1047 1 if (sc->sc_rawin_count > 0) d1236 14 a1249 7 if (c >= 0) sc->sc_rawin[sc->sc_rawin_count++] = c; if (sc->sc_rawin_count >= sizeof(sc->sc_rawin) || (c < 0 && sc->sc_rawin_count > 0)) { printf("%s input: ", sc->sc_if.if_xname); pppdumpb(sc->sc_rawin, sc->sc_rawin_count); sc->sc_rawin_count = 0; @ 1.33.2.1 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.34 2003/09/01 16:51:27 christos Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.34 2003/09/01 16:51:27 christos Exp $"); d1041 2 a1042 1 ppplogchar(sc, c); d1048 1 a1048 1 if ((sc->sc_flags & SC_LOG_RAWIN) && sc->sc_rawin.count > 0) d1237 7 a1243 14 if (c >= 0) { sc->sc_rawin.buf[sc->sc_rawin_start++] = c; if (sc->sc_rawin.count < sizeof(sc->sc_rawin.buf)) sc->sc_rawin.count++; } if (sc->sc_rawin_start >= sizeof(sc->sc_rawin.buf) || (c < 0 && sc->sc_rawin_start > 0)) { if (sc->sc_flags & (SC_LOG_FLUSH|SC_LOG_RAWIN)) { printf("%s input: ", sc->sc_if.if_xname); pppdumpb(sc->sc_rawin.buf, sc->sc_rawin_start); } if (c < 0) sc->sc_rawin.count = 0; sc->sc_rawin_start = 0; @ 1.33.2.2 log @Sync with HEAD. @ text @@ 1.33.2.3 log @Fix the sync with head I botched. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.33.2.1 2004/08/03 10:54:19 skrll Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.33.2.1 2004/08/03 10:54:19 skrll Exp $"); @ 1.33.2.4 log @Sync with HEAD. Hi Perry! @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.33.2.3 2004/09/21 13:36:42 skrll Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.33.2.3 2004/09/21 13:36:42 skrll Exp $"); d439 1 a439 1 d496 1 a496 1 d503 1 a503 1 d511 1 a511 1 d513 1 a513 1 d523 1 a523 1 M_PREPEND(m,2,M_DONTWAIT); d538 1 a538 1 M_PREPEND(m,1,M_DONTWAIT); d546 2 a547 2 } d555 1 a555 1 d562 1 a562 1 d570 1 a570 1 d579 1 a579 1 d581 1 a581 1 d584 1 a584 1 d588 1 a588 1 bail: d656 1 a656 1 d667 1 a667 1 d702 1 a702 1 d1047 1 a1047 1 if ((sc->sc_flags & SC_LOG_RAWIN) && sc->sc_rawin.count > 0) d1285 1 a1285 1 d1288 1 a1288 1 d1306 1 a1306 1 /* output line (hex 1st, then ascii) */ d1314 1 a1314 1 printf("%c",(lbuf[i] >= 040 && @ 1.33.2.5 log @Sync with HEAD. Here we go again... @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.33.2.4 2005/03/04 16:53:00 skrll Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.33.2.4 2005/03/04 16:53:00 skrll Exp $"); d376 1 a376 1 struct mbuf *m, *m0; d389 9 a397 13 MGETHDR(m0, M_WAIT, MT_DATA); if (m0 == NULL) return ENOBUFS; m0->m_len = 0; m0->m_pkthdr.len = uio->uio_resid; m0->m_pkthdr.rcvif = NULL; if (uio->uio_resid >= MCLBYTES / 2) MCLGET(m0, M_DONTWAIT); for (m = m0; uio->uio_resid;) { a405 11 if (uio->uio_resid == 0) break; MGET(m->m_next, M_WAIT, MT_DATA); if (m->m_next == NULL) { m_freem(m0); return ENOBUFS; } m = m->m_next; m->m_len = 0; d409 2 a410 1 m_adj(m0, PPP_HDRLEN); d1258 3 a1260 2 char bf[3*MAX_DUMP_BYTES+4]; char *bp = bf; d1263 1 a1263 1 if (bp >= bf + sizeof(bf) - 3) { d1267 2 a1268 2 *bp++ = hexdigits[*b >> 4]; /* convert byte to ascii hex */ *bp++ = hexdigits[*b++ & 0xf]; d1273 1 a1273 1 printf("%s\n", bf); @ 1.33.2.6 log @Sync with head. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.39 2005/11/27 05:35:52 thorpej Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.39 2005/11/27 05:35:52 thorpej Exp $"); d140 1 a140 1 struct lwp *)); a143 13 struct linesw ppp_disc = { .l_name = "ppp", .l_open = pppopen, .l_close = pppclose, .l_read = pppread, .l_write = pppwrite, .l_ioctl = ppptioctl, .l_rint = pppinput, .l_start = pppstart, .l_modem = ttymodem, .l_poll = ttpoll }; d205 1 a205 1 if (tp->t_linesw == &ppp_disc) { d264 1 a264 2 ttyldisc_release(tp->t_linesw); tp->t_linesw = ttyldisc_default(); d330 1 a330 1 tp->t_linesw != &ppp_disc) { d382 1 a382 1 if (tp->t_linesw != &ppp_disc) d435 1 a435 1 ppptioctl(tp, cmd, data, flag, l) d440 1 a440 1 struct lwp *l; a443 1 struct proc *p = l->l_proc; @ 1.32 log @Merge the gehenna-devsw branch into the trunk. This merge changes the device switch tables from static array to dynamically generated by config(8). - All device switches is defined as a constant structure in device drivers. - The new grammer ``device-major'' is introduced to ``files''. device-major char [block ] [] - All device major numbers must be listed up in port dependent majors. by using this grammer. - Added the new naming convention. The name of the device switch must be _[bc]devsw for auto-generation of device switch tables. - The backward compatibility of loading block/character device switch by LKM framework is broken. This is necessary to convert from block/character device major to device name in runtime and vice versa. - The restriction to assign device major by LKM is completely removed. We don't need to reserve LKM entries for dynamic loading of device switch. - In compile time, device major numbers list is packed into the kernel and the LKM framework will refer it to assign device major number dynamically. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.31 2002/07/01 22:09:35 itojun Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.31 2002/07/01 22:09:35 itojun Exp $"); d390 1 a390 1 MGET(m, M_WAIT, MT_DATA); @ 1.31 log @new copyright boilerplate from CMU. from openbsd @ text @d1 1 a1 1 /* $NetBSD$ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.30 2002/03/17 19:41:11 atatat Exp $"); d654 1 d669 4 a672 2 if ((*cdevsw[major(tp->t_dev)].d_ioctl) (tp->t_dev, TIOCXMTFRAME, (caddr_t)&m, 0, 0)) { d990 1 d1016 3 a1018 1 (*cdevsw[major(tp->t_dev)].d_stop)(tp, 0); @ 1.30 log @Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for indicating an unhandled "command". ERESTART is -1, which can lead to confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been placed at -4. No ioctl code should now return -1 anywhere. The ioctl() system call is now properly restartable. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.29 2002/03/05 04:13:01 itojun Exp $ */ d8 1 a8 14 * Copyright (c) 1989 Carnegie Mellon University. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by Carnegie Mellon University. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. d10 35 a44 6 * Drew D. Perkins * Carnegie Mellon University * 4910 Forbes Ave. * Pittsburgh, PA 15213 * (412) 268-8576 * ddp@@andrew.cmu.edu d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.29 2002/03/05 04:13:01 itojun Exp $"); @ 1.30.4.1 log @Add the character device switch. Replace the direct-access to devsw table with calling devsw APIs. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.30 2002/03/17 19:41:11 atatat Exp $ */ d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.30 2002/03/17 19:41:11 atatat Exp $"); a637 1 const struct cdevsw *cdev; d652 2 a653 4 cdev = cdevsw_lookup(tp->t_dev); if (cdev == NULL || (*cdev->d_ioctl)(tp->t_dev, TIOCXMTFRAME, (caddr_t)&m, 0, 0)) { a970 1 const struct cdevsw *cdev; d996 1 a996 3 cdev = cdevsw_lookup(tp->t_dev); if (cdev != NULL) (*cdev->d_stop)(tp, 0); @ 1.30.4.2 log @catch up with -current. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.31 2002/07/01 22:09:35 itojun Exp $ */ d8 14 a21 1 * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. d23 6 a28 35 * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The name "Carnegie Mellon University" must not be used to * endorse or promote products derived from this software without * prior written permission. For permission or any legal * details, please contact * Office of Technology Transfer * Carnegie Mellon University * 5000 Forbes Avenue * Pittsburgh, PA 15213-3890 * (412) 268-4387, fax: (412) 268-7395 * tech-transfer@@andrew.cmu.edu * * 4. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by Computing Services * at Carnegie Mellon University (http://www.cmu.edu/computing/)." * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.31 2002/07/01 22:09:35 itojun Exp $"); @ 1.29 log @bring in latest ALTQ from kjc. ALTQify some of the drivers. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.28 2001/11/13 00:49:36 lukem Exp $ */ d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.28 2001/11/13 00:49:36 lukem Exp $"); d416 1 a416 1 return -1; @ 1.28 log @remove unnecessary #if NFOO > 0 .... #endif wrappers @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.27 2001/11/12 23:49:47 lukem Exp $ */ d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.27 2001/11/12 23:49:47 lukem Exp $"); d898 9 @ 1.27 log @add RCSIDs @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.26 2001/07/18 16:43:10 thorpej Exp $ */ d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD$"); a82 1 #if NPPP > 0 a1281 2 #endif /* NPPP > 0 */ @ 1.26 log @bzero -> memset @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.25 2001/06/14 05:44:25 itojun Exp $ */ d78 3 @ 1.26.2.1 log @Commit my "devvp" changes to the thorpej-devvp branch. This replaces the use of dev_t in most places with a struct vnode *. This will form the basic infrastructure for real cloning device support (besides being architecurally cleaner -- it'll be good to get away from using numbers to represent objects). @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.26 2001/07/18 16:43:10 thorpej Exp $ */ a98 2 #include d117 1 a117 1 int pppopen __P((struct vnode *devvp, struct tty *tp)); d174 2 a175 2 pppopen(devvp, tp) struct vnode *devvp; d650 2 a651 2 if ((*cdevsw[major(tp->t_devvp->v_rdev)].d_ioctl) (tp->t_devvp, TIOCXMTFRAME, (caddr_t)&m, 0, 0)) { d985 1 a985 1 (*cdevsw[major(tp->t_devvp->v_rdev)].d_stop)(tp, 0); @ 1.26.2.2 log @Revert the t_dev -> t_devvp change in struct tty. The way that tty structs are currently used (especially by console ttys) aren't ready for it, and this will require quite a few changes. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.26.2.1 2001/09/07 04:45:42 thorpej Exp $ */ a182 1 dev_t dev; a186 2 dev = vdev_rdev(devvp); a216 1 sc->sc_devvp = devvp; a255 1 vrele(sc->sc_devvp); d636 1 d652 2 a653 2 if (VOP_IOCTL(sc->sc_devvp, TIOCXMTFRAME, (caddr_t)&m, 0, NOCRED, curproc) != 0) { d987 1 a987 1 (*cdevsw[major(tp->t_dev)].d_stop)(tp, 0); @ 1.25 log @change the meaning of ifnet.if_lastchange to meet RFC1573 ifLastChange. follows BSD/OS practice and ucd-snmp code (FreeBSD does it for specific interfaces only). was: if_lastchange get updated on every packet transmission/receipt. now: if_lastchange get updated when IFF_UP is changed. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.24 2001/03/31 00:35:24 enami Exp $ */ d210 1 a210 1 bzero(sc->sc_asyncmap, sizeof(sc->sc_asyncmap)); @ 1.25.2.1 log @update to -current @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.26 2001/07/18 16:43:10 thorpej Exp $ */ d210 1 a210 1 memset(sc->sc_asyncmap, 0, sizeof(sc->sc_asyncmap)); @ 1.25.2.2 log @Sync kqueue branch with -current. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.25.2.1 2001/08/03 04:13:52 lukem Exp $ */ a78 3 #include __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.28 2001/11/13 00:49:36 lukem Exp $"); d80 1 d1280 2 @ 1.25.2.3 log @Catch up with -current. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.25.2.2 2002/01/10 20:02:19 thorpej Exp $ */ d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.25.2.2 2002/01/10 20:02:19 thorpej Exp $"); a897 9 #ifdef ALTQ /* * if ALTQ is enabled, don't invoke NETISR_PPP. * pppintr() could loop without doing anything useful * under rate-limiting. */ if (ALTQ_IS_ENABLED(&sc->sc_if.if_snd)) return 0; #endif @ 1.25.2.4 log @catch up with -current on kqueue branch @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.25.2.3 2002/03/16 16:02:09 jdolecek Exp $ */ d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.25.2.3 2002/03/16 16:02:09 jdolecek Exp $"); d416 1 a416 1 return (EPASSTHROUGH); @ 1.25.2.5 log @sync kqueue branch with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.25.2.4 2002/06/23 17:50:32 jdolecek Exp $ */ d8 14 a21 1 * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. d23 6 a28 35 * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The name "Carnegie Mellon University" must not be used to * endorse or promote products derived from this software without * prior written permission. For permission or any legal * details, please contact * Office of Technology Transfer * Carnegie Mellon University * 5000 Forbes Avenue * Pittsburgh, PA 15213-3890 * (412) 268-4387, fax: (412) 268-7395 * tech-transfer@@andrew.cmu.edu * * 4. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by Computing Services * at Carnegie Mellon University (http://www.cmu.edu/computing/)." * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.25.2.4 2002/06/23 17:50:32 jdolecek Exp $"); @ 1.25.2.6 log @sync kqueue with -current; this includes merge of gehenna-devsw branch, merge of i386 MP branch, and part of autoconf rototil work @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.25.2.5 2002/09/06 08:49:01 jdolecek Exp $ */ d96 1 a96 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.25.2.5 2002/09/06 08:49:01 jdolecek Exp $"); a653 1 const struct cdevsw *cdev; d668 2 a669 4 cdev = cdevsw_lookup(tp->t_dev); if (cdev == NULL || (*cdev->d_ioctl)(tp->t_dev, TIOCXMTFRAME, (caddr_t)&m, 0, 0)) { a986 1 const struct cdevsw *cdev; d1012 1 a1012 3 cdev = cdevsw_lookup(tp->t_dev); if (cdev != NULL) (*cdev->d_stop)(tp, 0); @ 1.24 log @Remove unnecessary test of tp->t_linesw against NULL; they are results of confusion while correcting compilation error after t_line is replaced with t_linesw. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.23 2001/01/18 20:28:20 jdolecek Exp $ */ a645 1 microtime(&sc->sc_if.if_lastchange); a710 1 sc->sc_if.if_lastchange = time; @ 1.23 log @constify @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.22 2000/12/12 18:00:31 thorpej Exp $ */ d187 1 a187 1 if (tp->t_linesw && tp->t_linesw->l_no == PPPDISC) { d311 1 a311 1 if (tp != (struct tty *) sc->sc_devp || !tp->t_linesw || d364 1 a364 1 if (!tp->t_linesw || tp->t_linesw->l_no != PPPDISC) @ 1.23.2.1 log @Initial commit of scheduler activations and lightweight process support. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.23 2001/01/18 20:28:20 jdolecek Exp $ */ d178 1 a178 1 struct proc *p = curproc->l_proc; /* XXX */ @ 1.23.2.2 log @Catch up with -current. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.24 2001/03/31 00:35:24 enami Exp $ */ d187 1 a187 1 if (tp->t_linesw->l_no == PPPDISC) { d311 1 a311 1 if (tp != (struct tty *) sc->sc_devp || d364 1 a364 1 if (tp->t_linesw->l_no != PPPDISC) @ 1.23.2.3 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.23.2.2 2001/04/09 01:58:17 nathanw Exp $ */ d646 1 d712 1 @ 1.23.2.4 log @Catch up with -current. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.23.2.3 2001/06/21 20:08:19 nathanw Exp $ */ d210 1 a210 1 memset(sc->sc_asyncmap, 0, sizeof(sc->sc_asyncmap)); @ 1.23.2.5 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.23.2.4 2001/08/24 00:12:18 nathanw Exp $ */ a78 3 #include __KERNEL_RCSID(0, "$NetBSD$"); d80 1 d1280 2 @ 1.23.2.6 log @Catch up to -current. (CVS: It's not just a program. It's an adventure!) @ text @d1 1 a1 1 /* $NetBSD$ */ d416 1 a416 1 return (EPASSTHROUGH); a897 9 #ifdef ALTQ /* * if ALTQ is enabled, don't invoke NETISR_PPP. * pppintr() could loop without doing anything useful * under rate-limiting. */ if (ALTQ_IS_ENABLED(&sc->sc_if.if_snd)) return 0; #endif @ 1.23.2.7 log @Curproc->curlwp renaming. Change uses of "curproc->l_proc" back to "curproc", which is more like the original use. Bare uses of "curproc" are now "curlwp". "curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL) so that it is always safe to reference curproc (*de*referencing curproc is another story, but that's always been true). @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.23.2.6 2002/04/01 07:48:26 nathanw Exp $ */ d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.23.2.6 2002/04/01 07:48:26 nathanw Exp $"); d180 1 a180 1 struct proc *p = curproc; /* XXX */ @ 1.23.2.8 log @Catch up to -current. @ text @d1 1 a1 1 /* $NetBSD$ */ d8 14 a21 1 * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. d23 6 a28 35 * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The name "Carnegie Mellon University" must not be used to * endorse or promote products derived from this software without * prior written permission. For permission or any legal * details, please contact * Office of Technology Transfer * Carnegie Mellon University * 5000 Forbes Avenue * Pittsburgh, PA 15213-3890 * (412) 268-4387, fax: (412) 268-7395 * tech-transfer@@andrew.cmu.edu * * 4. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by Computing Services * at Carnegie Mellon University (http://www.cmu.edu/computing/)." * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. d80 1 a80 1 __KERNEL_RCSID(0, "$NetBSD$"); @ 1.23.2.9 log @Catch up to -current. @ text @a653 1 const struct cdevsw *cdev; d668 2 a669 4 cdev = cdevsw_lookup(tp->t_dev); if (cdev == NULL || (*cdev->d_ioctl)(tp->t_dev, TIOCXMTFRAME, (caddr_t)&m, 0, 0)) { a986 1 const struct cdevsw *cdev; d1012 1 a1012 3 cdev = cdevsw_lookup(tp->t_dev); if (cdev != NULL) (*cdev->d_stop)(tp, 0); @ 1.22 log @Adapt to bpfattach() changes, and further centralize the bpfattach() and bpfdetach() calls into link-type subroutines where possible. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.21 2000/11/02 15:51:18 itojun Exp $ */ d578 1 a578 1 static u_int16_t fcstab[256] = { d950 1 a950 1 static unsigned paritytab[8] = { @ 1.21 log @sync with struct tty change (does it look correct?) @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.20 2000/03/30 09:45:37 augustss Exp $ */ d205 1 a205 1 bpf_change_type(&sc->sc_bpf, DLT_PPP_SERIAL, PPP_HDRLEN); d270 1 a270 1 bpf_change_type(&sc->sc_bpf, DLT_NULL, 0); @ 1.20 log @Kill some more register declarations. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.19 2000/03/23 07:03:26 thorpej Exp $ */ d187 1 a187 1 if (tp->t_line == PPPDISC) { d246 1 a246 1 tp->t_line = 0; d311 2 a312 1 if (tp != (struct tty *) sc->sc_devp || tp->t_line != PPPDISC) { d364 1 a364 1 if (tp->t_line != PPPDISC) @ 1.19 log @New callout mechanism with two major improvements over the old timeout()/untimeout() API: - Clients supply callout handle storage, thus eliminating problems of resource allocation. - Insertion and removal of callouts is constant time, important as this facility is used quite a lot in the kernel. The old timeout()/untimeout() API has been removed from the kernel. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.18 1999/08/25 02:04:06 christos Exp $ */ d176 1 a176 1 register struct tty *tp; d179 1 a179 1 register struct ppp_softc *sc; d241 1 a241 1 register struct ppp_softc *sc; d294 1 a294 1 register struct tty *tp; d298 1 a298 1 register struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; d300 1 a300 1 register int s; d352 1 a352 1 register struct tty *tp; d356 1 a356 1 register struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; d617 3 a619 3 register u_int16_t fcs; register u_char *cp; register int len; d667 1 a667 1 register struct ppp_softc *sc; d669 4 a672 4 register struct tty *tp = (struct tty *) sc->sc_devp; register struct mbuf *m; register int len; register u_char *start, *stop, *cp; d878 1 a878 1 register struct tty *tp; d880 1 a880 1 register struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc; d927 1 a927 1 register struct ppp_softc *sc; d957 1 a957 1 register struct tty *tp; d959 1 a959 1 register struct ppp_softc *sc; @ 1.18 log @changes from ppp-2.3.9 [synchronous] @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.17 1999/05/24 20:12:10 tron Exp $ */ d283 1 a283 1 untimeout(ppp_timeout, (void *) sc); d844 1 a844 1 timeout(ppp_timeout, (void *) sc, 1); @ 1.18.2.1 log @Update thorpej_scsipi to -current as of a month ago @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.20 2000/03/30 09:45:37 augustss Exp $ */ d176 1 a176 1 struct tty *tp; d179 1 a179 1 struct ppp_softc *sc; d241 1 a241 1 struct ppp_softc *sc; d283 1 a283 1 callout_stop(&sc->sc_timo_ch); d294 1 a294 1 struct tty *tp; d298 1 a298 1 struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; d300 1 a300 1 int s; d352 1 a352 1 struct tty *tp; d356 1 a356 1 struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; d617 3 a619 3 u_int16_t fcs; u_char *cp; int len; d667 1 a667 1 struct ppp_softc *sc; d669 4 a672 4 struct tty *tp = (struct tty *) sc->sc_devp; struct mbuf *m; int len; u_char *start, *stop, *cp; d844 1 a844 1 callout_reset(&sc->sc_timo_ch, 1, ppp_timeout, sc); d878 1 a878 1 struct tty *tp; d880 1 a880 1 struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc; d927 1 a927 1 struct ppp_softc *sc; d957 1 a957 1 struct tty *tp; d959 1 a959 1 struct ppp_softc *sc; @ 1.18.2.2 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD$ */ d187 1 a187 1 if (tp->t_linesw && tp->t_linesw->l_no == PPPDISC) { d246 1 a246 1 tp->t_linesw = linesw[0]; /* default line discipline */ d311 1 a311 2 if (tp != (struct tty *) sc->sc_devp || !tp->t_linesw || tp->t_linesw->l_no != PPPDISC) { d363 1 a363 1 if (!tp->t_linesw || tp->t_linesw->l_no != PPPDISC) @ 1.18.2.3 log @Sync with HEAD (for UBC fixes). @ text @d205 1 a205 1 bpf_change_type(&sc->sc_if, DLT_PPP_SERIAL, PPP_HDRLEN); d270 1 a270 1 bpf_change_type(&sc->sc_if, DLT_NULL, 0); @ 1.18.2.4 log @Sync with HEAD. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.18.2.3 2000/12/13 15:50:33 bouyer Exp $ */ d578 1 a578 1 static const u_int16_t fcstab[256] = { d950 1 a950 1 static const unsigned paritytab[8] = { @ 1.18.2.5 log @Sync with HEAD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.18.2.4 2001/02/11 19:17:09 bouyer Exp $ */ d187 1 a187 1 if (tp->t_linesw->l_no == PPPDISC) { d311 1 a311 1 if (tp != (struct tty *) sc->sc_devp || d364 1 a364 1 if (tp->t_linesw->l_no != PPPDISC) @ 1.17 log @Fix kernel builds if ppp interface but no bpf filters are configured. Patch supplied by Takahiro Kambe in PR kern/7639, also fixes PR kern/7632 by Bjoern Labitzke. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.16 1999/05/11 02:18:52 thorpej Exp $ */ d126 1 d128 1 d136 2 d417 4 d465 109 d626 35 d677 5 d1236 44 @ 1.16 log @* Start out with a data link type of DLT_NULL. When we change an interface to serial encap, change its data link type to DLT_PPP_SERIAL. * Work around some serious bogosity in the filtering code which utterly breaks proper functioning of BPF. The PPP code and pppd(8) WILL be changed to fix this. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.15 1998/12/12 18:21:32 christos Exp $ */ d264 1 d267 1 @ 1.15 log @#include "opt_ppp.h" otherwise struct ppp_softc can be the wrong size (From mycroft) @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.14 1998/08/02 15:09:50 sommerfe Exp $ */ d109 2 a110 1 #ifdef PPP_FILTER d199 5 d263 3 @ 1.15.4.1 log @Sync w/ -current. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.17 1999/05/24 20:12:10 tron Exp $ */ d109 1 a109 2 #include "bpfilter.h" #if NBPFILTER > 0 || defined(PPP_FILTER) a197 5 #if NBPFILTER > 0 /* Switch DLT to PPP-over-serial. */ bpf_change_type(&sc->sc_bpf, DLT_PPP_SERIAL, PPP_HDRLEN); #endif a256 5 #if NBPFILTER > 0 /* Change DLT to back none. */ bpf_change_type(&sc->sc_bpf, DLT_NULL, 0); #endif @ 1.14 log @Fix PR5898: ppp delays last packet. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.13 1997/03/25 22:33:25 christos Exp $ */ d82 1 @ 1.14.4.1 log @The beginnings of interface detach support. Still some bugs, but mostly works for me. This work was originally by Bill Studenmund, and cleaned up by me. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.14 1998/08/02 15:09:50 sommerfe Exp $ */ a208 4 #ifdef _HAS_IF_ALLOC sc->sc_if->if_flags |= IFF_RUNNING; sc->sc_if->if_baudrate = tp->t_ospeed; #else a210 1 #endif a340 5 #ifdef _HAS_IF_ALLOC struct ifnet *ifp = sc->sc_if; #else struct ifnet *ifp = &sc->sc_if; #endif d351 1 a351 1 if (uio->uio_resid > ifp->if_mtu + PPP_HDRLEN || d376 1 a376 1 return ((*ifp->if_output)(ifp, m0, &dst, (struct rtentry *)0)); a541 3 #ifdef _HAS_IF_ALLOC sc->sc_if->if_lastchange = time; #else a542 1 #endif a790 1 register struct ifnet *ifp; a797 6 #ifdef _HAS_IF_ALLOC ifp = sc->sc_if; #else ifp = &sc->sc_if; #endif d804 1 a804 1 printf("%s: bad char %x\n", ifp->if_xname, c); d860 1 a860 1 printf("%s: bad fcs %x\n", ifp->if_xname, d862 1 a862 1 ifp->if_ierrors++; d873 1 a873 1 printf("%s: too short (%d)\n", ifp->if_xname, ilen); d875 1 a875 1 ifp->if_ierrors++; d945 1 a945 1 printf("%s: no input mbufs!\n", ifp->if_xname); d959 1 a959 1 ifp->if_xname, c); d971 1 a971 1 ifp->if_xname, c); d982 1 a982 1 printf("%s: bad protocol %x\n", ifp->if_xname, d990 1 a990 1 printf("%s: packet too big\n", ifp->if_xname); d1001 1 a1001 1 printf("%s: too few input mbufs!\n", ifp->if_xname); d1019 1 a1019 1 ifp->if_ierrors++; a1039 3 #ifdef _HAS_IF_ALLOC printf("%s input: ", sc->sc_if->if_xname); #else a1040 1 #endif @ 1.13 log @make sure that the tty layer restarts the ppp layer when there is an error such as out of buffer space. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */ d122 1 a122 1 int pppstart __P((struct tty *tp, int)); d667 1 a667 1 pppstart(tp, 0); d708 1 a708 1 pppstart(tp, force) a709 1 int force; d725 2 a726 1 if (CCOUNT(&tp->t_outq) >= PPP_LOWAT && !force) d749 1 a749 1 pppstart(tp, 1); @ 1.12 log @Add missing slpx(); from Bill Sommerfeld @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.11 1997/03/12 20:27:01 christos Exp $ */ d122 1 a122 1 int pppstart __P((struct tty *tp)); d667 1 a667 1 pppstart(tp); d708 1 a708 1 pppstart(tp) d710 1 d726 3 a728 2 if (CCOUNT(&tp->t_outq) < PPP_LOWAT && !((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0) d749 1 a749 1 pppstart(tp); @ 1.11 log @Update to ppp-2.3b4; from Paul Mackerras @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.10 1996/10/13 02:11:09 christos Exp $ */ d575 2 a576 1 if (putc(PPP_ESCAPE, &tp->t_outq)) d578 1 @ 1.10 log @backout previous kprintf change @ text @d1 2 a2 1 /* $NetBSD: ppp_tty.c,v 1.9 1996/10/10 22:59:54 christos Exp $ */ d68 1 a68 1 * so that it doesn't just give up with a collision if the whole d108 1 d110 1 d158 1 d356 4 a359 1 *mp = m; d376 1 a376 1 return (pppoutput(&sc->sc_if, m0, &dst, (struct rtentry *)0)); d498 2 a499 2 * This gets called from pppoutput when a new packet is * put on a queue, at splsoftnet. a505 36 int s; s = spltty(); pppstart(tp); splx(s); } /* * This gets called when a received packet is placed on * the inq, at splsoftnet. */ static void pppasyncctlp(sc) struct ppp_softc *sc; { struct tty *tp; int s; /* Put a placeholder byte in canq for ttpoll()/ttnread(). */ s = spltty(); tp = (struct tty *) sc->sc_devp; putc(0, &tp->t_canq); ttwakeup(tp); splx(s); } /* * Start output on async tty interface. Get another datagram * to send from the interface queue and start sending it. * Called at spltty or higher. */ int pppstart(tp) register struct tty *tp; { register struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc; d511 1 a511 7 if (((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0) || sc == NULL || tp != (struct tty *) sc->sc_devp) { if (tp->t_oproc != NULL) (*tp->t_oproc)(tp); return 0; } d570 1 a570 1 * the first one must be special.. d574 1 d579 1 d582 1 d623 1 d631 3 a633 1 sc->sc_stats.ppp_obytes += q - endseq; d654 3 a656 2 * Here we have either finished a packet (m == NULL) * or filled up the output queue (m != NULL). d663 48 d719 3 a721 3 * This timeout is needed for operation on a pseudo-tty, * because the pty code doesn't call pppstart after it has * drained the t_outq. d723 4 a726 3 if (!idle && (sc->sc_flags & SC_TIMEOUT) == 0) { timeout(ppp_timeout, (void *) sc, 1); sc->sc_flags |= SC_TIMEOUT; a757 1 int s; a758 1 s = spltty(); a770 1 splx(s); a793 1 s = spltty(); /* should be unnecessary */ d825 1 d834 1 d852 1 d870 1 d874 1 a875 1 splx(s); d896 5 a900 1 sc->sc_flags &= ~SC_PKTLOST; a902 1 splx(s); a908 1 splx(s); d912 1 a912 2 if (c < 0x20 && (sc->sc_rasyncmap & (1 << c))) { splx(s); a913 1 } d915 1 d924 1 a1009 1 splx(s); d1014 1 d1018 1 a1021 1 splx(s); @ 1.9 log @- printf -> kprintf, sprintf -> ksprintf @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.8 1996/09/07 12:41:27 mycroft Exp $ */ d783 1 a783 1 kprintf("%s: bad char %x\n", sc->sc_if.if_xname, c); d836 1 a836 1 kprintf("%s: bad fcs %x\n", sc->sc_if.if_xname, d849 1 a849 1 kprintf("%s: too short (%d)\n", sc->sc_if.if_xname, ilen); d918 1 a918 1 kprintf("%s: no input mbufs!\n", sc->sc_if.if_xname); d931 1 a931 1 kprintf("%s: garbage received: 0x%x (need 0xFF)\n", d943 1 a943 1 kprintf("%s: missing UI (0x3), got 0x%x\n", d955 1 a955 1 kprintf("%s: bad protocol %x\n", sc->sc_if.if_xname, d963 1 a963 1 kprintf("%s: packet too big\n", sc->sc_if.if_xname); d974 1 a974 1 kprintf("%s: too few input mbufs!\n", sc->sc_if.if_xname); d1013 1 a1013 1 kprintf("%s input: ", sc->sc_if.if_xname); d1039 1 a1039 1 kprintf("%s\n", buf); @ 1.8 log @Implement poll(2). @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.7 1996/06/14 22:22:02 cgd Exp $ */ d783 1 a783 1 printf("%s: bad char %x\n", sc->sc_if.if_xname, c); d836 2 a837 2 printf("%s: bad fcs %x\n", sc->sc_if.if_xname, sc->sc_fcs); d849 1 a849 1 printf("%s: too short (%d)\n", sc->sc_if.if_xname, ilen); d918 1 a918 1 printf("%s: no input mbufs!\n", sc->sc_if.if_xname); d931 2 a932 2 printf("%s: garbage received: 0x%x (need 0xFF)\n", sc->sc_if.if_xname, c); d943 2 a944 2 printf("%s: missing UI (0x3), got 0x%x\n", sc->sc_if.if_xname, c); d955 2 a956 2 printf("%s: bad protocol %x\n", sc->sc_if.if_xname, (sc->sc_mp[-1] << 8) + c); d963 1 a963 1 printf("%s: packet too big\n", sc->sc_if.if_xname); d974 1 a974 1 printf("%s: too few input mbufs!\n", sc->sc_if.if_xname); d1013 1 a1013 1 printf("%s input: ", sc->sc_if.if_xname); d1039 1 a1039 1 printf("%s\n", buf); @ 1.7 log @avoid unnecessary checks of m_get/MGET/etc.'s return values. When they're called with M_WAIT, they are defined to never return NULL. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.6 1996/05/07 02:40:51 thorpej Exp $ */ d517 1 a517 1 /* Put a placeholder byte in canq for ttselect()/ttnread(). */ @ 1.6 log @Changed struct ifnet to have a pointer to the softc of the underlying device and a printable "external name" (name + unit number), thus eliminating if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)() to take a struct ifnet *, rather than a unit number. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.5 1996/03/15 02:28:10 paulus Exp $ */ d352 1 a352 4 if ((*mp = m) == NULL) { m_freem(m0); return (ENOBUFS); } @ 1.5 log @Added packet filtering, support for "PPP Deflate" packet compression, trivial multicast support, and support for xon/xoff output flow control to the PPP subsystem. Fixed several bugs, including making the accumulation and resetting of statistics more consistent. State for the VJ compressor is now dynamically allocated. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.4 1996/02/13 22:00:30 christos Exp $ */ d786 1 a786 1 printf("ppp%d: bad char %x\n", sc->sc_if.if_unit, c); d839 1 a839 1 printf("ppp%d: bad fcs %x\n", sc->sc_if.if_unit, d852 1 a852 1 printf("ppp%d: too short (%d)\n", sc->sc_if.if_unit, ilen); d921 1 a921 1 printf("ppp%d: no input mbufs!\n", sc->sc_if.if_unit); d934 2 a935 2 printf("ppp%d: garbage received: 0x%x (need 0xFF)\n", sc->sc_if.if_unit, c); d946 2 a947 2 printf("ppp%d: missing UI (0x3), got 0x%x\n", sc->sc_if.if_unit, c); d958 1 a958 1 printf("ppp%d: bad protocol %x\n", sc->sc_if.if_unit, d966 1 a966 1 printf("ppp%d: packet too big\n", sc->sc_if.if_unit); d977 1 a977 1 printf("ppp%d: too few input mbufs!\n", sc->sc_if.if_unit); d1016 1 a1016 1 printf("ppp%d input: ", sc->sc_if.if_unit); @ 1.4 log @Net prototypes @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.3 1995/10/05 05:55:14 mycroft Exp $ */ d107 1 d230 1 a230 1 ttywflush(tp); d574 1 a574 1 ++sc->sc_bytessent; d601 1 a601 1 sc->sc_bytessent += ndone; d618 1 a618 1 sc->sc_bytessent += 2; d665 1 a665 1 sc->sc_bytessent += q - endseq; a679 2 sc->sc_if.if_opackets++; sc->sc_if.if_obytes = sc->sc_bytessent; d781 1 a781 1 ++sc->sc_bytesrcvd; d792 19 a825 1 sc->sc_if.if_ibytes = sc->sc_bytesrcvd; d842 1 d854 1 d996 1 @ 1.3 log @Add some missing statistics. From Thorsten Lockert. @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.2 1995/07/04 23:26:10 paulus Exp $ */ d95 1 d169 1 a169 1 int error, s, i; d171 1 a171 1 if (error = suser(p->p_ucred, &p->p_acflag)) a225 1 struct mbuf *m; d320 1 a320 1 if (error = uiomove(mtod(m, u_char *), m->m_len, uio)) d361 1 a361 1 if (error = uiomove(mtod(m, u_char *), len, uio)) { d397 1 a397 1 if (error = suser(p->p_ucred, &p->p_acflag)) d407 1 a407 1 if (error = suser(p->p_ucred, &p->p_acflag)) d417 1 a417 1 if (error = suser(p->p_ucred, &p->p_acflag)) d540 1 a540 1 int n, s, ndone, done, idle; d543 1 a543 1 if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0 d818 1 a818 1 || ilen > 0 && sc->sc_fcs != PPP_GOODFCS) { d995 1 a995 1 || c < 0 && sc->sc_rawin_count > 0) { @ 1.2 log @Change $Id to $NetBSD @ text @d1 1 a1 1 /* $NetBSD: ppp_tty.c,v 1.8 1995/07/04 03:46:02 paulus Exp $ */ d204 1 d579 1 @ 1.1 log @Latest version of PPP stuff, with packet compression and other improvements. The PPP kernel code is now split into if_ppp.c, containing generic PPP support, and ppp_tty.c, which specifically supports PPP on async tty devices (as a line discipline). This is so that other devices can be supported without making them look like ttys. @ text @d1 1 a1 1 /* $Id: ppp_tty.c,v 1.8 1995/07/04 03:46:02 paulus Exp $ */ @