]>
Commit | Line | Data |
---|---|---|
eab940a4 | 1 | --- net-tools-1.57/lib/net-support.h.bug9129 Sat May 20 14:27:25 2000 |
2 | +++ net-tools-1.57/lib/net-support.h Sat Oct 7 11:19:50 2000 | |
3 | @@ -92,14 +92,17 @@ | |
4 | #define RTACTION_FLUSH 4 | |
5 | #define RTACTION_SHOW 5 | |
6 | ||
7 | -#define FLAG_EXT 3 /* AND-Mask */ | |
8 | -#define FLAG_NUM 4 | |
9 | -#define FLAG_SYM 8 | |
10 | -#define FLAG_CACHE 16 | |
11 | -#define FLAG_FIB 32 | |
12 | -#define FLAG_VERBOSE 64 | |
13 | +#define FLAG_EXT 3 /* AND-Mask */ | |
14 | +#define FLAG_NUM_HOST 4 | |
15 | +#define FLAG_NUM_PORT 8 | |
16 | +#define FLAG_NUM_USER 16 | |
17 | +#define FLAG_NUM (FLAG_NUM_HOST|FLAG_NUM_PORT|FLAG_NUM_USER) | |
18 | +#define FLAG_SYM 32 | |
19 | +#define FLAG_CACHE 64 | |
20 | +#define FLAG_FIB 128 | |
21 | +#define FLAG_VERBOSE 256 | |
22 | ||
23 | -extern int ip_masq_info(int numeric, int ext); | |
24 | +extern int ip_masq_info(int numeric_host, int numeric_port, int ext); | |
25 | ||
26 | extern int INET_rprint(int options); | |
27 | extern int INET6_rprint(int options); | |
28 | --- net-tools-1.57/lib/inet6_gr.c.bug9129 Sat Jan 9 10:54:50 1999 | |
29 | +++ net-tools-1.57/lib/inet6_gr.c Sat Oct 7 11:19:50 2000 | |
30 | @@ -259,7 +259,7 @@ | |
31 | int INET6_rprint(int options) | |
32 | { | |
33 | int ext = options & FLAG_EXT; | |
34 | - int numeric = options & (FLAG_NUM | FLAG_SYM); | |
35 | + int numeric = options & (FLAG_NUM_HOST | FLAG_SYM); | |
36 | int rc = E_INTERN; | |
37 | ||
38 | if (options & FLAG_FIB) | |
39 | --- net-tools-1.57/lib/inet_gr.c.bug9129 Sun Jan 2 17:53:44 2000 | |
40 | +++ net-tools-1.57/lib/inet_gr.c Sat Oct 7 11:19:50 2000 | |
41 | @@ -444,7 +444,7 @@ | |
42 | int INET_rprint(int options) | |
43 | { | |
44 | int ext = options & FLAG_EXT; | |
45 | - int numeric = options & (FLAG_NUM | FLAG_SYM); | |
46 | + int numeric = options & (FLAG_NUM_HOST | FLAG_SYM); | |
47 | int rc = E_INTERN; | |
48 | ||
49 | if (options & FLAG_FIB) | |
50 | --- net-tools-1.57/lib/ipx_gr.c.bug9129 Sat Jan 9 10:55:11 1999 | |
51 | +++ net-tools-1.57/lib/ipx_gr.c Sat Oct 7 11:19:50 2000 | |
52 | @@ -33,7 +33,7 @@ | |
53 | int IPX_rprint(int options) | |
54 | { | |
55 | /* int ext = options & FLAG_EXT; */ | |
56 | - int numeric = options & FLAG_NUM; | |
57 | + int numeric = options & FLAG_NUM_HOST; | |
58 | char buff[1024]; | |
59 | char net[128], router_net[128]; | |
60 | char router_node[128]; | |
61 | --- net-tools-1.57/lib/netrom_gr.c.bug9129 Sat Jan 9 10:55:20 1999 | |
62 | +++ net-tools-1.57/lib/netrom_gr.c Sat Oct 7 11:19:50 2000 | |
63 | @@ -37,7 +37,7 @@ | |
64 | char buffer[256]; | |
65 | int qual, n, w; | |
66 | /*int ext = options & FLAG_EXT; | |
67 | - int numeric = options & FLAG_NUM; */ | |
68 | + int numeric = options & FLAG_NUM_HOST; */ | |
69 | ||
70 | f1 = fopen(_PATH_PROCNET_NR_NODES, "r"); | |
71 | if (!f1) perror(_PATH_PROCNET_NR_NODES); | |
72 | --- net-tools-1.57/lib/masq_info.c.bug9129 Sat Jun 12 19:04:49 1999 | |
73 | +++ net-tools-1.57/lib/masq_info.c Sat Oct 7 11:19:50 2000 | |
74 | @@ -57,7 +57,8 @@ | |
75 | static struct aftype *ap; /* current address family */ | |
76 | static int has_pdelta; | |
77 | ||
78 | -static void print_masq(struct masq *ms, int numeric, int ext) | |
79 | +static void print_masq(struct masq *ms, int numeric_host, int numeric_port, | |
80 | + int ext) | |
81 | { | |
82 | unsigned long minutes, seconds, sec100s; | |
83 | ||
84 | @@ -77,12 +78,12 @@ | |
85 | printf("%10lu %5hd - ", ms->initseq, | |
86 | ms->delta); | |
87 | } | |
88 | - printf("%-20s ", ap->sprint((struct sockaddr *) &(ms->src), numeric)); | |
89 | - printf("%-20s ", ap->sprint((struct sockaddr *) &(ms->dst), numeric)); | |
90 | + printf("%-20s ", ap->sprint((struct sockaddr *) &(ms->src), numeric_host)); | |
91 | + printf("%-20s ", ap->sprint((struct sockaddr *) &(ms->dst), numeric_host)); | |
92 | ||
93 | - printf("%s -> ", get_sname(ms->sport, ms->proto, numeric)); | |
94 | - printf("%s", get_sname(ms->dport, ms->proto, numeric)); | |
95 | - printf(" (%s)\n", get_sname(ms->mport, ms->proto, numeric)); | |
96 | + printf("%s -> ", get_sname(ms->sport, ms->proto, numeric_port)); | |
97 | + printf("%s", get_sname(ms->dport, ms->proto, numeric_port)); | |
98 | + printf(" (%s)\n", get_sname(ms->mport, ms->proto, numeric_port)); | |
99 | } | |
100 | ||
101 | ||
102 | @@ -144,7 +145,7 @@ | |
103 | } | |
104 | ||
105 | ||
106 | -int ip_masq_info(int numeric, int ext) | |
107 | +int ip_masq_info(int numeric_host, int numeric_port, int ext) | |
108 | { | |
109 | FILE *f; | |
110 | int i; | |
111 | @@ -204,7 +205,7 @@ | |
112 | break; | |
113 | } | |
114 | for (i = 0; i < ntotal; i++) | |
115 | - print_masq(&(mslist[i]), numeric, ext); | |
116 | + print_masq(&(mslist[i]), numeric_host, numeric_port, ext); | |
117 | if (mslist) | |
118 | free(mslist); | |
119 | ||
120 | --- net-tools-1.57/man/en_US/netstat.8.bug9129 Sun May 21 16:16:38 2000 | |
121 | +++ net-tools-1.57/man/en_US/netstat.8 Sat Oct 7 11:54:53 2000 | |
122 | @@ -23,6 +23,7 @@ | |
123 | .RB [ \-\-listening | \-l ] | |
124 | .RB [ \-\-all | \-a ] | |
125 | .RB [ \-\-numeric | \-n ] | |
126 | +.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
127 | .RB [ \-\-symbolic | \-N ] | |
128 | .RB [ \-\-extend | \-e [ \-\-extend | \-e] ] | |
129 | .RB [ \-\-timers | \-o ] | |
130 | @@ -36,6 +37,7 @@ | |
131 | .RB [ \-\-extend | \-e [ \-\-extend | \-e] ] | |
132 | .RB [ \-\-verbose | \-v ] | |
133 | .RB [ \-\-numeric | \-n ] | |
134 | +.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
135 | .RB [ \-\-continuous | \-c] | |
136 | .P | |
137 | .B netstat | |
138 | @@ -46,17 +48,20 @@ | |
139 | .RB [ \-\-verbose | \-v ] | |
140 | .RB [ \-\-program | \-p ] | |
141 | .RB [ \-\-numeric | \-n ] | |
142 | +.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
143 | .RB [ \-\-continuous | \-c] | |
144 | .P | |
145 | .B netstat | |
146 | .RB { \-\-groups | \-g } | |
147 | .RB [ \-\-numeric | \-n ] | |
148 | +.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
149 | .RB [ \-\-continuous | \-c] | |
150 | .P | |
151 | .B netstat | |
152 | .RB { \-\-masquerade | \-M } | |
153 | .RB [ \-\-extend | \-e ] | |
154 | .RB [ \-\-numeric | \-n ] | |
155 | +.RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ] | |
156 | .RB [ \-\-continuous | \-c] | |
157 | .P | |
158 | .B netstat | |
159 | @@ -110,6 +115,16 @@ | |
160 | .SS "\-\-numeric , \-n" | |
161 | Show numerical addresses instead of trying to determine symbolic host, port | |
162 | or user names. | |
163 | +.SS "\-\-numeric-hosts" | |
164 | +shows numerical host addresses but does not affect the resolution of | |
165 | +port or user names. | |
166 | +.SS "\-\-numeric-ports" | |
167 | +shows numerical port numbers but does not affect the resolution of | |
168 | +host or user names. | |
169 | +.SS "\-\-numeric-users" | |
170 | +shows numerical user IDs but does not affect the resolution of host or | |
171 | +port names. | |
172 | + | |
173 | .SS "\-\-protocol=\fIfamily \fR, \fB\-A" | |
174 | Specifies the address families (perhaps better described as low level | |
175 | protocols) for which connections are to be shown. | |
176 | --- net-tools-1.57/netstat.c.bug9129 Sun May 28 11:19:15 2000 | |
177 | +++ net-tools-1.57/netstat.c Sat Oct 7 11:19:50 2000 | |
178 | @@ -525,7 +525,7 @@ | |
179 | struct passwd *pw; | |
180 | ||
181 | if (flag_exp > 1) { | |
182 | - if (!flag_not && ((pw = getpwuid(uid)) != NULL)) | |
183 | + if (!(flag_not & FLAG_NUM_USER) && ((pw = getpwuid(uid)) != NULL)) | |
184 | printf("%-10s ", pw->pw_name); | |
185 | else | |
186 | printf("%-10d ", uid); | |
187 | @@ -763,14 +763,17 @@ | |
188 | safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not), | |
189 | sizeof(rem_addr)); | |
190 | if (flag_all || (flag_lst && !rem_port) || (!flag_lst && rem_port)) { | |
191 | - snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(local_port), "tcp", flag_not)); | |
192 | + snprintf(buffer, sizeof(buffer), "%s", | |
193 | + get_sname(htons(local_port), "tcp", | |
194 | + flag_not & FLAG_NUM_PORT)); | |
195 | ||
196 | if ((strlen(local_addr) + strlen(buffer)) > 22) | |
197 | local_addr[22 - strlen(buffer)] = '\0'; | |
198 | ||
199 | strcat(local_addr, ":"); | |
200 | strcat(local_addr, buffer); | |
201 | - snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(rem_port), "tcp", flag_not)); | |
202 | + snprintf(buffer, sizeof(buffer), "%s", | |
203 | + get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT)); | |
204 | ||
205 | if ((strlen(rem_addr) + strlen(buffer)) > 22) | |
206 | rem_addr[22 - strlen(buffer)] = '\0'; | |
207 | @@ -911,13 +914,16 @@ | |
208 | { | |
209 | safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, | |
210 | flag_not), sizeof(local_addr)); | |
211 | - snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(local_port), "udp", flag_not)); | |
212 | + snprintf(buffer, sizeof(buffer), "%s", | |
213 | + get_sname(htons(local_port), "udp", | |
214 | + flag_not & FLAG_NUM_PORT)); | |
215 | if ((strlen(local_addr) + strlen(buffer)) > 22) | |
216 | local_addr[22 - strlen(buffer)] = '\0'; | |
217 | strcat(local_addr, ":"); | |
218 | strcat(local_addr, buffer); | |
219 | ||
220 | - snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(rem_port), "udp", flag_not)); | |
221 | + snprintf(buffer, sizeof(buffer), "%s", | |
222 | + get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT)); | |
223 | safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, | |
224 | flag_not), sizeof(rem_addr)); | |
225 | if ((strlen(rem_addr) + strlen(buffer)) > 22) | |
226 | @@ -1025,7 +1031,9 @@ | |
227 | ||
228 | if (flag_all || (notnull(remaddr) && !flag_lst) || (!notnull(remaddr) && flag_lst)) | |
229 | { | |
230 | - snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(local_port), "raw", flag_not)); | |
231 | + snprintf(buffer, sizeof(buffer), "%s", | |
232 | + get_sname(htons(local_port), "raw", | |
233 | + flag_not & FLAG_NUM_PORT)); | |
234 | safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, | |
235 | flag_not), sizeof(local_addr)); | |
236 | if ((strlen(local_addr) + strlen(buffer)) > 22) | |
237 | @@ -1033,7 +1041,8 @@ | |
238 | strcat(local_addr, ":"); | |
239 | strcat(local_addr, buffer); | |
240 | ||
241 | - snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(rem_port), "raw", flag_not)); | |
242 | + snprintf(buffer, sizeof(buffer), "%s", | |
243 | + get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT)); | |
244 | safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, | |
245 | flag_not), sizeof(rem_addr)); | |
246 | if ((strlen(rem_addr) + strlen(buffer)) > 22) | |
247 | @@ -1412,7 +1421,7 @@ | |
248 | ||
249 | printf("IPX %6ld %6ld %-26s %-26s %-5s", txq, rxq, sad, dad, st); | |
250 | if (flag_exp > 1) { | |
251 | - if (!flag_not && ((pw = getpwuid(uid)) != NULL)) | |
252 | + if (!(flag_not & FLAG_NUM_USER) && ((pw = getpwuid(uid)) != NULL)) | |
253 | printf(" %-10s", pw->pw_name); | |
254 | else | |
255 | printf(" %-10d", uid); | |
256 | @@ -1475,6 +1484,9 @@ | |
257 | #endif | |
258 | fprintf(stderr, _(" -v, --verbose be verbose\n")); | |
259 | fprintf(stderr, _(" -n, --numeric dont resolve names\n")); | |
260 | + fprintf(stderr, _(" --numeric-hosts dont resolve host names\n")); | |
261 | + fprintf(stderr, _(" --numeric-ports dont resolve port names\n")); | |
262 | + fprintf(stderr, _(" --numeric-users dont resolve user names\n")); | |
263 | fprintf(stderr, _(" -N, --symbolic resolve hardware names\n")); | |
264 | fprintf(stderr, _(" -e, --extend display other/more information\n")); | |
265 | fprintf(stderr, _(" -p, --programs display PID/Program name for sockets\n")); | |
266 | @@ -1521,6 +1533,9 @@ | |
267 | {"verbose", 0, 0, 'v'}, | |
268 | {"statistics", 0, 0, 's'}, | |
269 | {"numeric", 0, 0, 'n'}, | |
270 | + {"numeric-hosts", 0, 0, '!'}, | |
271 | + {"numeric-ports", 0, 0, '@'}, | |
272 | + {"numeric-users", 0, 0, '#'}, | |
273 | {"symbolic", 0, 0, 'N'}, | |
274 | {"cache", 0, 0, 'C'}, | |
275 | {"fib", 0, 0, 'F'}, | |
276 | @@ -1579,10 +1594,18 @@ | |
277 | case 'i': | |
278 | flag_int++; | |
279 | break; | |
280 | - | |
281 | case 'n': | |
282 | flag_not |= FLAG_NUM; | |
283 | break; | |
284 | + case '!': | |
285 | + flag_not |= FLAG_NUM_HOST; | |
286 | + break; | |
287 | + case '@': | |
288 | + flag_not |= FLAG_NUM_PORT; | |
289 | + break; | |
290 | + case '#': | |
291 | + flag_not |= FLAG_NUM_USER; | |
292 | + break; | |
293 | case 'N': | |
294 | flag_not |= FLAG_SYM; | |
295 | break; | |
296 | @@ -1645,7 +1668,8 @@ | |
297 | strcpy(afname, DFLT_AF); | |
298 | #endif | |
299 | for (;;) { | |
300 | - i = ip_masq_info(flag_not, flag_exp); | |
301 | + i = ip_masq_info(flag_not & FLAG_NUM_HOST, | |
302 | + flag_not & FLAG_NUM_PORT, flag_exp); | |
303 | if (i || !flag_cnt) | |
304 | break; | |
305 | sleep(1); |