3 * The olsr.org Optimized Link-State Routing daemon(olsrd)
4 * Copyright (c) 2004, Andreas Tonnesen(andreto@olsr.org)
5 * includes code by Bruno Randolf
6 * includes code by Andreas Lopatic
7 * includes code by Sven-Ola Tuecke
8 * includes code by Lorenz Schori
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
15 * * Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
21 * * Neither the name of olsr.org, olsrd nor the names of its
22 * contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
38 * Visit http://www.olsr.org for more information.
40 * If you find this software useful feel free to make a donation
41 * to the project. For more information see the website or contact
42 * the copyright holders.
47 * Dynamic linked library for the olsr.org olsr daemon
51 #include <sys/types.h>
52 #include <sys/socket.h>
54 #include <sys/select.h>
56 #include <netinet/in.h>
57 #include <arpa/inet.h>
69 #include "olsr_types.h"
70 #include "neighbor_table.h"
71 #include "two_hop_neighbor_table.h"
72 #include "mpr_selector_set.h"
78 #include "lq_plugin.h"
79 #include "common/autobuf.h"
82 #include "olsrd_txtinfo.h"
83 #include "olsrd_plugin.h"
86 #define close(x) closesocket(x)
89 static int ipc_socket;
91 /* IPC initialization function */
92 static int plugin_ipc_init(void);
94 static void send_info(int /*send_what*/, int /*socket*/);
96 static void ipc_action(int, void *, unsigned int);
98 static void ipc_print_neigh(struct autobuf *);
100 static void ipc_print_link(struct autobuf *);
102 static void ipc_print_routes(struct autobuf *);
104 static void ipc_print_topology(struct autobuf *);
106 static void ipc_print_hna(struct autobuf *);
108 static void ipc_print_mid(struct autobuf *);
110 static void ipc_print_gateway(struct autobuf *);
112 static void ipc_print_config(struct autobuf *);
114 #define TXT_IPC_BUFSIZE 256
123 #define SIW_NEIGHLINK 7
124 #define SIW_GATEWAY 8
127 #define MAX_CLIENTS 3
129 static char *outbuffer[MAX_CLIENTS];
130 static size_t outbuffer_size[MAX_CLIENTS];
131 static size_t outbuffer_written[MAX_CLIENTS];
132 static int outbuffer_socket[MAX_CLIENTS];
133 static int outbuffer_count;
135 static struct timer_entry *writetimer_entry;
138 *Do initialization here
140 *This function is called by the my_init
141 *function in uolsrd_plugin.c
144 olsrd_plugin_init(void)
146 /* Initial IPC value */
154 * destructor - called at unload
157 olsr_plugin_exit(void)
159 if (ipc_socket != -1)
164 plugin_ipc_init(void)
166 struct sockaddr_storage sst;
167 struct sockaddr_in *sock_in;
168 struct sockaddr_in6 *sin6;
172 /* Init ipc socket */
173 if ((ipc_socket = socket(olsr_cnf->ip_version, SOCK_STREAM, 0)) == -1) {
175 olsr_printf(1, "(TXTINFO) socket()=%s\n", strerror(errno));
179 if (setsockopt(ipc_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0) {
181 olsr_printf(1, "(TXTINFO) setsockopt()=%s\n", strerror(errno));
185 #if (defined __FreeBSD__ || defined __FreeBSD_kernel__) && defined SO_NOSIGPIPE
186 if (setsockopt(ipc_socket, SOL_SOCKET, SO_NOSIGPIPE, (char *)&yes, sizeof(yes)) < 0) {
187 perror("SO_REUSEADDR failed");
191 /* Bind the socket */
193 /* complete the socket structure */
194 memset(&sst, 0, sizeof(sst));
195 if (olsr_cnf->ip_version == AF_INET) {
196 sock_in = (struct sockaddr_in *)&sst;
197 sock_in->sin_family = AF_INET;
198 addrlen = sizeof(struct sockaddr_in);
200 sock_in->sin_len = addrlen;
202 sock_in->sin_addr.s_addr = txtinfo_listen_ip.v4.s_addr;
203 sock_in->sin_port = htons(ipc_port);
205 sin6 = (struct sockaddr_in6 *)&sst;
206 sin6->sin6_family = AF_INET6;
207 addrlen = sizeof(struct sockaddr_in6);
209 sin6->sin6_len = addrlen;
211 sin6->sin6_addr = txtinfo_listen_ip.v6;
212 sin6->sin6_port = htons(ipc_port);
215 /* bind the socket to the port number */
216 if (bind(ipc_socket, (struct sockaddr *)&sst, addrlen) == -1) {
218 olsr_printf(1, "(TXTINFO) bind()=%s\n", strerror(errno));
223 /* show that we are willing to listen */
224 if (listen(ipc_socket, 1) == -1) {
226 olsr_printf(1, "(TXTINFO) listen()=%s\n", strerror(errno));
231 /* Register with olsrd */
232 add_olsr_socket(ipc_socket, &ipc_action, NULL, NULL, SP_PR_READ);
235 olsr_printf(2, "(TXTINFO) listening on port %d\n", ipc_port);
242 ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int flags __attribute__ ((unused)))
244 struct sockaddr_storage pin;
245 struct sockaddr_in *sin4;
246 struct sockaddr_in6 *sin6;
247 char addr[INET6_ADDRSTRLEN];
253 socklen_t addrlen = sizeof(struct sockaddr_storage);
255 if ((ipc_connection = accept(fd, (struct sockaddr *)&pin, &addrlen)) == -1) {
257 olsr_printf(1, "(TXTINFO) accept()=%s\n", strerror(errno));
262 tv.tv_sec = tv.tv_usec = 0;
263 if (olsr_cnf->ip_version == AF_INET) {
264 sin4 = (struct sockaddr_in *)&pin;
265 if (inet_ntop(olsr_cnf->ip_version, &sin4->sin_addr, addr, INET6_ADDRSTRLEN) == NULL)
267 if (!ip4equal(&sin4->sin_addr, &txtinfo_accept_ip.v4) && txtinfo_accept_ip.v4.s_addr != INADDR_ANY) {
268 #ifdef TXTINFO_ALLOW_LOCALHOST
269 if (sin4->sin_addr.s_addr!=INADDR_LOOPBACK) {
271 olsr_printf(1, "(TXTINFO) From host(%s) not allowed!\n", addr);
272 close(ipc_connection);
274 #ifdef TXTINFO_ALLOW_LOCALHOST
279 sin6 = (struct sockaddr_in6 *)&pin;
280 if (inet_ntop(olsr_cnf->ip_version, &sin6->sin6_addr, addr, INET6_ADDRSTRLEN) == NULL)
282 /* Use in6addr_any (::) in olsr.conf to allow anybody. */
283 if (!ip6equal(&in6addr_any, &txtinfo_accept_ip.v6) && !ip6equal(&sin6->sin6_addr, &txtinfo_accept_ip.v6)) {
284 olsr_printf(1, "(TXTINFO) From host(%s) not allowed!\n", addr);
285 close(ipc_connection);
291 olsr_printf(2, "(TXTINFO) Connect from %s\n", addr);
294 /* purge read buffer to prevent blocking on linux */
296 FD_SET((unsigned int)ipc_connection, &rfds); /* Win32 needs the cast here */
297 if (0 <= select(ipc_connection + 1, &rfds, NULL, NULL, &tv)) {
299 ssize_t s = recv(ipc_connection, (void *)&requ, sizeof(requ), 0); /* Win32 needs the cast here */
302 /* To print out neighbours only on the Freifunk Status
303 * page the normal output is somewhat lengthy. The
304 * header parsing is sufficient for standard wget.
306 if (0 != strstr(requ, "/neighbours"))
307 send_what = SIW_NEIGHLINK;
308 else if (0 != strstr(requ, "/neigh"))
309 send_what = SIW_NEIGH;
310 else if (0 != strstr(requ, "/link"))
311 send_what = SIW_LINK;
312 else if (0 != strstr(requ, "/route"))
313 send_what = SIW_ROUTE;
314 else if (0 != strstr(requ, "/hna"))
316 else if (0 != strstr(requ, "/mid"))
318 else if (0 != strstr(requ, "/topo"))
319 send_what = SIW_TOPO;
320 else if (0 != strstr(requ, "/gateway"))
321 send_what = SIW_GATEWAY;
322 else if (0 != strstr(requ, "/config"))
323 send_what = SIW_CONFIG;
327 send_info(send_what, ipc_connection);
331 ipc_print_neigh(struct autobuf *abuf)
333 struct ipaddr_str buf1;
334 struct neighbor_entry *neigh;
335 struct neighbor_2_list_entry *list_2;
338 abuf_puts(abuf, "Table: Neighbors\nIP address\tSYM\tMPR\tMPRS\tWill.\t2 Hop Neighbors\n");
341 OLSR_FOR_ALL_NBR_ENTRIES(neigh) {
342 abuf_appendf(abuf, "%s\t%s\t%s\t%s\t%d\t", olsr_ip_to_string(&buf1, &neigh->neighbor_main_addr), (neigh->status == SYM) ? "YES" : "NO",
343 neigh->is_mpr ? "YES" : "NO", olsr_lookup_mprs_set(&neigh->neighbor_main_addr) ? "YES" : "NO", neigh->willingness);
346 for (list_2 = neigh->neighbor_2_list.next; list_2 != &neigh->neighbor_2_list; list_2 = list_2->next) {
347 //size += sprintf(&buf[size], "<option>%s</option>\n", olsr_ip_to_string(&buf1, &list_2->neighbor_2->neighbor_2_addr));
350 abuf_appendf(abuf, "%d\n", thop_cnt);
352 OLSR_FOR_ALL_NBR_ENTRIES_END(neigh);
353 abuf_puts(abuf, "\n");
357 ipc_print_link(struct autobuf *abuf)
359 struct ipaddr_str buf1, buf2;
360 struct lqtextbuffer lqbuffer1, lqbuffer2;
362 struct link_entry *my_link = NULL;
364 #ifdef ACTIVATE_VTIME_TXTINFO
365 abuf_puts(abuf, "Table: Links\nLocal IP\tRemote IP\tVTime\tLQ\tNLQ\tCost\n");
367 abuf_puts(abuf, "Table: Links\nLocal IP\tRemote IP\tHyst.\tLQ\tNLQ\tCost\n");
371 OLSR_FOR_ALL_LINK_ENTRIES(my_link) {
372 #ifdef ACTIVATE_VTIME_TXTINFO
373 int diff = (unsigned int)(my_link->link_timer->timer_clock - now_times);
375 abuf_appendf(abuf, "%s\t%s\t%d.%03d\t%s\t%s\t\n", olsr_ip_to_string(&buf1, &my_link->local_iface_addr),
376 olsr_ip_to_string(&buf2, &my_link->neighbor_iface_addr),
377 diff/1000, abs(diff%1000),
378 get_link_entry_text(my_link, '\t', &lqbuffer1),
379 get_linkcost_text(my_link->linkcost, false, &lqbuffer2));
381 abuf_appendf(abuf, "%s\t%s\t0.00\t%s\t%s\t\n", olsr_ip_to_string(&buf1, &my_link->local_iface_addr),
382 olsr_ip_to_string(&buf2, &my_link->neighbor_iface_addr),
383 get_link_entry_text(my_link, '\t', &lqbuffer1),
384 get_linkcost_text(my_link->linkcost, false, &lqbuffer2));
386 } OLSR_FOR_ALL_LINK_ENTRIES_END(my_link);
388 abuf_puts(abuf, "\n");
392 ipc_print_routes(struct autobuf *abuf)
394 struct ipaddr_str buf1, buf2;
396 struct lqtextbuffer lqbuffer;
398 abuf_puts(abuf, "Table: Routes\nDestination\tGateway IP\tMetric\tETX\tInterface\n");
400 /* Walk the route table */
401 OLSR_FOR_ALL_RT_ENTRIES(rt) {
402 abuf_appendf(abuf, "%s/%d\t%s\t%d\t%s\t%s\t\n", olsr_ip_to_string(&buf1, &rt->rt_dst.prefix), rt->rt_dst.prefix_len,
403 olsr_ip_to_string(&buf2, &rt->rt_best->rtp_nexthop.gateway), rt->rt_best->rtp_metric.hops,
404 get_linkcost_text(rt->rt_best->rtp_metric.cost, true, &lqbuffer),
405 if_ifwithindex_name(rt->rt_best->rtp_nexthop.iif_index));
406 } OLSR_FOR_ALL_RT_ENTRIES_END(rt);
408 abuf_puts(abuf, "\n");
413 ipc_print_topology(struct autobuf *abuf)
417 #ifdef ACTIVATE_VTIME_TXTINFO
418 abuf_puts(abuf, "Table: Topology\nDest. IP\tLast hop IP\tLQ\tNLQ\tCost\tVTime\n");
420 abuf_puts(abuf, "Table: Topology\nDest. IP\tLast hop IP\tLQ\tNLQ\tCost\n");
424 OLSR_FOR_ALL_TC_ENTRIES(tc) {
425 struct tc_edge_entry *tc_edge;
426 OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
427 if (tc_edge->edge_inv) {
428 struct ipaddr_str dstbuf, addrbuf;
429 struct lqtextbuffer lqbuffer1, lqbuffer2;
430 #ifdef ACTIVATE_VTIME_TXTINFO
431 uint32_t vt = tc->validity_timer != NULL ? (tc->validity_timer->timer_clock - now_times) : 0;
432 int diff = (int)(vt);
433 abuf_appendf(abuf, "%s\t%s\t%s\t%s\t%d.%03d\n", olsr_ip_to_string(&dstbuf, &tc_edge->T_dest_addr),
434 olsr_ip_to_string(&addrbuf, &tc->addr),
435 get_tc_edge_entry_text(tc_edge, '\t', &lqbuffer1),
436 get_linkcost_text(tc_edge->cost, false, &lqbuffer2),
437 diff/1000, diff%1000);
439 abuf_appendf(abuf, "%s\t%s\t%s\t%s\n", olsr_ip_to_string(&dstbuf, &tc_edge->T_dest_addr), olsr_ip_to_string(&addrbuf, &tc->addr),
440 get_tc_edge_entry_text(tc_edge, '\t', &lqbuffer1), get_linkcost_text(tc_edge->cost, false, &lqbuffer2));
443 } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge);
444 } OLSR_FOR_ALL_TC_ENTRIES_END(tc);
446 abuf_puts(abuf, "\n");
450 ipc_print_hna(struct autobuf *abuf)
453 struct ip_prefix_list *hna;
454 struct hna_entry *tmp_hna;
455 struct hna_net *tmp_net;
456 struct ipaddr_str buf, mainaddrbuf;
460 #ifdef ACTIVATE_VTIME_TXTINFO
461 abuf_puts(abuf, "Table: HNA\nDestination\tGateway\tVTime\n");
463 abuf_puts(abuf, "Table: HNA\nDestination\tGateway\n");
464 #endif /*vtime txtinfo*/
466 /* Announced HNA entries */
467 if (olsr_cnf->ip_version == AF_INET) {
468 for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) {
469 abuf_appendf(abuf, "%s/%d\t%s\n", olsr_ip_to_string(&buf, &hna->net.prefix), hna->net.prefix_len,
470 olsr_ip_to_string(&mainaddrbuf, &olsr_cnf->main_addr));
473 for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) {
474 abuf_appendf(abuf, "%s/%d\t%s\n", olsr_ip_to_string(&buf, &hna->net.prefix), hna->net.prefix_len,
475 olsr_ip_to_string(&mainaddrbuf, &olsr_cnf->main_addr));
480 OLSR_FOR_ALL_HNA_ENTRIES(tmp_hna) {
482 /* Check all networks */
483 for (tmp_net = tmp_hna->networks.next; tmp_net != &tmp_hna->networks; tmp_net = tmp_net->next) {
484 #ifdef ACTIVATE_VTIME_TXTINFO
485 uint32_t vt = tmp_net->hna_net_timer != NULL ? (tmp_net->hna_net_timer->timer_clock - now_times) : 0;
486 int diff = (int)(vt);
487 abuf_appendf(abuf, "%s/%d\t%s\t\%d.%03d\n", olsr_ip_to_string(&buf, &tmp_net->A_network_addr), tmp_net->prefixlen,
488 olsr_ip_to_string(&mainaddrbuf, &tmp_hna->A_gateway_addr),
489 diff/1000, abs(diff%1000));
491 abuf_appendf(abuf, "%s/%d\t%s\n", olsr_ip_to_string(&buf, &tmp_net->hna_prefix.prefix),
492 tmp_net->hna_prefix.prefix_len, olsr_ip_to_string(&mainaddrbuf, &tmp_hna->A_gateway_addr));
493 #endif /*vtime txtinfo*/
496 OLSR_FOR_ALL_HNA_ENTRIES_END(tmp_hna);
498 abuf_puts(abuf, "\n");
502 ipc_print_mid(struct autobuf *abuf)
505 unsigned short is_first;
506 struct mid_entry *entry;
507 struct mid_address *alias;
508 #ifdef ACTIVATE_VTIME_TXTINFO
509 abuf_puts(abuf, "Table: MID\nIP address\tAlias\tVTime\n");
511 abuf_puts(abuf, "Table: MID\nIP address\tAliases\n");
512 #endif /*vtime txtinfo*/
515 for (idx = 0; idx < HASHSIZE; idx++) {
516 entry = mid_set[idx].next;
518 while (entry != &mid_set[idx]) {
519 #ifdef ACTIVATE_VTIME_TXTINFO
520 struct ipaddr_str buf, buf2;
522 struct ipaddr_str buf;
523 abuf_puts(abuf, olsr_ip_to_string(&buf, &entry->main_addr));
524 #endif /*vtime txtinfo*/
525 alias = entry->aliases;
529 #ifdef ACTIVATE_VTIME_TXTINFO
530 uint32_t vt = alias->vtime - now_times;
531 int diff = (int)(vt);
533 abuf_appendf(abuf, "%s\t%s\t%d.%03d\n",
534 olsr_ip_to_string(&buf, &entry->main_addr),
535 olsr_ip_to_string(&buf2, &alias->alias),
536 diff/1000, abs(diff%1000));
538 abuf_appendf(abuf, "%s%s", (is_first ? "\t" : ";"), olsr_ip_to_string(&buf, &alias->alias));
539 #endif /*vtime txtinfo*/
540 alias = alias->next_alias;
544 #ifndef ACTIVATE_VTIME_TXTINFO
545 abuf_puts(abuf,"\n");
546 #endif /*vtime txtinfo*/
549 abuf_puts(abuf, "\n");
553 ipc_print_gateway(struct autobuf *abuf)
556 abuf_puts(abuf, "Gateway mode is only supported in linux\n");
558 static const char IPV4[] = "ipv4";
559 static const char IPV4_NAT[] = "ipv4(n)";
560 static const char IPV6[] = "ipv6";
561 static const char NONE[] = "-";
563 struct ipaddr_str buf;
564 struct gateway_entry *gw;
565 struct lqtextbuffer lqbuf;
567 // Status IP ETX Hopcount Uplink-Speed Downlink-Speed ipv4/ipv4-nat/- ipv6/- ipv6-prefix/-
568 abuf_puts(abuf, "Table: Gateways\n Gateway\tETX\tHopcnt\tUplink\tDownlnk\tIPv4\tIPv6\tPrefix\n");
569 OLSR_FOR_ALL_GATEWAY_ENTRIES(gw) {
570 char v4 = '-', v6 = '-';
571 bool autoV4 = false, autoV6 = false;
572 const char *v4type = NONE, *v6type = NONE;
575 if ((tc = olsr_lookup_tc_entry(&gw->originator)) == NULL) {
579 if (gw == olsr_get_ipv4_inet_gateway(&autoV4)) {
580 v4 = autoV4 ? 'a' : 's';
582 else if (gw->ipv4 && (olsr_cnf->ip_version == AF_INET || olsr_cnf->use_niit)
583 && (olsr_cnf->smart_gw_allow_nat || !gw->ipv4nat)) {
587 if (gw == olsr_get_ipv6_inet_gateway(&autoV6)) {
588 v6 = autoV6 ? 'a' : 's';
590 else if (gw->ipv6 && olsr_cnf->ip_version == AF_INET6) {
595 v4type = gw->ipv4nat ? IPV4_NAT : IPV4;
601 abuf_appendf(abuf, "%c%c %s\t%s\t%d\t%u\t%u\t%s\t%s\t%s\n",
602 v4, v6, olsr_ip_to_string(&buf, &gw->originator),
603 get_linkcost_text(tc->path_cost, true, &lqbuf), tc->hops,
604 gw->uplink, gw->downlink, v4type, v6type,
605 gw->external_prefix.prefix_len == 0 ? NONE : olsr_ip_prefix_to_string(&gw->external_prefix));
606 } OLSR_FOR_ALL_GATEWAY_ENTRIES_END(gw)
611 ipc_print_config(struct autobuf *abuf)
613 olsrd_write_cnf_autobuf(abuf, olsr_cnf);
617 txtinfo_write_data(void *foo __attribute__ ((unused))) {
619 int result, i, j, max;
624 for (i=0; i<outbuffer_count; i++) {
625 /* And we cast here since we get a warning on Win32 */
626 FD_SET((unsigned int)(outbuffer_socket[i]), &set);
628 if (outbuffer_socket[i] > max) {
629 max = outbuffer_socket[i];
636 result = select(max + 1, NULL, &set, NULL, &tv);
641 for (i=0; i<outbuffer_count; i++) {
642 if (FD_ISSET(outbuffer_socket[i], &set)) {
643 result = send(outbuffer_socket[i], outbuffer[i] + outbuffer_written[i], outbuffer_size[i] - outbuffer_written[i], 0);
645 outbuffer_written[i] += result;
648 if (result <= 0 || outbuffer_written[i] == outbuffer_size[i]) {
649 /* close this socket and cleanup*/
650 close(outbuffer_socket[i]);
653 for (j=i+1; j<outbuffer_count; j++) {
654 outbuffer[j-1] = outbuffer[j];
655 outbuffer_size[j-1] = outbuffer_size[j];
656 outbuffer_socket[j-1] = outbuffer_socket[j];
657 outbuffer_written[j-1] = outbuffer_written[j];
663 if (outbuffer_count == 0) {
664 olsr_stop_timer(writetimer_entry);
669 send_info(int send_what, int the_socket)
673 abuf_init(&abuf, 4096);
675 /* Print minimal http header */
676 abuf_puts(&abuf, "HTTP/1.0 200 OK\n");
677 abuf_puts(&abuf, "Content-type: text/plain\n\n");
679 /* Print tables to IPC socket */
681 /* links + Neighbors */
682 if ((send_what == SIW_ALL) || (send_what == SIW_NEIGHLINK) || (send_what == SIW_LINK))
683 ipc_print_link(&abuf);
685 if ((send_what == SIW_ALL) || (send_what == SIW_NEIGHLINK) || (send_what == SIW_NEIGH))
686 ipc_print_neigh(&abuf);
689 if ((send_what == SIW_ALL) || (send_what == SIW_TOPO))
690 ipc_print_topology(&abuf);
693 if ((send_what == SIW_ALL) || (send_what == SIW_HNA))
694 ipc_print_hna(&abuf);
697 if ((send_what == SIW_ALL) || (send_what == SIW_MID))
698 ipc_print_mid(&abuf);
701 if ((send_what == SIW_ALL) || (send_what == SIW_ROUTE))
702 ipc_print_routes(&abuf);
705 if (send_what == SIW_GATEWAY)
706 ipc_print_gateway(&abuf);
709 if (send_what == SIW_CONFIG)
710 ipc_print_config(&abuf);
712 outbuffer[outbuffer_count] = olsr_malloc(abuf.len, "txt output buffer");
713 outbuffer_size[outbuffer_count] = abuf.len;
714 outbuffer_written[outbuffer_count] = 0;
715 outbuffer_socket[outbuffer_count] = the_socket;
717 memcpy(outbuffer[outbuffer_count], abuf.buf, abuf.len);
720 if (outbuffer_count == 1) {
721 writetimer_entry = olsr_start_timer(100, 0, OLSR_TIMER_PERIODIC, &txtinfo_write_data, NULL, 0);
732 * indent-tabs-mode: nil