Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * Mini netstat implementation(s) for busybox |
| 4 | * based in part on the netstat implementation from net-tools. |
| 5 | * |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 6 | * Copyright (C) 2002 by Bart Visscher <magick@linux-fan.com> |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 7 | * |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 8 | * 2002-04-20 |
| 9 | * IPV6 support added by Bart Visscher <magick@linux-fan.com> |
"Robert P. J. Day" | 2819f75 | 2006-07-11 11:32:31 +0000 | [diff] [blame] | 10 | * |
| 11 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 12 | */ |
| 13 | |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 14 | #include "busybox.h" |
Rob Landley | c9c1a41 | 2006-07-12 19:17:55 +0000 | [diff] [blame] | 15 | #include "inet_common.h" |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 16 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 17 | #define NETSTAT_CONNECTED 0x01 |
| 18 | #define NETSTAT_LISTENING 0x02 |
| 19 | #define NETSTAT_NUMERIC 0x04 |
Denis Vlasenko | 67b23e6 | 2006-10-03 21:00:06 +0000 | [diff] [blame] | 20 | /* Must match getopt32 option string */ |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 21 | #define NETSTAT_TCP 0x10 |
| 22 | #define NETSTAT_UDP 0x20 |
| 23 | #define NETSTAT_RAW 0x40 |
| 24 | #define NETSTAT_UNIX 0x80 |
| 25 | #define NETSTAT_ALLPROTO (NETSTAT_TCP|NETSTAT_UDP|NETSTAT_RAW|NETSTAT_UNIX) |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 26 | |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 27 | static int flags = NETSTAT_CONNECTED | NETSTAT_ALLPROTO; |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 28 | |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 29 | enum { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 30 | TCP_ESTABLISHED = 1, |
| 31 | TCP_SYN_SENT, |
| 32 | TCP_SYN_RECV, |
| 33 | TCP_FIN_WAIT1, |
| 34 | TCP_FIN_WAIT2, |
| 35 | TCP_TIME_WAIT, |
| 36 | TCP_CLOSE, |
| 37 | TCP_CLOSE_WAIT, |
| 38 | TCP_LAST_ACK, |
| 39 | TCP_LISTEN, |
| 40 | TCP_CLOSING /* now a valid state */ |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
Eric Andersen | b0c39a8 | 2002-06-22 17:32:58 +0000 | [diff] [blame] | 43 | static const char * const tcp_state[] = |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 44 | { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 45 | "", |
| 46 | "ESTABLISHED", |
| 47 | "SYN_SENT", |
| 48 | "SYN_RECV", |
| 49 | "FIN_WAIT1", |
| 50 | "FIN_WAIT2", |
| 51 | "TIME_WAIT", |
| 52 | "CLOSE", |
| 53 | "CLOSE_WAIT", |
| 54 | "LAST_ACK", |
| 55 | "LISTEN", |
| 56 | "CLOSING" |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | typedef enum { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 60 | SS_FREE = 0, /* not allocated */ |
| 61 | SS_UNCONNECTED, /* unconnected to any socket */ |
| 62 | SS_CONNECTING, /* in process of connecting */ |
| 63 | SS_CONNECTED, /* connected to socket */ |
| 64 | SS_DISCONNECTING /* in process of disconnecting */ |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 65 | } socket_state; |
| 66 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 67 | #define SO_ACCEPTCON (1<<16) /* performed a listen */ |
| 68 | #define SO_WAITDATA (1<<17) /* wait data to read */ |
| 69 | #define SO_NOSPACE (1<<18) /* no space to write */ |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 70 | |
Denis Vlasenko | b6aae0f | 2007-01-29 22:51:25 +0000 | [diff] [blame] | 71 | static const char *get_sname(int port, const char *proto, int num) |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 72 | { |
Denis Vlasenko | b6aae0f | 2007-01-29 22:51:25 +0000 | [diff] [blame] | 73 | /* hummm, we return static buffer here!! */ |
| 74 | const char *str = itoa(ntohs(port)); |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 75 | if (!num) { |
| 76 | struct servent *se = getservbyport(port, proto); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 77 | if (se) |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 78 | str = se->s_name; |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 79 | } |
| 80 | if (!port) { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 81 | str = "*"; |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 82 | } |
| 83 | return str; |
| 84 | } |
| 85 | |
Denis Vlasenko | b6aae0f | 2007-01-29 22:51:25 +0000 | [diff] [blame] | 86 | static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, const char *proto, int numeric) |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 87 | { |
Denis Vlasenko | b6aae0f | 2007-01-29 22:51:25 +0000 | [diff] [blame] | 88 | const char *port_name; |
Eric Andersen | cd8c436 | 2001-11-10 11:22:46 +0000 | [diff] [blame] | 89 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 90 | #if ENABLE_FEATURE_IPV6 |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 91 | if (addr->sa_family == AF_INET6) { |
| 92 | INET6_rresolve(ip_port, size, (struct sockaddr_in6 *)addr, |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 93 | (numeric & NETSTAT_NUMERIC) ? 0x0fff : 0); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 94 | } else |
| 95 | #endif |
| 96 | { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 97 | INET_rresolve(ip_port, size, (struct sockaddr_in *)addr, |
| 98 | 0x4000 | ((numeric & NETSTAT_NUMERIC) ? 0x0fff : 0), |
| 99 | 0xffffffff); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 100 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 101 | port_name = get_sname(htons(port), proto, numeric); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 102 | if ((strlen(ip_port) + strlen(port_name)) > 22) |
| 103 | ip_port[22 - strlen(port_name)] = '\0'; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 104 | ip_port += strlen(ip_port); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 105 | strcat(ip_port, ":"); |
| 106 | strcat(ip_port, port_name); |
| 107 | } |
| 108 | |
| 109 | static void tcp_do_one(int lnr, const char *line) |
| 110 | { |
| 111 | char local_addr[64], rem_addr[64]; |
Eric Andersen | b0c39a8 | 2002-06-22 17:32:58 +0000 | [diff] [blame] | 112 | const char *state_str; |
| 113 | char more[512]; |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 114 | int num, local_port, rem_port, d, state, timer_run, uid, timeout; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 115 | #if ENABLE_FEATURE_IPV6 |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 116 | struct sockaddr_in6 localaddr, remaddr; |
| 117 | char addr6[INET6_ADDRSTRLEN]; |
| 118 | struct in6_addr in6; |
| 119 | #else |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 120 | struct sockaddr_in localaddr, remaddr; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 121 | #endif |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 122 | unsigned long rxq, txq, time_len, retr, inode; |
| 123 | |
| 124 | if (lnr == 0) |
| 125 | return; |
| 126 | |
| 127 | more[0] = '\0'; |
| 128 | num = sscanf(line, |
| 129 | "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %ld %512s\n", |
| 130 | &d, local_addr, &local_port, |
| 131 | rem_addr, &rem_port, &state, |
| 132 | &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); |
| 133 | |
| 134 | if (strlen(local_addr) > 8) { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 135 | #if ENABLE_FEATURE_IPV6 |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 136 | sscanf(local_addr, "%08X%08X%08X%08X", |
| 137 | &in6.s6_addr32[0], &in6.s6_addr32[1], |
| 138 | &in6.s6_addr32[2], &in6.s6_addr32[3]); |
| 139 | inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6)); |
| 140 | inet_pton(AF_INET6, addr6, (struct sockaddr *) &localaddr.sin6_addr); |
| 141 | sscanf(rem_addr, "%08X%08X%08X%08X", |
| 142 | &in6.s6_addr32[0], &in6.s6_addr32[1], |
| 143 | &in6.s6_addr32[2], &in6.s6_addr32[3]); |
| 144 | inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6)); |
| 145 | inet_pton(AF_INET6, addr6, (struct sockaddr *) &remaddr.sin6_addr); |
| 146 | localaddr.sin6_family = AF_INET6; |
| 147 | remaddr.sin6_family = AF_INET6; |
| 148 | #endif |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 149 | } else { |
| 150 | sscanf(local_addr, "%X", |
| 151 | &((struct sockaddr_in *) &localaddr)->sin_addr.s_addr); |
| 152 | sscanf(rem_addr, "%X", |
| 153 | &((struct sockaddr_in *) &remaddr)->sin_addr.s_addr); |
| 154 | ((struct sockaddr *) &localaddr)->sa_family = AF_INET; |
| 155 | ((struct sockaddr *) &remaddr)->sa_family = AF_INET; |
| 156 | } |
| 157 | |
| 158 | if (num < 10) { |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 159 | bb_error_msg("warning, got bogus tcp line"); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 160 | return; |
| 161 | } |
Eric Andersen | b0c39a8 | 2002-06-22 17:32:58 +0000 | [diff] [blame] | 162 | state_str = tcp_state[state]; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 163 | if ((rem_port && (flags & NETSTAT_CONNECTED)) |
| 164 | || (!rem_port && (flags & NETSTAT_LISTENING)) |
| 165 | ) { |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 166 | snprint_ip_port(local_addr, sizeof(local_addr), |
| 167 | (struct sockaddr *) &localaddr, local_port, |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 168 | "tcp", flags & NETSTAT_NUMERIC); |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 169 | |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 170 | snprint_ip_port(rem_addr, sizeof(rem_addr), |
| 171 | (struct sockaddr *) &remaddr, rem_port, |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 172 | "tcp", flags & NETSTAT_NUMERIC); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 173 | |
| 174 | printf("tcp %6ld %6ld %-23s %-23s %-12s\n", |
| 175 | rxq, txq, local_addr, rem_addr, state_str); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 176 | } |
| 177 | } |
| 178 | |
| 179 | static void udp_do_one(int lnr, const char *line) |
| 180 | { |
| 181 | char local_addr[64], rem_addr[64]; |
Denis Vlasenko | b6aae0f | 2007-01-29 22:51:25 +0000 | [diff] [blame] | 182 | const char *state_str; |
| 183 | char more[512]; |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 184 | int num, local_port, rem_port, d, state, timer_run, uid, timeout; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 185 | #if ENABLE_FEATURE_IPV6 |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 186 | struct sockaddr_in6 localaddr, remaddr; |
| 187 | char addr6[INET6_ADDRSTRLEN]; |
| 188 | struct in6_addr in6; |
| 189 | #else |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 190 | struct sockaddr_in localaddr, remaddr; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 191 | #endif |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 192 | unsigned long rxq, txq, time_len, retr, inode; |
| 193 | |
| 194 | if (lnr == 0) |
| 195 | return; |
| 196 | |
| 197 | more[0] = '\0'; |
| 198 | num = sscanf(line, |
| 199 | "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %ld %512s\n", |
| 200 | &d, local_addr, &local_port, |
| 201 | rem_addr, &rem_port, &state, |
| 202 | &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); |
| 203 | |
| 204 | if (strlen(local_addr) > 8) { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 205 | #if ENABLE_FEATURE_IPV6 |
Tim Riker | c1ef7bd | 2006-01-25 00:08:53 +0000 | [diff] [blame] | 206 | /* Demangle what the kernel gives us */ |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 207 | sscanf(local_addr, "%08X%08X%08X%08X", |
| 208 | &in6.s6_addr32[0], &in6.s6_addr32[1], |
| 209 | &in6.s6_addr32[2], &in6.s6_addr32[3]); |
| 210 | inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6)); |
| 211 | inet_pton(AF_INET6, addr6, (struct sockaddr *) &localaddr.sin6_addr); |
| 212 | sscanf(rem_addr, "%08X%08X%08X%08X", |
| 213 | &in6.s6_addr32[0], &in6.s6_addr32[1], |
| 214 | &in6.s6_addr32[2], &in6.s6_addr32[3]); |
| 215 | inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6)); |
| 216 | inet_pton(AF_INET6, addr6, (struct sockaddr *) &remaddr.sin6_addr); |
| 217 | localaddr.sin6_family = AF_INET6; |
| 218 | remaddr.sin6_family = AF_INET6; |
| 219 | #endif |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 220 | } else { |
| 221 | sscanf(local_addr, "%X", |
| 222 | &((struct sockaddr_in *) &localaddr)->sin_addr.s_addr); |
| 223 | sscanf(rem_addr, "%X", |
| 224 | &((struct sockaddr_in *) &remaddr)->sin_addr.s_addr); |
| 225 | ((struct sockaddr *) &localaddr)->sa_family = AF_INET; |
| 226 | ((struct sockaddr *) &remaddr)->sa_family = AF_INET; |
| 227 | } |
| 228 | |
| 229 | if (num < 10) { |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 230 | bb_error_msg("warning, got bogus udp line"); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 231 | return; |
| 232 | } |
| 233 | switch (state) { |
| 234 | case TCP_ESTABLISHED: |
| 235 | state_str = "ESTABLISHED"; |
| 236 | break; |
| 237 | |
| 238 | case TCP_CLOSE: |
| 239 | state_str = ""; |
| 240 | break; |
| 241 | |
| 242 | default: |
| 243 | state_str = "UNKNOWN"; |
| 244 | break; |
| 245 | } |
| 246 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 247 | #if ENABLE_FEATURE_IPV6 |
Glenn L McGrath | d7fb1b3 | 2002-11-26 02:40:56 +0000 | [diff] [blame] | 248 | # define notnull(A) (((A.sin6_family == AF_INET6) && \ |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 249 | ((A.sin6_addr.s6_addr32[0]) || \ |
| 250 | (A.sin6_addr.s6_addr32[1]) || \ |
| 251 | (A.sin6_addr.s6_addr32[2]) || \ |
| 252 | (A.sin6_addr.s6_addr32[3]))) || \ |
| 253 | ((A.sin6_family == AF_INET) && \ |
| 254 | ((struct sockaddr_in *) &A)->sin_addr.s_addr)) |
| 255 | #else |
Glenn L McGrath | d7fb1b3 | 2002-11-26 02:40:56 +0000 | [diff] [blame] | 256 | # define notnull(A) (A.sin_addr.s_addr) |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 257 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 258 | if ((notnull(remaddr) && (flags & NETSTAT_CONNECTED)) |
| 259 | || (!notnull(remaddr) && (flags & NETSTAT_LISTENING)) |
| 260 | ) { |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 261 | snprint_ip_port(local_addr, sizeof(local_addr), |
| 262 | (struct sockaddr *) &localaddr, local_port, |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 263 | "udp", flags & NETSTAT_NUMERIC); |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 264 | |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 265 | snprint_ip_port(rem_addr, sizeof(rem_addr), |
| 266 | (struct sockaddr *) &remaddr, rem_port, |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 267 | "udp", flags & NETSTAT_NUMERIC); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 268 | |
| 269 | printf("udp %6ld %6ld %-23s %-23s %-12s\n", |
| 270 | rxq, txq, local_addr, rem_addr, state_str); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 271 | } |
| 272 | } |
| 273 | |
| 274 | static void raw_do_one(int lnr, const char *line) |
| 275 | { |
| 276 | char local_addr[64], rem_addr[64]; |
| 277 | char *state_str, more[512]; |
| 278 | int num, local_port, rem_port, d, state, timer_run, uid, timeout; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 279 | #if ENABLE_FEATURE_IPV6 |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 280 | struct sockaddr_in6 localaddr, remaddr; |
| 281 | char addr6[INET6_ADDRSTRLEN]; |
| 282 | struct in6_addr in6; |
| 283 | #else |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 284 | struct sockaddr_in localaddr, remaddr; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 285 | #endif |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 286 | unsigned long rxq, txq, time_len, retr, inode; |
| 287 | |
| 288 | if (lnr == 0) |
| 289 | return; |
| 290 | |
| 291 | more[0] = '\0'; |
| 292 | num = sscanf(line, |
| 293 | "%d: %64[0-9A-Fa-f]:%X %64[0-9A-Fa-f]:%X %X %lX:%lX %X:%lX %lX %d %d %ld %512s\n", |
| 294 | &d, local_addr, &local_port, |
| 295 | rem_addr, &rem_port, &state, |
| 296 | &txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more); |
| 297 | |
| 298 | if (strlen(local_addr) > 8) { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 299 | #if ENABLE_FEATURE_IPV6 |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 300 | sscanf(local_addr, "%08X%08X%08X%08X", |
| 301 | &in6.s6_addr32[0], &in6.s6_addr32[1], |
| 302 | &in6.s6_addr32[2], &in6.s6_addr32[3]); |
| 303 | inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6)); |
| 304 | inet_pton(AF_INET6, addr6, (struct sockaddr *) &localaddr.sin6_addr); |
| 305 | sscanf(rem_addr, "%08X%08X%08X%08X", |
| 306 | &in6.s6_addr32[0], &in6.s6_addr32[1], |
| 307 | &in6.s6_addr32[2], &in6.s6_addr32[3]); |
| 308 | inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6)); |
| 309 | inet_pton(AF_INET6, addr6, (struct sockaddr *) &remaddr.sin6_addr); |
| 310 | localaddr.sin6_family = AF_INET6; |
| 311 | remaddr.sin6_family = AF_INET6; |
| 312 | #endif |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 313 | } else { |
| 314 | sscanf(local_addr, "%X", |
| 315 | &((struct sockaddr_in *) &localaddr)->sin_addr.s_addr); |
| 316 | sscanf(rem_addr, "%X", |
| 317 | &((struct sockaddr_in *) &remaddr)->sin_addr.s_addr); |
| 318 | ((struct sockaddr *) &localaddr)->sa_family = AF_INET; |
| 319 | ((struct sockaddr *) &remaddr)->sa_family = AF_INET; |
| 320 | } |
| 321 | |
| 322 | if (num < 10) { |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 323 | bb_error_msg("warning, got bogus raw line"); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 324 | return; |
| 325 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 326 | state_str = itoa(state); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 327 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 328 | #if ENABLE_FEATURE_IPV6 |
Glenn L McGrath | d7fb1b3 | 2002-11-26 02:40:56 +0000 | [diff] [blame] | 329 | # define notnull(A) (((A.sin6_family == AF_INET6) && \ |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 330 | ((A.sin6_addr.s6_addr32[0]) || \ |
| 331 | (A.sin6_addr.s6_addr32[1]) || \ |
| 332 | (A.sin6_addr.s6_addr32[2]) || \ |
| 333 | (A.sin6_addr.s6_addr32[3]))) || \ |
| 334 | ((A.sin6_family == AF_INET) && \ |
| 335 | ((struct sockaddr_in *) &A)->sin_addr.s_addr)) |
| 336 | #else |
Glenn L McGrath | d7fb1b3 | 2002-11-26 02:40:56 +0000 | [diff] [blame] | 337 | # define notnull(A) (A.sin_addr.s_addr) |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 338 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 339 | if ((notnull(remaddr) && (flags & NETSTAT_CONNECTED)) |
| 340 | || (!notnull(remaddr) && (flags & NETSTAT_LISTENING)) |
| 341 | ) { |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 342 | snprint_ip_port(local_addr, sizeof(local_addr), |
| 343 | (struct sockaddr *) &localaddr, local_port, |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 344 | "raw", flags & NETSTAT_NUMERIC); |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 345 | |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 346 | snprint_ip_port(rem_addr, sizeof(rem_addr), |
| 347 | (struct sockaddr *) &remaddr, rem_port, |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 348 | "raw", flags & NETSTAT_NUMERIC); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 349 | |
| 350 | printf("raw %6ld %6ld %-23s %-23s %-12s\n", |
| 351 | rxq, txq, local_addr, rem_addr, state_str); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 352 | } |
| 353 | } |
| 354 | |
| 355 | #define HAS_INODE 1 |
| 356 | |
| 357 | static void unix_do_one(int nr, const char *line) |
| 358 | { |
| 359 | static int has = 0; |
| 360 | char path[PATH_MAX], ss_flags[32]; |
Denis Vlasenko | b6aae0f | 2007-01-29 22:51:25 +0000 | [diff] [blame] | 361 | const char *ss_proto, *ss_state, *ss_type; |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 362 | int num, state, type, inode; |
| 363 | void *d; |
| 364 | unsigned long refcnt, proto, unix_flags; |
| 365 | |
| 366 | if (nr == 0) { |
| 367 | if (strstr(line, "Inode")) |
| 368 | has |= HAS_INODE; |
| 369 | return; |
| 370 | } |
| 371 | path[0] = '\0'; |
| 372 | num = sscanf(line, "%p: %lX %lX %lX %X %X %d %s", |
| 373 | &d, &refcnt, &proto, &unix_flags, &type, &state, &inode, path); |
| 374 | if (num < 6) { |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 375 | bb_error_msg("warning, got bogus unix line"); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 376 | return; |
| 377 | } |
| 378 | if (!(has & HAS_INODE)) |
| 379 | snprintf(path,sizeof(path),"%d",inode); |
| 380 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 381 | if ((flags & (NETSTAT_LISTENING|NETSTAT_CONNECTED)) != (NETSTAT_LISTENING|NETSTAT_CONNECTED)) { |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 382 | if ((state == SS_UNCONNECTED) && (unix_flags & SO_ACCEPTCON)) { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 383 | if (!(flags & NETSTAT_LISTENING)) |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 384 | return; |
| 385 | } else { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 386 | if (!(flags & NETSTAT_CONNECTED)) |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 387 | return; |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | switch (proto) { |
| 392 | case 0: |
| 393 | ss_proto = "unix"; |
| 394 | break; |
| 395 | |
| 396 | default: |
| 397 | ss_proto = "??"; |
| 398 | } |
| 399 | |
| 400 | switch (type) { |
| 401 | case SOCK_STREAM: |
| 402 | ss_type = "STREAM"; |
| 403 | break; |
| 404 | |
| 405 | case SOCK_DGRAM: |
| 406 | ss_type = "DGRAM"; |
| 407 | break; |
| 408 | |
| 409 | case SOCK_RAW: |
| 410 | ss_type = "RAW"; |
| 411 | break; |
| 412 | |
| 413 | case SOCK_RDM: |
| 414 | ss_type = "RDM"; |
| 415 | break; |
| 416 | |
| 417 | case SOCK_SEQPACKET: |
| 418 | ss_type = "SEQPACKET"; |
| 419 | break; |
| 420 | |
| 421 | default: |
| 422 | ss_type = "UNKNOWN"; |
| 423 | } |
| 424 | |
| 425 | switch (state) { |
| 426 | case SS_FREE: |
| 427 | ss_state = "FREE"; |
| 428 | break; |
| 429 | |
| 430 | case SS_UNCONNECTED: |
| 431 | /* |
| 432 | * Unconnected sockets may be listening |
| 433 | * for something. |
| 434 | */ |
| 435 | if (unix_flags & SO_ACCEPTCON) { |
| 436 | ss_state = "LISTENING"; |
| 437 | } else { |
| 438 | ss_state = ""; |
| 439 | } |
| 440 | break; |
| 441 | |
| 442 | case SS_CONNECTING: |
| 443 | ss_state = "CONNECTING"; |
| 444 | break; |
| 445 | |
| 446 | case SS_CONNECTED: |
| 447 | ss_state = "CONNECTED"; |
| 448 | break; |
| 449 | |
| 450 | case SS_DISCONNECTING: |
| 451 | ss_state = "DISCONNECTING"; |
| 452 | break; |
| 453 | |
| 454 | default: |
| 455 | ss_state = "UNKNOWN"; |
| 456 | } |
| 457 | |
| 458 | strcpy(ss_flags, "[ "); |
| 459 | if (unix_flags & SO_ACCEPTCON) |
| 460 | strcat(ss_flags, "ACC "); |
| 461 | if (unix_flags & SO_WAITDATA) |
| 462 | strcat(ss_flags, "W "); |
| 463 | if (unix_flags & SO_NOSPACE) |
| 464 | strcat(ss_flags, "N "); |
| 465 | |
| 466 | strcat(ss_flags, "]"); |
| 467 | |
| 468 | printf("%-5s %-6ld %-11s %-10s %-13s ", |
| 469 | ss_proto, refcnt, ss_flags, ss_type, ss_state); |
| 470 | if (has & HAS_INODE) |
| 471 | printf("%-6d ",inode); |
| 472 | else |
| 473 | printf("- "); |
| 474 | puts(path); |
| 475 | } |
| 476 | |
| 477 | #define _PATH_PROCNET_UDP "/proc/net/udp" |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 478 | #define _PATH_PROCNET_UDP6 "/proc/net/udp6" |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 479 | #define _PATH_PROCNET_TCP "/proc/net/tcp" |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 480 | #define _PATH_PROCNET_TCP6 "/proc/net/tcp6" |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 481 | #define _PATH_PROCNET_RAW "/proc/net/raw" |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 482 | #define _PATH_PROCNET_RAW6 "/proc/net/raw6" |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 483 | #define _PATH_PROCNET_UNIX "/proc/net/unix" |
| 484 | |
Eric Andersen | b0c39a8 | 2002-06-22 17:32:58 +0000 | [diff] [blame] | 485 | static void do_info(const char *file, const char *name, void (*proc)(int, const char *)) |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 486 | { |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 487 | int lnr = 0; |
| 488 | FILE *procinfo; |
| 489 | |
Eric Andersen | b0c39a8 | 2002-06-22 17:32:58 +0000 | [diff] [blame] | 490 | procinfo = fopen(file, "r"); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 491 | if (procinfo == NULL) { |
| 492 | if (errno != ENOENT) { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 493 | bb_perror_msg("%s", file); |
Eric Andersen | b0c39a8 | 2002-06-22 17:32:58 +0000 | [diff] [blame] | 494 | } else { |
Denis Vlasenko | ea62077 | 2006-10-14 02:23:43 +0000 | [diff] [blame] | 495 | bb_error_msg("no support for '%s' on this system", name); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 496 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 497 | return; |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 498 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 499 | do { |
| 500 | char *buffer = xmalloc_fgets(procinfo); |
| 501 | if (buffer) { |
| 502 | (proc)(lnr++, buffer); |
| 503 | free(buffer); |
| 504 | } |
| 505 | } while (!feof(procinfo)); |
| 506 | fclose(procinfo); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | /* |
| 510 | * Our main function. |
| 511 | */ |
| 512 | |
Denis Vlasenko | 06af216 | 2007-02-03 17:28:39 +0000 | [diff] [blame] | 513 | int netstat_main(int argc, char **argv); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 514 | int netstat_main(int argc, char **argv) |
| 515 | { |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 516 | enum { |
| 517 | OPT_extended = 0x4, |
| 518 | OPT_showroute = 0x100, |
| 519 | }; |
Denis Vlasenko | 67b23e6 | 2006-10-03 21:00:06 +0000 | [diff] [blame] | 520 | unsigned opt; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 521 | #if ENABLE_FEATURE_IPV6 |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 522 | int inet = 1; |
| 523 | int inet6 = 1; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 524 | #else |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 525 | enum { inet = 1, inet6 = 0 }; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 526 | #endif |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 527 | |
| 528 | /* Option string must match NETSTAT_xxx constants */ |
Denis Vlasenko | 67b23e6 | 2006-10-03 21:00:06 +0000 | [diff] [blame] | 529 | opt = getopt32(argc, argv, "laentuwxr"); |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 530 | if (opt & 0x1) { // -l |
| 531 | flags &= ~NETSTAT_CONNECTED; |
| 532 | flags |= NETSTAT_LISTENING; |
| 533 | } |
| 534 | if (opt & 0x2) flags |= NETSTAT_LISTENING | NETSTAT_CONNECTED; // -a |
| 535 | //if (opt & 0x4) // -e |
| 536 | if (opt & 0x8) flags |= NETSTAT_NUMERIC; // -n |
| 537 | //if (opt & 0x10) // -t: NETSTAT_TCP |
| 538 | //if (opt & 0x20) // -u: NETSTAT_UDP |
| 539 | //if (opt & 0x40) // -w: NETSTAT_RAW |
| 540 | //if (opt & 0x80) // -x: NETSTAT_UNIX |
| 541 | if (opt & OPT_showroute) { // -r |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 542 | #if ENABLE_ROUTE |
| 543 | bb_displayroutes(flags & NETSTAT_NUMERIC, !(opt & OPT_extended)); |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 544 | return 0; |
Robert Griebl | 820098f | 2002-05-14 23:03:23 +0000 | [diff] [blame] | 545 | #else |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 546 | bb_error_msg_and_die("-r (display routing table) is not compiled in"); |
Robert Griebl | 820098f | 2002-05-14 23:03:23 +0000 | [diff] [blame] | 547 | #endif |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 548 | } |
| 549 | |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 550 | opt &= NETSTAT_ALLPROTO; |
| 551 | if (opt) { |
| 552 | flags &= ~NETSTAT_ALLPROTO; |
| 553 | flags |= opt; |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 554 | } |
Denis Vlasenko | 754a88f | 2006-09-22 16:02:40 +0000 | [diff] [blame] | 555 | if (flags & (NETSTAT_TCP|NETSTAT_UDP|NETSTAT_RAW)) { |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 556 | printf("Active Internet connections "); /* xxx */ |
| 557 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 558 | if ((flags & (NETSTAT_LISTENING|NETSTAT_CONNECTED)) == (NETSTAT_LISTENING|NETSTAT_CONNECTED)) |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 559 | printf("(servers and established)"); |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 560 | else if (flags & NETSTAT_LISTENING) |
| 561 | printf("(only servers)"); |
| 562 | else |
| 563 | printf("(w/o servers)"); |
Denis Vlasenko | e1a0d48 | 2006-10-20 13:28:22 +0000 | [diff] [blame] | 564 | printf("\nProto Recv-Q Send-Q Local Address Foreign Address State\n"); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 565 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 566 | if (inet && flags & NETSTAT_TCP) |
| 567 | do_info(_PATH_PROCNET_TCP, "AF INET (tcp)", tcp_do_one); |
| 568 | #if ENABLE_FEATURE_IPV6 |
| 569 | if (inet6 && flags & NETSTAT_TCP) |
| 570 | do_info(_PATH_PROCNET_TCP6, "AF INET6 (tcp)", tcp_do_one); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 571 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 572 | if (inet && flags & NETSTAT_UDP) |
| 573 | do_info(_PATH_PROCNET_UDP, "AF INET (udp)", udp_do_one); |
| 574 | #if ENABLE_FEATURE_IPV6 |
| 575 | if (inet6 && flags & NETSTAT_UDP) |
| 576 | do_info(_PATH_PROCNET_UDP6, "AF INET6 (udp)", udp_do_one); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 577 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 578 | if (inet && flags & NETSTAT_RAW) |
| 579 | do_info(_PATH_PROCNET_RAW, "AF INET (raw)", raw_do_one); |
| 580 | #if ENABLE_FEATURE_IPV6 |
| 581 | if (inet6 && flags & NETSTAT_RAW) |
| 582 | do_info(_PATH_PROCNET_RAW6, "AF INET6 (raw)", raw_do_one); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 583 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 584 | if (flags & NETSTAT_UNIX) { |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 585 | printf("Active UNIX domain sockets "); |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 586 | if ((flags & (NETSTAT_LISTENING|NETSTAT_CONNECTED)) == (NETSTAT_LISTENING|NETSTAT_CONNECTED)) |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 587 | printf("(servers and established)"); |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 588 | else if (flags & NETSTAT_LISTENING) |
| 589 | printf("(only servers)"); |
| 590 | else |
| 591 | printf("(w/o servers)"); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 592 | printf("\nProto RefCnt Flags Type State I-Node Path\n"); |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 593 | do_info(_PATH_PROCNET_UNIX, "AF UNIX", unix_do_one); |
Eric Andersen | 31a0ece | 2001-10-31 11:00:46 +0000 | [diff] [blame] | 594 | } |
| 595 | return 0; |
| 596 | } |