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

Content of /proc/net/tcp not what it is supposed to be #143

Open
robinmonjo opened this issue Feb 11, 2016 · 4 comments
Open

Content of /proc/net/tcp not what it is supposed to be #143

robinmonjo opened this issue Feb 11, 2016 · 4 comments
Labels

Comments

@robinmonjo
Copy link

I've noticed something weird I couldn't reproduce on other docker images such as ubuntu or on a "real" distribution (i.e: not running in a container engine).

When I launch the command: nc -l 9999, I expect to see the in /proc/net/tcp something like this:

0: 00000000:270F 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 132769 1 ffff880078ff4040 100 0 0 10 0

where the 00000000:270F part corresponds to <local_addr>:<local_port>. In this sample, I see 0.0.0.0:9999 (once converted to decimal). However on alpine docker I see random number for the port part instead of the 9999 I expect.

Here is a screenshot of my session:

screen shot 2016-02-11 at 18 06 10

@robinmonjo robinmonjo changed the title Content of /proc/net/tcp not what it is supposed to be ? Content of /proc/net/tcp not what it is supposed to be Feb 11, 2016
@andyshinn
Copy link
Contributor

I'll do some investigation. It is beyond my initial knowledge of the musl libc TCP implementation. What is this actually affecting?

@robinmonjo
Copy link
Author

I guess it's affecting every tools that use this file to gather system information such as lsof or netcat. I noticed this while working on a tool I'm writing that must be able to check if a PID as bound a given port (I don't want any dependencies, that is why I do it "manually").

@robinmonjo
Copy link
Author

Just FYI, it works as expected when spawning a http server with the go net/http library. Just saw this with nc so far (I use nc mainly for testing)

@hanimustafa
Copy link

hanimustafa commented Aug 22, 2016

I just hit this "bug" as well. You need to do "nc -l -p 9999"

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

3 participants