Skip Menu |

This queue is for tickets about the Parse-Netstat CPAN distribution.

Report information
The Basics
Id: 100607
Status: resolved
Priority: 0/
Queue: Parse-Netstat

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.06
Fixed in: (no value)



Subject: Cannot parse FreeBSD's netstat output
$ netstat | /usr/perl5.18.2/bin/parse-netstat ERROR 400: Can't parse tcp line (#3): tcp4 0 0 localhost.58981 localhost.x11-ssh TIME_WAIT $ netstat -n | /usr/perl5.18.2/bin/parse-netstat ERROR 400: Can't parse tcp line (#3): tcp4 0 0 127.0.0.1.6010 127.0.0.1.13589 TIME_WAIT This is with Parse-Netstat 0.06 --- because of dependency problems it's not possible to try out with 0.08, but looking at the Changes file it seems that there were no bug fixes here.
On Sat Nov 29 09:47:48 2014, SREZIC wrote: Show quoted text
> $ netstat | /usr/perl5.18.2/bin/parse-netstat > ERROR 400: Can't parse tcp line (#3): tcp4 0 0 > localhost.58981 localhost.x11-ssh TIME_WAIT > > $ netstat -n | /usr/perl5.18.2/bin/parse-netstat > ERROR 400: Can't parse tcp line (#3): tcp4 0 0 > 127.0.0.1.6010 127.0.0.1.13589 TIME_WAIT > > This is with Parse-Netstat 0.06 --- because of dependency problems > it's not possible to try out with 0.08, but looking at the Changes > file it seems that there were no bug fixes here.
This is because FreeBSD's netstat uses "tcp4" and "udp4" for proto instead of "tcp" and "udp". I've committed a fix. Could you perhaps send me output of "netstat -an" and "netstat -anp" so I can add a test for it? Thanks.
Also, could you expand on the dependency problem when installing 0.08? I've just done a reindex on some of my dists on PAUSE.
On 2014-11-30 00:38:49, PERLANCAR wrote: Show quoted text
> On Sat Nov 29 09:47:48 2014, SREZIC wrote:
> > $ netstat | /usr/perl5.18.2/bin/parse-netstat > > ERROR 400: Can't parse tcp line (#3): tcp4 0 0 > > localhost.58981 localhost.x11-ssh TIME_WAIT > > > > $ netstat -n | /usr/perl5.18.2/bin/parse-netstat > > ERROR 400: Can't parse tcp line (#3): tcp4 0 0 > > 127.0.0.1.6010 127.0.0.1.13589 TIME_WAIT > > > > This is with Parse-Netstat 0.06 --- because of dependency problems > > it's not possible to try out with 0.08, but looking at the Changes > > file it seems that there were no bug fixes here.
> > This is because FreeBSD's netstat uses "tcp4" and "udp4" for proto > instead of "tcp" and "udp". I've committed a fix. Could you perhaps > send me output of "netstat -an" and "netstat -anp" so I can add a test > for it? Thanks.
I've attached the output of netstat -an from a freebsd 9.2 and freebsd 10.1 system. The option -p does something different on freebsd systems; it excepts a value for a protocol specification (something like -p tcp or -p udp).
Subject: netstat-an-freebsd-101
Download netstat-an-freebsd-101
application/octet-stream 5.1k

Message body not shown because it is not plain text.

Subject: netstat-an-freebsd92
Download netstat-an-freebsd92
application/octet-stream 4.2k

Message body not shown because it is not plain text.

On 2014-11-30 00:46:22, PERLANCAR wrote: Show quoted text
> Also, could you expand on the dependency problem when installing 0.08? > I've just done a reindex on some of my dists on PAUSE.
The only problem was that Perinci-Sub-Complete (which is a dependency of your module) had test problems, so I could not installed the latest version.
On 2014-11-30 03:27:18, SREZIC wrote: Show quoted text
> On 2014-11-30 00:46:22, PERLANCAR wrote:
> > Also, could you expand on the dependency problem when installing > > 0.08? > > I've just done a reindex on some of my dists on PAUSE.
> > The only problem was that Perinci-Sub-Complete (which is a dependency > of your module) had test problems, so I could not installed the latest > version.
https://rt.cpan.org/Ticket/Display.html?id=100605
OK, fixed and released 0.09, thanks.
On 2014-11-30 11:59:45, PERLANCAR wrote: Show quoted text
> OK, fixed and released 0.09, thanks.
Thanks. I still see two pitfalls: * The SYNOPSIS still uses "netstat -anp", which does not work on BSD systems. At least a comment would be good, e.g. saying "# use `netstat -an` on non-Linux systems" * The parsed "proto" field for tcp v4 connections is different on Linux and BSD systems ("tcp" vs. "tcp4"). Maybe this is also worth a note, or the difference could even be normalized away, maybe with an additional option.
在2014-十一月-30 12:30:53 星期日时,SREZIC写到: Show quoted text
> On 2014-11-30 11:59:45, PERLANCAR wrote:
> > OK, fixed and released 0.09, thanks.
> > Thanks. I still see two pitfalls: > > * The SYNOPSIS still uses "netstat -anp", which does not work on BSD > systems. At least a comment would be good, e.g. saying "# use `netstat > -an` on non-Linux systems" > > * The parsed "proto" field for tcp v4 connections is different on > Linux and BSD systems ("tcp" vs. "tcp4"). Maybe this is also worth a > note, or the difference could even be normalized away, maybe with an > additional option.
I've now split the module into per-flavor modules. And for each module, I've included the sample data and parse result, so users can compare and pick common fields and/or adjust value expectation. Parse::Netstat is meant to be purely for parsing netstat string into data structure, so minimal postprocessing/canonicalization should be done.