Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port match for listening IPv6 address fails #78

Closed
shalomb opened this issue Apr 22, 2016 · 6 comments
Closed

Port match for listening IPv6 address fails #78

shalomb opened this issue Apr 22, 2016 · 6 comments
Labels

Comments

@shalomb
Copy link

shalomb commented Apr 22, 2016

A simple port test (postgres in this case)

root@postgres-01:/etc/goss# cat goss.yaml 
port:
  tcp6:5432:
    listening: true
    ip:
      - 2001:db8:ff:842:5054:ff:fe12:f0d8
  tcp:5432:
    listening: true
    ip:
      - 192.168.1.174

against the following IPv6 address

root@postgres-01:/etc/goss# ip -6 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN 
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2001:db8:ff:842:5054:ff:fe12:f0d8/64 scope global mngtmpaddr dynamic 
       valid_lft 3598sec preferred_lft 598sec
    inet6 fe80::5054:ff:fe12:f0d8/64 scope link 
       valid_lft forever preferred_lft forever

seems to match against a garbled address.

root@postgres-01:/etc/goss#  goss --gossfile /etc/goss/goss.yaml validate -f tap
1..4
ok 1 - Port: tcp6:5432: listening: matches expectation: [true]
not ok 2 - Port: tcp6:5432: ip: doesn't match, expect: [["2001:db8:ff:842:5054:ff:fe12:f0d8"]] found: [["0470:0120:0842:006F:00FF:5054:F0D8:FE12"]]
ok 3 - Port: tcp:5432: listening: matches expectation: [true]
ok 4 - Port: tcp:5432: ip: matches expectation: [["192.168.1.174"]]

Looks like a problem with the stringification of the IPv6 address used in the match (the byte order representation of localaddress in /proc/net/tcp6 appears to be of different than that represented by tools?)

root@postgres-01:/etc/goss# goss --version
goss version v0.1.5
root@postgres-01:/etc/goss# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux testing (stretch)
Release:        testing
Codename:       stretch
root@postgres-01:/etc/goss# uname -r
4.3.0-1-amd64
@shalomb
Copy link
Author

shalomb commented Apr 22, 2016

This appears to be a problem in adding the port as well.

root@postgres-01:/etc/goss# goss add port tcp6:5432
Adding Port to './goss.yaml':

tcp6:5432:
  listening: true
  ip:
  - 0DB8:0120:0842:00FF:00FF:5054:F0D8:FE12

@aelsabbahy
Copy link
Member

What does netstat show?

@aelsabbahy
Copy link
Member

It does appear that go-netstat is not working properly, thanks for filing this.

@aelsabbahy aelsabbahy added the bug label Apr 22, 2016
@aelsabbahy
Copy link
Member

Had some time to track down the issue and test out a fix locally, hoping to have a fix released sometime later this week. Sorry for the delay.

@shalomb
Copy link
Author

shalomb commented Apr 25, 2016

Ohh, I wasn't expecting so much - thank you though .. the tool is flexible enough to fall back to commands that I've got a temporary workaround until you put out a fix. I do really appreciate your time on this and the other issues. And for such an invaluable tool - it's just a massive time saver!

@aelsabbahy
Copy link
Member

Fixed in v0.1.6. Let me know if you run into any more issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants