quip_client.c revision 1.2 1 1.2 itojun /* $KAME: quip_client.c,v 1.3 2001/08/15 12:51:59 kjc Exp $ */
2 1.1 thorpej /*
3 1.1 thorpej * Copyright (C) 1999-2000
4 1.1 thorpej * Sony Computer Science Laboratories, Inc. All rights reserved.
5 1.1 thorpej *
6 1.1 thorpej * Redistribution and use in source and binary forms, with or without
7 1.1 thorpej * modification, are permitted provided that the following conditions
8 1.1 thorpej * are met:
9 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
10 1.1 thorpej * notice, this list of conditions and the following disclaimer.
11 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
13 1.1 thorpej * documentation and/or other materials provided with the distribution.
14 1.1 thorpej *
15 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
16 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 1.1 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 1.1 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
19 1.1 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 1.1 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 1.1 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 1.1 thorpej * SUCH DAMAGE.
26 1.1 thorpej */
27 1.1 thorpej
28 1.1 thorpej #include <sys/param.h>
29 1.1 thorpej #include <sys/socket.h>
30 1.1 thorpej #include <sys/un.h>
31 1.1 thorpej
32 1.1 thorpej #include <stdio.h>
33 1.1 thorpej #include <stdlib.h>
34 1.1 thorpej #include <unistd.h>
35 1.1 thorpej #include <string.h>
36 1.1 thorpej #include <signal.h>
37 1.1 thorpej #include <errno.h>
38 1.1 thorpej #include <err.h>
39 1.1 thorpej
40 1.1 thorpej #include "quip_client.h"
41 1.1 thorpej #include "altqstat.h"
42 1.1 thorpej
43 1.1 thorpej /*
44 1.1 thorpej * quip (queue information protocol) is a http-like protocol
45 1.1 thorpej * in order to retrieve information from the server.
46 1.1 thorpej * a unix domain TCP socket "/var/run/altq_quip" is used for
47 1.1 thorpej * clinet-server style communication.
48 1.1 thorpej *
49 1.1 thorpej * there are 2 quip message types: request and response.
50 1.1 thorpej * request format: (only single-line request message is used at this moment)
51 1.1 thorpej * request-line
52 1.1 thorpej *
53 1.1 thorpej * request-line = <method> <operation>[?<query>] <quip-version>
54 1.1 thorpej * <method> = GET (only GET is defined at this moment)
55 1.1 thorpej * <operation> = list | handle-to-name | qdisc | filter
56 1.1 thorpej * query format is operation dependent but most query takes
57 1.1 thorpej * <interface> or <class> or <filter>.
58 1.1 thorpej * <interface> = <if_name>
59 1.1 thorpej * <class> = <if_name>:<class_path>/<class_name>
60 1.1 thorpej * <filter> = <if_name>:<class_path>/<class_name>:<filter_name>
61 1.1 thorpej * "list" operation accepts "*" as a wildcard.
62 1.1 thorpej *
63 1.1 thorpej * response format:
64 1.1 thorpej * status-line
65 1.1 thorpej * response-headers (0 or more)
66 1.1 thorpej * <blank line>
67 1.1 thorpej * body
68 1.1 thorpej *
69 1.1 thorpej * status-line = <quip-version> <status-code> <reason phrase>
70 1.1 thorpej * response-header = Content-Length:<value>
71 1.1 thorpej *
72 1.1 thorpej * "Content-Length" specifies the length of the message body.
73 1.1 thorpej *
74 1.1 thorpej * example:
75 1.1 thorpej * to retrieve a list of classes (handle and name) on interface "fxp0":
76 1.1 thorpej * a request message looks like,
77 1.1 thorpej * GET list?fxp0:* QUIP/1.0<cr>
78 1.1 thorpej * a response message looks like,
79 1.1 thorpej * QUIP/1.0 200 OK<cr>
80 1.1 thorpej * Content-Length:86<cr>
81 1.1 thorpej * <cr>
82 1.1 thorpej * 0000000000 fxp0:/root<cr>
83 1.1 thorpej * 0xc0d1be00 fxp0:/root/parent<cr>
84 1.1 thorpej * 0xc0d1ba00 fxp0:/root/parent/child<cr>
85 1.1 thorpej *
86 1.1 thorpej * other examples:
87 1.1 thorpej * list all interfaces, classes, and filters:
88 1.1 thorpej * GET list QUIP/1.0<cr>
89 1.1 thorpej * list all interfaces:
90 1.1 thorpej * GET list?* QUIP/1.0<cr>
91 1.1 thorpej * list all classes:
92 1.1 thorpej * GET list?*:* QUIP/1.0<cr>
93 1.1 thorpej * list all filters:
94 1.1 thorpej * GET list?*:*:* QUIP/1.0<cr>
95 1.1 thorpej * convert class handle to class name:
96 1.1 thorpej * GET handle-to-name?fxp0:0xc0d1be00 QUIP/1.0<cr>
97 1.1 thorpej * convert filter handle to filter name:
98 1.1 thorpej * GET handle-to-name?fxp0::0x1000000a QUIP/1.0<cr>
99 1.1 thorpej */
100 1.1 thorpej
101 1.1 thorpej enum nametype { INTERFACE, CLASS, FILTER, CONDITIONER };
102 1.1 thorpej
103 1.1 thorpej static FILE *server = NULL;
104 1.1 thorpej int quip_echo = 0;
105 1.1 thorpej
106 1.2 itojun static char *extract_ifname(const char *);
107 1.1 thorpej
108 1.1 thorpej int
109 1.1 thorpej quip_openserver(void)
110 1.1 thorpej {
111 1.1 thorpej struct sockaddr_un addr;
112 1.1 thorpej int fd;
113 1.1 thorpej
114 1.1 thorpej if ((fd = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0)
115 1.1 thorpej err(1, "can't open socket");
116 1.1 thorpej
117 1.1 thorpej bzero(&addr, sizeof(addr));
118 1.1 thorpej addr.sun_family = AF_LOCAL;
119 1.2 itojun strlcpy(addr.sun_path, QUIP_PATH,sizeof(addr.sun_path));
120 1.1 thorpej
121 1.1 thorpej if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
122 1.1 thorpej fprintf(stderr, "can't talk to altqd!\n"
123 1.1 thorpej "probably, altqd is not running\n");
124 1.1 thorpej return (-1);
125 1.1 thorpej }
126 1.1 thorpej
127 1.1 thorpej if ((server = fdopen(fd, "r+")) == NULL) {
128 1.1 thorpej warn("fdopen: can't open stream to the quip server");
129 1.1 thorpej return (-1);
130 1.1 thorpej }
131 1.1 thorpej return (0);
132 1.1 thorpej }
133 1.1 thorpej
134 1.1 thorpej int
135 1.1 thorpej quip_closeserver(void)
136 1.1 thorpej {
137 1.1 thorpej if (server != NULL)
138 1.1 thorpej return fclose(server);
139 1.1 thorpej return (0);
140 1.1 thorpej }
141 1.1 thorpej
142 1.1 thorpej void
143 1.1 thorpej quip_sendrequest(FILE *fp, const char *request)
144 1.1 thorpej {
145 1.2 itojun char buf[QUIPMSG_MAXSIZE], *cp;
146 1.1 thorpej int n;
147 1.1 thorpej
148 1.1 thorpej if ((cp = strstr(request, "QUIP")) == NULL) {
149 1.1 thorpej cp = strchr(request, '\n');
150 1.1 thorpej n = cp - request;
151 1.2 itojun if (cp == NULL || n > REQ_MAXSIZE - 10)
152 1.2 itojun return;
153 1.1 thorpej strncpy(buf, request, n);
154 1.2 itojun n += snprintf(buf + n, REQ_MAXSIZE - n, " QUIP/1.0");
155 1.2 itojun strlcpy(buf + n, cp, REQ_MAXSIZE - n);
156 1.1 thorpej }
157 1.1 thorpej else
158 1.2 itojun strlcpy(buf, request, REQ_MAXSIZE);
159 1.1 thorpej
160 1.1 thorpej if (fputs(buf, fp) != 0)
161 1.1 thorpej err(1, "fputs");
162 1.1 thorpej if (fflush(fp) != 0)
163 1.1 thorpej err(1, "fflush");
164 1.1 thorpej if (quip_echo) {
165 1.1 thorpej fputs("<< ", stdout);
166 1.1 thorpej fputs(buf, stdout);
167 1.1 thorpej }
168 1.1 thorpej }
169 1.1 thorpej
170 1.1 thorpej /*
171 1.1 thorpej * recv_response receives a response message from the server
172 1.1 thorpej * and returns status_code.
173 1.1 thorpej */
174 1.1 thorpej int
175 1.1 thorpej quip_recvresponse(FILE *fp, char *header, char *body, int *blen)
176 1.1 thorpej {
177 1.2 itojun char buf[QUIPMSG_MAXSIZE], version[64];
178 1.1 thorpej int code, resid;
179 1.1 thorpej int end_of_header = 0;
180 1.1 thorpej
181 1.1 thorpej if (blen != NULL)
182 1.1 thorpej *blen = 0;
183 1.1 thorpej code = 0;
184 1.1 thorpej resid = 0;
185 1.2 itojun while (fgets(buf, sizeof(buf), fp) != 0) {
186 1.1 thorpej if (quip_echo) {
187 1.1 thorpej fputs("> ", stdout);
188 1.1 thorpej fputs(buf, stdout);
189 1.1 thorpej }
190 1.1 thorpej
191 1.1 thorpej if (!end_of_header) {
192 1.1 thorpej /* process message header */
193 1.1 thorpej if (header != NULL)
194 1.2 itojun header += snprintf(header, RES_MAXSIZE, "%s", buf);
195 1.1 thorpej
196 1.1 thorpej if (code == 0) {
197 1.1 thorpej /* status line expected */
198 1.1 thorpej if (buf[0] == '\n') {
199 1.1 thorpej /* ignore blank lines */
200 1.1 thorpej }
201 1.1 thorpej else if (sscanf(buf, "%s %d",
202 1.1 thorpej version, &code) != 2) {
203 1.1 thorpej /* can't get result code */
204 1.1 thorpej fpurge(fp);
205 1.1 thorpej return (-1);
206 1.1 thorpej }
207 1.1 thorpej }
208 1.1 thorpej else {
209 1.1 thorpej /* entity header expected */
210 1.1 thorpej char *field, *cp;
211 1.1 thorpej
212 1.1 thorpej if (buf[0] == '\n') {
213 1.1 thorpej /* end of header */
214 1.1 thorpej end_of_header = 1;
215 1.1 thorpej if (resid == 0)
216 1.1 thorpej /* no message body */
217 1.1 thorpej return (code);
218 1.1 thorpej }
219 1.1 thorpej
220 1.1 thorpej cp = buf;
221 1.1 thorpej field = strsep(&cp, ":");
222 1.1 thorpej if (strcmp(field, "Content-Length") == 0) {
223 1.2 itojun if (sscanf(cp, "%d", &resid) != 1) {
224 1.2 itojun fpurge(fp);
225 1.2 itojun return (-1);
226 1.2 itojun }
227 1.1 thorpej if (blen != NULL)
228 1.1 thorpej *blen = resid;
229 1.1 thorpej }
230 1.1 thorpej }
231 1.1 thorpej }
232 1.1 thorpej else {
233 1.1 thorpej /* process message body */
234 1.1 thorpej int len;
235 1.1 thorpej
236 1.1 thorpej if (body != NULL) {
237 1.2 itojun len = snprintf(body, BODY_MAXSIZE, "%s", buf);
238 1.1 thorpej body += len;
239 1.1 thorpej }
240 1.1 thorpej else
241 1.1 thorpej len = strlen(buf);
242 1.1 thorpej resid -= len;
243 1.1 thorpej if (resid <= 0)
244 1.1 thorpej return (code);
245 1.1 thorpej }
246 1.1 thorpej }
247 1.1 thorpej return (-1);
248 1.1 thorpej }
249 1.1 thorpej
250 1.1 thorpej void
251 1.1 thorpej quip_rawmode(void)
252 1.1 thorpej {
253 1.1 thorpej char line[1024];
254 1.1 thorpej int result_code;
255 1.1 thorpej
256 1.1 thorpej printf(">>>Entering the raw interactive mode to the server:\n\n");
257 1.1 thorpej if (server == NULL) {
258 1.1 thorpej printf("No server available!\n");
259 1.1 thorpej return;
260 1.1 thorpej }
261 1.1 thorpej
262 1.1 thorpej while (1) {
263 1.1 thorpej printf("%% "); fflush(stdout);
264 1.1 thorpej /* read a line from stdin */
265 1.1 thorpej if (fgets(line, 1024, stdin) == NULL)
266 1.1 thorpej break;
267 1.1 thorpej
268 1.1 thorpej if (line[0] == '\n') {
269 1.1 thorpej /* if a blank line, echo locally */
270 1.1 thorpej fputs(line, stdout);
271 1.1 thorpej continue;
272 1.1 thorpej }
273 1.1 thorpej if (line[0] == 'q') {
274 1.1 thorpej printf("Exit\n");
275 1.1 thorpej break;
276 1.1 thorpej }
277 1.1 thorpej
278 1.1 thorpej /* send the input line to the server */
279 1.1 thorpej quip_sendrequest(server, line);
280 1.1 thorpej
281 1.1 thorpej /* get a response message from the server */
282 1.1 thorpej result_code = quip_recvresponse(server, NULL, NULL, NULL);
283 1.1 thorpej }
284 1.1 thorpej }
285 1.1 thorpej
286 1.1 thorpej char *
287 1.1 thorpej quip_selectinterface(char *ifname)
288 1.1 thorpej {
289 1.1 thorpej char buf[8192], *cp;
290 1.1 thorpej int result_code, len;
291 1.1 thorpej u_int if_index;
292 1.1 thorpej static char interface[64];
293 1.1 thorpej
294 1.1 thorpej if (server == NULL)
295 1.1 thorpej return (ifname);
296 1.1 thorpej
297 1.1 thorpej /* get an inferface list from the server */
298 1.1 thorpej quip_sendrequest(server, "GET list?*\n");
299 1.1 thorpej
300 1.1 thorpej result_code = quip_recvresponse(server, NULL, buf, &len);
301 1.1 thorpej if (result_code != 200)
302 1.1 thorpej errx(1, "can't get interface list");
303 1.1 thorpej
304 1.1 thorpej cp = buf;
305 1.1 thorpej while (1) {
306 1.1 thorpej if (sscanf(cp, "%x %s", &if_index, interface) != 2)
307 1.1 thorpej break;
308 1.1 thorpej if (ifname == NULL) {
309 1.1 thorpej /* if name isn't specified, return the 1st entry */
310 1.1 thorpej return (interface);
311 1.1 thorpej }
312 1.1 thorpej if (strcmp(ifname, interface) == 0)
313 1.1 thorpej /* found the matching entry */
314 1.1 thorpej
315 1.1 thorpej return (interface);
316 1.1 thorpej if ((cp = strchr(cp+1, '\n')) == NULL)
317 1.1 thorpej break;
318 1.1 thorpej }
319 1.1 thorpej errx(1, "can't get interface");
320 1.1 thorpej return (NULL);
321 1.1 thorpej }
322 1.1 thorpej
323 1.1 thorpej char *
324 1.1 thorpej quip_selectqdisc(char *ifname, char *qdisc_name)
325 1.1 thorpej {
326 1.2 itojun char buf[BODY_MAXSIZE], req[REQ_MAXSIZE];
327 1.1 thorpej int result_code, len;
328 1.1 thorpej static char qdisc[64];
329 1.1 thorpej
330 1.1 thorpej if (server == NULL) {
331 1.1 thorpej if (ifname == NULL || qdisc_name == NULL)
332 1.1 thorpej errx(1, "when disabling server communication,\n"
333 1.1 thorpej "specify both interface (-i) and qdisc (-q)!");
334 1.1 thorpej return (qdisc_name);
335 1.1 thorpej }
336 1.1 thorpej
337 1.1 thorpej /* get qdisc info from the server */
338 1.2 itojun snprintf(req, sizeof(req), "GET qdisc?%s\n", ifname);
339 1.1 thorpej quip_sendrequest(server, req);
340 1.1 thorpej
341 1.1 thorpej result_code = quip_recvresponse(server, NULL, buf, &len);
342 1.1 thorpej if (result_code != 200)
343 1.1 thorpej errx(1, "can't get qdisc info");
344 1.1 thorpej
345 1.1 thorpej if (sscanf(buf, "%s", qdisc) != 1)
346 1.1 thorpej errx(1, "can't get qdisc name");
347 1.1 thorpej
348 1.1 thorpej if (qdisc_name != NULL && strcmp(qdisc, qdisc_name) != 0)
349 1.1 thorpej errx(1, "qdisc %s on %s doesn't match specified qdisc %s",
350 1.1 thorpej qdisc, ifname, qdisc_name);
351 1.1 thorpej
352 1.1 thorpej return (qdisc);
353 1.1 thorpej }
354 1.1 thorpej
355 1.1 thorpej void
356 1.2 itojun quip_chandle2name(const char *ifname, u_long handle, char *name, size_t size)
357 1.1 thorpej {
358 1.2 itojun char buf[BODY_MAXSIZE], req[REQ_MAXSIZE], *cp;
359 1.1 thorpej int result_code, len;
360 1.1 thorpej
361 1.1 thorpej name[0] = '\0';
362 1.1 thorpej if (server == NULL)
363 1.1 thorpej return;
364 1.1 thorpej
365 1.1 thorpej /* get class name from the server */
366 1.2 itojun snprintf(req, sizeof(req), "GET handle-to-name?%s:%#lx\n", ifname, handle);
367 1.1 thorpej quip_sendrequest(server, req);
368 1.1 thorpej
369 1.1 thorpej result_code = quip_recvresponse(server, NULL, buf, &len);
370 1.1 thorpej if (result_code != 200)
371 1.1 thorpej errx(1, "can't get class name");
372 1.1 thorpej
373 1.1 thorpej if ((cp = strchr(buf, '\n')) != NULL)
374 1.1 thorpej *cp = '\0';
375 1.1 thorpej if ((cp = strrchr(buf, '/')) != NULL)
376 1.2 itojun strlcpy(name, cp+1, size);
377 1.1 thorpej }
378 1.1 thorpej
379 1.1 thorpej void
380 1.1 thorpej quip_printqdisc(const char *ifname)
381 1.1 thorpej {
382 1.2 itojun char buf[BODY_MAXSIZE], req[REQ_MAXSIZE], *cp;
383 1.1 thorpej int result_code, len;
384 1.1 thorpej
385 1.1 thorpej if (server == NULL) {
386 1.1 thorpej printf("No server available!\n");
387 1.1 thorpej return;
388 1.1 thorpej }
389 1.1 thorpej
390 1.1 thorpej /* get qdisc info from the server */
391 1.2 itojun snprintf(req, sizeof(req), "GET qdisc?%s\n", ifname);
392 1.1 thorpej quip_sendrequest(server, req);
393 1.1 thorpej
394 1.1 thorpej result_code = quip_recvresponse(server, NULL, buf, &len);
395 1.1 thorpej if (result_code != 200)
396 1.1 thorpej errx(1, "can't get qdisc info");
397 1.1 thorpej
398 1.1 thorpej /* replace newline by space */
399 1.1 thorpej cp = buf;
400 1.1 thorpej while ((cp = strchr(cp, '\n')) != NULL)
401 1.1 thorpej *cp = ' ';
402 1.1 thorpej
403 1.1 thorpej printf(" qdisc:%s\n", buf);
404 1.1 thorpej }
405 1.1 thorpej
406 1.1 thorpej void
407 1.1 thorpej quip_printfilter(const char *ifname, const u_long handle)
408 1.1 thorpej {
409 1.2 itojun char buf[BODY_MAXSIZE], req[REQ_MAXSIZE], *cp;
410 1.1 thorpej int result_code, len;
411 1.1 thorpej
412 1.1 thorpej /* get qdisc info from the server */
413 1.2 itojun snprintf(req, sizeof(req), "GET filter?%s::%#lx\n", ifname, handle);
414 1.1 thorpej quip_sendrequest(server, req);
415 1.1 thorpej
416 1.1 thorpej result_code = quip_recvresponse(server, NULL, buf, &len);
417 1.1 thorpej if (result_code != 200)
418 1.1 thorpej errx(1, "can't get filter info");
419 1.1 thorpej
420 1.1 thorpej if ((cp = strchr(buf, '\n')) != NULL)
421 1.1 thorpej *cp = '\0';
422 1.1 thorpej printf("%s", buf);
423 1.1 thorpej }
424 1.1 thorpej
425 1.1 thorpej static char *
426 1.1 thorpej extract_ifname(const char *name)
427 1.1 thorpej {
428 1.1 thorpej char *cp;
429 1.1 thorpej int len;
430 1.1 thorpej static char ifname[64];
431 1.1 thorpej
432 1.1 thorpej if ((cp = strchr(name, ':')) != NULL)
433 1.1 thorpej len = cp - name;
434 1.1 thorpej else
435 1.1 thorpej len = strlen(name);
436 1.1 thorpej len = MIN(len, 63);
437 1.1 thorpej strncpy(ifname, name, len);
438 1.1 thorpej ifname[len] = '\0';
439 1.1 thorpej return (ifname);
440 1.1 thorpej }
441 1.1 thorpej
442 1.1 thorpej void
443 1.1 thorpej quip_printconfig(void)
444 1.1 thorpej {
445 1.1 thorpej char buf[8192], name[256], *cp, *p, *flname;
446 1.1 thorpej int result_code, len;
447 1.1 thorpej enum nametype type;
448 1.1 thorpej u_long handle;
449 1.1 thorpej
450 1.1 thorpej /* get a total list from the server */
451 1.1 thorpej quip_sendrequest(server, "GET list\n");
452 1.1 thorpej
453 1.1 thorpej result_code = quip_recvresponse(server, NULL, buf, &len);
454 1.1 thorpej if (result_code != 200)
455 1.1 thorpej errx(1, "can't get total list");
456 1.1 thorpej
457 1.1 thorpej printf("------------ current configuration ------------");
458 1.1 thorpej
459 1.1 thorpej cp = buf;
460 1.1 thorpej while (1) {
461 1.1 thorpej if (sscanf(cp, "%lx %s", &handle, name) != 2)
462 1.1 thorpej break;
463 1.1 thorpej
464 1.1 thorpej if ((p = strchr(name, ':')) == NULL)
465 1.1 thorpej type = INTERFACE;
466 1.1 thorpej else if (strchr(p+1, ':') == NULL)
467 1.1 thorpej type = CLASS;
468 1.1 thorpej else
469 1.1 thorpej type = FILTER;
470 1.1 thorpej
471 1.1 thorpej switch (type) {
472 1.1 thorpej case INTERFACE:
473 1.1 thorpej printf("\ninterface: %s (index:%lu)\n",
474 1.1 thorpej name, handle);
475 1.1 thorpej quip_printqdisc(name);
476 1.1 thorpej break;
477 1.1 thorpej case CLASS:
478 1.1 thorpej printf("class: %s (handle:%#lx)\n",
479 1.1 thorpej name, handle);
480 1.1 thorpej break;
481 1.1 thorpej case FILTER:
482 1.1 thorpej flname = strrchr(name, ':') + 1;
483 1.1 thorpej printf(" filter: name:%s [", flname);
484 1.1 thorpej quip_printfilter(extract_ifname(name), handle);
485 1.1 thorpej printf("] (handle:%#lx)\n", handle);
486 1.1 thorpej break;
487 1.1 thorpej case CONDITIONER:
488 1.1 thorpej break;
489 1.1 thorpej }
490 1.1 thorpej
491 1.1 thorpej if ((cp = strchr(cp+1, '\n')) == NULL)
492 1.1 thorpej break;
493 1.1 thorpej }
494 1.1 thorpej printf("-----------------------------------------------\n\n");
495 1.1 thorpej }
496 1.1 thorpej
497