From nobody Fri Aug 20 08:54:10 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 602781775400 for ; Fri, 20 Aug 2021 08:59:08 +0000 (UTC) (envelope-from freebsd-hackers@phoe.frmug.org) Received: from frmug.org (enterprise.frmug.org [213.36.253.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrbCv4hclz531N for ; Fri, 20 Aug 2021 08:59:07 +0000 (UTC) (envelope-from freebsd-hackers@phoe.frmug.org) Received: by frmug.org (Postfix, from userid 66) id 50E7812B2E3; Fri, 20 Aug 2021 10:59:06 +0200 (CEST) Received: by memo2.memo.frmug.org (Postfix, from userid 1001) id A48D417A40; Fri, 20 Aug 2021 10:54:10 +0200 (CEST) Date: Fri, 20 Aug 2021 10:54:10 +0200 From: Bertrand Petit To: Konstantin Belousov , Gary Jennejohn Cc: freebsd-hackers@freebsd.org Subject: Re: Is snp(4) in working order? Message-ID: <20210820085410.GA97799@memo2.memo.frmug.org> List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20210819183344.358e1f55@ernst.home> User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 4GrbCv4hclz531N X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=frmug.org (policy=none); spf=neutral (mx1.freebsd.org: 213.36.253.97 is neither permitted nor denied by domain of freebsd-hackers@phoe.frmug.org) smtp.mailfrom=freebsd-hackers@phoe.frmug.org X-Spamd-Result: default: False [-0.27 / 15.00]; ARC_NA(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[frmug.org : No valid SPF, No valid DKIM,none]; R_SPF_NEUTRAL(0.00)[?all:c]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-0.999]; NEURAL_SPAM_MEDIUM(0.72)[0.721]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.990]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12322, ipnet:213.36.0.0/16, country:FR]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N On Thu, Aug 19, 2021 at 08:14:49PM +0300, Konstantin Belousov wrote: > Did you tried watch(8) first? No, I didn't; yes, now I did and observed the same behavior, which is silence from the device. After reading sys/dev/snp/snp.c, I understand that the sighted nothingness is normal and should be expected because the snp(4) device can only snoop on egress tty streams. The manual page lacks on this point. Since I need access to ingress trafic, I suppose I need to go through the bpf/usbdump way. (I'm not looking forward to that.) On Thu, Aug 19, 2021 at 08:33:44PM +0200, Gary Jennejohn wrote: > C-code. Pay particuar attention to how FIONREAD is used in main(). I must mention that FIONREAD on snp(4) devices no longer has special return status codes. The snp(4) manual page and the watch(8) command are both way out of sync with the actual implementation of the device driver. Disappearance, closure and detachement of the snooped device are now signaled by an EIO return on read() and by an EIO or ENXIO return on write(). I will issue a PR for this manual page. -- %!PS -- Bertrand Petit /D{def}def/E{exch}D/G{get}D/I{2 div}D/U{dup}D/L{roll}D/Y{setgray}D/N{newpath}D /O{N 0 0 moveto}D/P{pop}D/T{translate}D currentpagedevice/PageSize G U 0 G/w E D 1 G /h E D w I h I T 0 Y 1 setlinewidth 0 1 2 { P 120 rotate 2 4 w U mul h U mul add sqrt I 50 add {N 50 0 3 2 L 0 360 arc stroke}for}for/s{O true charpath pathbbox exch 4 -1 L E sub I 3 1 L sub I} D /l(bp)D 0.94 Y /Helvetica findfont 22 scalefont setfont l s P(x)s exch P T O l show showpage