1 |
|
|
/* $OpenBSD: printconf.c,v 1.2 2011/04/10 22:12:34 jsg Exp $ */ |
2 |
|
|
|
3 |
|
|
/* |
4 |
|
|
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org> |
5 |
|
|
* |
6 |
|
|
* Permission to use, copy, modify, and distribute this software for any |
7 |
|
|
* purpose with or without fee is hereby granted, provided that the above |
8 |
|
|
* copyright notice and this permission notice appear in all copies. |
9 |
|
|
* |
10 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 |
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 |
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 |
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 |
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 |
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 |
|
|
*/ |
18 |
|
|
|
19 |
|
|
#include <sys/queue.h> |
20 |
|
|
#include <sys/types.h> |
21 |
|
|
#include <sys/socket.h> |
22 |
|
|
#include <netinet/in.h> |
23 |
|
|
#include <arpa/inet.h> |
24 |
|
|
|
25 |
|
|
#include <stdio.h> |
26 |
|
|
|
27 |
|
|
#include "igmp.h" |
28 |
|
|
#include "dvmrp.h" |
29 |
|
|
#include "dvmrpd.h" |
30 |
|
|
#include "dvmrpe.h" |
31 |
|
|
|
32 |
|
|
void print_mainconf(struct dvmrpd_conf *); |
33 |
|
|
void print_iface(struct iface *); |
34 |
|
|
|
35 |
|
|
void |
36 |
|
|
print_mainconf(struct dvmrpd_conf *conf) |
37 |
|
|
{ |
38 |
|
|
if (conf->flags & DVMRPD_FLAG_NO_FIB_UPDATE) |
39 |
|
|
printf("fib-update no\n"); |
40 |
|
|
else |
41 |
|
|
printf("fib-update yes\n"); |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
void |
45 |
|
|
print_iface(struct iface *iface) |
46 |
|
|
{ |
47 |
|
|
printf("interface %s {\n", iface->name); |
48 |
|
|
|
49 |
|
|
if (iface->passive) |
50 |
|
|
printf("\tpassive\n"); |
51 |
|
|
|
52 |
|
|
printf("\tmetric %d\n", iface->metric); |
53 |
|
|
printf("\tquery-interval %d\n", iface->query_interval); |
54 |
|
|
printf("\tquery-response-interval %d\n", iface->query_resp_interval); |
55 |
|
|
printf("\trobustness %d\n", iface->robustness); |
56 |
|
|
printf("\tstartup-query-count %d\n", iface->startup_query_cnt); |
57 |
|
|
printf("\tlast-member-query-count %d\n", iface->last_member_query_cnt); |
58 |
|
|
printf("\tlast-member-query-interval %d\n", |
59 |
|
|
iface->last_member_query_interval); |
60 |
|
|
printf("\tigmp-version %d\n", iface->igmp_version); |
61 |
|
|
|
62 |
|
|
printf("}\n"); |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
void |
66 |
|
|
print_config(struct dvmrpd_conf *conf) |
67 |
|
|
{ |
68 |
|
|
struct iface *iface; |
69 |
|
|
|
70 |
|
|
printf("\n"); |
71 |
|
|
print_mainconf(conf); |
72 |
|
|
printf("\n"); |
73 |
|
|
|
74 |
|
|
LIST_FOREACH(iface, &conf->iface_list, entry) { |
75 |
|
|
print_iface(iface); |
76 |
|
|
} |
77 |
|
|
printf("\n"); |
78 |
|
|
|
79 |
|
|
} |