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

Proposal for proc/net/tcp Parser #420

Closed
AlvinSolomon opened this issue Jun 13, 2023 · 2 comments
Closed

Proposal for proc/net/tcp Parser #420

AlvinSolomon opened this issue Jun 13, 2023 · 2 comments

Comments

@AlvinSolomon
Copy link
Contributor

I built a parser for the proc/net/tcp file. This would fit well with all the other parsers that exist for proc/net/ files. Not all of the headers are included in the file, so they were gathered from Linux kernel documentation.

Here is the schema I'm using:

[
      {
        "sl":                           string,
        "local_address":                string,
        "rem_address":                  string,
        "st":                           string,
        "tx_queue":                     string,
        "rx_queue":                     string,
        "tr":                           string,
        "tm->when":                     string,
        "retrnsmt":                     string,
        "uid":                          string,
        "timeout":                      string,
        "inode":                        string,
        "sock_ref_count":               string,
        "sock_mem_loc":                 string,
        "retransmit_timeout":           string,
        "soft_clock_tick":              string,
        "(ack.quick<<1)|ack.pingpong":  string,
        "sending_congestion_window":    string,
        "slow_start_size_threshold":    string
      }
    ]

So if you had a file like this:

  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode                                                     
   0: 3500007F:0035 00000000:0000 0A 00000000:00000000 00:00000000 00000000   101        0 34000 1 0000000000000000 100 0 0 10 5                     
   1: 0100007F:89E7 00000000:0000 0A 00000000:00000000 00:00000000 00000000  1000        0 140054 1 0000000000000000 100 0 0 10 0                    
   2: 0100007F:0277 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 34523 1 0000000000000000 100 0 0 10 0                     
   3: 802AA8C0:D450 2104C798:01BB 08 00000000:00000052 02:00000A6F 00000000  1000        0 149098 2 0000000000000000 20 4 0 10 -1                    

JC could output this:

[
  {
    "sl": "0",
    "local_address": "3500007F:0035",
    "rem_address": "00000000:0000",
    "st": "0A",
    "tx_queue": "00000000",
    "rx_queue": "00000000",
    "tr": "00",
    "tm->when": "00000000",
    "retrnsmt": "00000000",
    "uid": "101",
    "timeout": "0",
    "inode": "34000",
    "sock_ref_count": "1",
    "sock_mem_loc": "0000000000000000",
    "retransmit_timeout": "100",
    "soft_clock_tick": "0",
    "(ack.quick<<1)|ack.pingpong": "0",
    "sending_congestion_window": "10",
    "slow_start_size_threshold": "5"
  },
  {
    "sl": "1",
    "local_address": "0100007F:89E7",
    "rem_address": "00000000:0000",
    "st": "0A",
    "tx_queue": "00000000",
    "rx_queue": "00000000",
    "tr": "00",
    "tm->when": "00000000",
    "retrnsmt": "00000000",
    "uid": "1000",
    "timeout": "0",
    "inode": "140054",
    "sock_ref_count": "1",
    "sock_mem_loc": "0000000000000000",
    "retransmit_timeout": "100",
    "soft_clock_tick": "0",
    "(ack.quick<<1)|ack.pingpong": "0",
    "sending_congestion_window": "10",
    "slow_start_size_threshold": "0"
  },
  {
    "sl": "2",
    "local_address": "0100007F:0277",
    "rem_address": "00000000:0000",
    "st": "0A",
    "tx_queue": "00000000",
    "rx_queue": "00000000",
    "tr": "00",
    "tm->when": "00000000",
    "retrnsmt": "00000000",
    "uid": "0",
    "timeout": "0",
    "inode": "34523",
    "sock_ref_count": "1",
    "sock_mem_loc": "0000000000000000",
    "retransmit_timeout": "100",
    "soft_clock_tick": "0",
    "(ack.quick<<1)|ack.pingpong": "0",
    "sending_congestion_window": "10",
    "slow_start_size_threshold": "0"
  },
  {
    "sl": "3",
    "local_address": "802AA8C0:D450",
    "rem_address": "2104C798:01BB",
    "st": "08",
    "tx_queue": "00000000",
    "rx_queue": "00000052",
    "tr": "02",
    "tm->when": "00000A6F",
    "retrnsmt": "00000000",
    "uid": "1000",
    "timeout": "0",
    "inode": "149098",
    "sock_ref_count": "2",
    "sock_mem_loc": "0000000000000000",
    "retransmit_timeout": "20",
    "soft_clock_tick": "4",
    "(ack.quick<<1)|ack.pingpong": "0",
    "sending_congestion_window": "10",
    "slow_start_size_threshold": "-1"
  }
]
@kellyjonbrazil
Copy link
Owner

Very nice! Thank you for the contribution. I’ll take a closer look in the next few days and this should make it in the next release.

@kellyjonbrazil
Copy link
Owner

Added in v1.23.4

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

No branches or pull requests

2 participants