2

I'm running iptstate to try and resolve a VPN issue through my router, and some of the traffic is highlighted in green and some is highlighted in red as I move the cursor up and down the list.

I don't know what the significance is - the man page doesn't provide any details.

The red traffic is over gre protocol - and the greens are all tcp.

1

This extract from the iptstate source should answer your question:

  if (has_colors()) {
    start_color();
    // for tcp
    init_pair(1, COLOR_GREEN, COLOR_BLACK);
    // for udp
    init_pair(2, COLOR_YELLOW, COLOR_BLACK);
    // for icmp
    init_pair(3, COLOR_RED, COLOR_BLACK);
    // for prompts
    init_pair(4, COLOR_BLACK, COLOR_RED);
    // for the currently selected row
    init_pair(5, COLOR_BLACK, COLOR_GREEN);
    init_pair(6, COLOR_BLACK, COLOR_YELLOW);
    init_pair(7, COLOR_BLACK, COLOR_RED);
  } else {
    flags.nocolor = true;
  }
  • Apart from seeing that the colour is probably not significant, it's still not very clear - what is init_pair() and what does that magic number mean? – HorusKol Mar 27 '14 at 22:40
  • The magic number is just an internal reference used elsewhere in the code, but the comments tell the story: green is TCP, yellow is UDP, red is ICMP (and possibly other protocols, if you've seen GRE coloured red), prompts are red on black, and the next three lines are the inverse of the first three for when the row is highlighted. – Flup Mar 28 '14 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.