Skip Menu |

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

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

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

Bug Information
Severity: Important
Broken in: 0.12
Fixed in: (no value)



Subject: Parse Error on Mac (freebsd)
I received the following error when trying Parse::Netstat on my Mac which is based on the freebsd stack. parse-netstat: ERROR 400: Can't parse tcp line ... There were three patterns that failed: 1 - tcp4 0 0 *.* *.* CLOSED 2 - tcp46 0 0 *.80 *.* LISTEN 3 - udp46 0 0 *.* *.* I modified the code per the diff below and it now handles these scenarios. 65,66c65,68 < $line =~ m!^(?P<proto>tcp[46]?) \s+ (?P<recvq>\d+) \s+ (?P<sendq>\d+)\s+ < (?P<local_host>\S+?)[:.](?P<local_port>\w+)\s+ --- Show quoted text
> #tcp4 0 0 *:* *:* CLOSED > #tcp46 0 0 192.168.1.33.632 192.168.1.10.2049 CLOSED > $line =~ m!^(?P<proto>tcp[46]|tcp46?) \s+ (?P<recvq>\d+) \s+ (?P<sendq>\d+)\s+ > (?P<local_host>\S+?)[:.](?P<local_port>\w+|\*)\s+
77c79,80 < $line =~ m!^(?P<proto>udp[46]?) \s+ (?P<recvq>\d+) \s+ (?P<sendq>\d+) \s+ --- Show quoted text
> #udp46 0 0 *.879 *.* > $line =~ m!^(?P<proto>udp[46]|udp46?) \s+ (?P<recvq>\d+) \s+ (?P<sendq>\d+) \s+
Please let me know if you have any questions or want me to test anything else. Cheers, LBE
Thanks for the patch. Could you provide me with the sample output of "netstat -n", "netstat -an", "netstat -anp" on the OS? Like these: https://metacpan.org/source/PERLANCAR/Parse-Netstat-0.12/share/netstat-samples
On the MAC, the -p (program) switch is not supported. Neither is it supported on FreeBSD. lsof would be used on both of these platforms to see the associated program. I have forwarded the files directly to you e-mail for netstat -n and -an. The files were long and I did not want to truncate them in case I deleted something that you may need. Cheers, lbe
Thanks, I've added share/netstat-examples/netstat-an-freebsd-mac to the distribution. It would be nice to know the version of the freebsd kernel or the Mac version, so the file can be named more accurately.
uname -a on my Mac: Darwin xxxx-mbp.local 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64 Sorry, I don't currently have access to a freebsd machine on which to test. lbe
On Thu, 9 Feb 2017 18:46:25 GMT, LBE wrote: Show quoted text
> uname -a on my Mac: > > Darwin xxxx-mbp.local 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 > 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64 > > Sorry, I don't currently have access to a freebsd machine on which to > test. > > lbe
My bad. I was under the false impression that OS X uses the freebsd kernel. I've split the module accordingly to Parse::Netstat::darwin, although implementation-wise it's still handled by Parse::Netstat::freebsd. Thanks.
Subject: Re: [rt.cpan.org #119959] Parse Error on Mac (freebsd)
Date: Thu, 23 Feb 2017 02:37:12 -0600
To: bug-Parse-Netstat [...] rt.cpan.org
From: Learned Byerror <learnedbyerror [...] gmail.com>
No, OS X actually is based on a micro kernel from CMU. Most of the command line user space tools do come from FreeBSD - some unadulterated, others with Apple tweaks. Thanks for the update. Cheers, William On Thu, Feb 9, 2017 at 11:09 PM, Perl Ancar via RT < bug-Parse-Netstat@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=119959 > > > On Thu, 9 Feb 2017 18:46:25 GMT, LBE wrote:
> > uname -a on my Mac: > > > > Darwin xxxx-mbp.local 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 > > 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64 > > > > Sorry, I don't currently have access to a freebsd machine on which to > > test. > > > > lbe
> > My bad. I was under the false impression that OS X uses the freebsd > kernel. I've split the module accordingly to Parse::Netstat::darwin, > although implementation-wise it's still handled by Parse::Netstat::freebsd. > Thanks. >