37d80e6e341873662fa8bae72726f89cbbea1c14
[project/usteer.git] / remote.c
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
14 *
15 * Copyright (C) 2020 embedd.ch
16 * Copyright (C) 2020 Felix Fietkau <nbd@nbd.name>
17 * Copyright (C) 2020 John Crispin <john@phrozen.org>
18 */
19
20 #define _GNU_SOURCE
21
22 #include <sys/types.h>
23 #include <sys/socket.h>
24 #include <netinet/in.h>
25 #include <net/if.h>
26 #include <arpa/inet.h>
27 #include <errno.h>
28 #include <unistd.h>
29
30 #include <libubox/vlist.h>
31 #include <libubox/avl-cmp.h>
32 #include <libubox/usock.h>
33 #include "usteer.h"
34 #include "remote.h"
35 #include "node.h"
36
37 static uint32_t local_id;
38 static struct uloop_fd remote_fd;
39 static struct uloop_timeout remote_timer;
40 static struct uloop_timeout reload_timer;
41
42 static struct blob_buf buf;
43 static uint32_t msg_seq;
44
45 struct interface {
46 struct vlist_node node;
47 int ifindex;
48 };
49
50 static void
51 interfaces_update_cb(struct vlist_tree *tree,
52 struct vlist_node *node_new,
53 struct vlist_node *node_old);
54
55 static int remote_host_cmp(const void *k1, const void *k2, void *ptr)
56 {
57 unsigned long v1 = (unsigned long) k1;
58 unsigned long v2 = (unsigned long) k2;
59
60 return v2 - v1;
61 }
62
63 static VLIST_TREE(interfaces, avl_strcmp, interfaces_update_cb, true, true);
64 LIST_HEAD(remote_nodes);
65 AVL_TREE(remote_hosts, remote_host_cmp, false, NULL);
66
67 static const char *
68 interface_name(struct interface *iface)
69 {
70 return iface->node.avl.key;
71 }
72
73 static void
74 interface_check(struct interface *iface)
75 {
76 iface->ifindex = if_nametoindex(interface_name(iface));
77 uloop_timeout_set(&reload_timer, 1);
78 }
79
80 static void
81 interface_init(struct interface *iface)
82 {
83 interface_check(iface);
84 }
85
86 static void
87 interface_free(struct interface *iface)
88 {
89 avl_delete(&interfaces.avl, &iface->node.avl);
90 free(iface);
91 }
92
93 static void
94 interfaces_update_cb(struct vlist_tree *tree,
95 struct vlist_node *node_new,
96 struct vlist_node *node_old)
97 {
98 struct interface *iface;
99
100 if (node_new && node_old) {
101 iface = container_of(node_new, struct interface, node);
102 free(iface);
103 iface = container_of(node_old, struct interface, node);
104 interface_check(iface);
105 } else if (node_old) {
106 iface = container_of(node_old, struct interface, node);
107 interface_free(iface);
108 } else {
109 iface = container_of(node_new, struct interface, node);
110 interface_init(iface);
111 }
112 }
113
114 void usteer_interface_add(const char *name)
115 {
116 struct interface *iface;
117 char *name_buf;
118
119 iface = calloc_a(sizeof(*iface), &name_buf, strlen(name) + 1);
120 strcpy(name_buf, name);
121 vlist_add(&interfaces, &iface->node, name_buf);
122 }
123
124 void config_set_interfaces(struct blob_attr *data)
125 {
126 struct blob_attr *cur;
127 int rem;
128
129 if (!data)
130 return;
131
132 if (!blobmsg_check_attr_list(data, BLOBMSG_TYPE_STRING))
133 return;
134
135 vlist_update(&interfaces);
136 blobmsg_for_each_attr(cur, data, rem) {
137 usteer_interface_add(blobmsg_data(cur));
138 }
139 vlist_flush(&interfaces);
140 }
141
142 void config_get_interfaces(struct blob_buf *buf)
143 {
144 struct interface *iface;
145 void *c;
146
147 c = blobmsg_open_array(buf, "interfaces");
148 vlist_for_each_element(&interfaces, iface, node) {
149 blobmsg_add_string(buf, NULL, interface_name(iface));
150 }
151 blobmsg_close_array(buf, c);
152 }
153
154 static void
155 interface_add_station(struct usteer_remote_node *node, struct blob_attr *data)
156 {
157 struct sta *sta;
158 struct sta_info *si;
159 struct apmsg_sta msg;
160 bool create;
161
162 if (!parse_apmsg_sta(&msg, data)) {
163 MSG(DEBUG, "Cannot parse station in message\n");
164 return;
165 }
166
167 if (msg.timeout <= 0) {
168 MSG(DEBUG, "Refuse to add an already expired station entry\n");
169 return;
170 }
171
172 sta = usteer_sta_get(msg.addr, true);
173 if (!sta)
174 return;
175
176 si = usteer_sta_info_get(sta, &node->node, &create);
177 if (!si)
178 return;
179
180 si->connected = msg.connected;
181 si->signal = msg.signal;
182 si->seen = current_time - msg.seen;
183 usteer_sta_info_update_timeout(si, msg.timeout);
184 }
185
186 static void
187 remote_node_free(struct usteer_remote_node *node)
188 {
189 struct usteer_remote_host *host = node->host;
190
191 list_del(&node->list);
192 list_del(&node->host_list);
193 usteer_sta_node_cleanup(&node->node);
194 free(node);
195
196 if (!list_empty(&host->nodes))
197 return;
198
199 avl_delete(&remote_hosts, &host->avl);
200 free(host->addr);
201 free(host);
202 }
203
204 static struct usteer_remote_host *
205 interface_get_host(const char *addr, unsigned long id)
206 {
207 struct usteer_remote_host *host;
208
209 host = avl_find_element(&remote_hosts, (void *)id, host, avl);
210 if (host)
211 goto out;
212
213 host = calloc(1, sizeof(*host));
214 host->avl.key = (void *)id;
215 INIT_LIST_HEAD(&host->nodes);
216 avl_insert(&remote_hosts, &host->avl);
217
218 out:
219 if (host->addr && !strcmp(host->addr, addr))
220 return host;
221
222 free(host->addr);
223 host->addr = strdup(addr);
224
225 return host;
226 }
227
228 static struct usteer_remote_node *
229 interface_get_node(struct usteer_remote_host *host, const char *name)
230 {
231 struct usteer_remote_node *node;
232 int addr_len = strlen(host->addr);
233 char *buf;
234
235 list_for_each_entry(node, &host->nodes, host_list)
236 if (!strcmp(node->name, name))
237 return node;
238
239 node = calloc_a(sizeof(*node), &buf, addr_len + 1 + strlen(name) + 1);
240 node->node.type = NODE_TYPE_REMOTE;
241
242 sprintf(buf, "%s#%s", host->addr, name);
243 node->node.avl.key = buf;
244 node->name = buf + addr_len + 1;
245 node->host = host;
246 INIT_LIST_HEAD(&node->node.sta_info);
247
248 list_add_tail(&node->list, &remote_nodes);
249 list_add_tail(&node->host_list, &host->nodes);
250
251 return node;
252 }
253
254 static void
255 interface_add_node(struct usteer_remote_host *host, struct blob_attr *data)
256 {
257 struct usteer_remote_node *node;
258 struct apmsg_node msg;
259 struct blob_attr *cur;
260 int rem;
261
262 if (!parse_apmsg_node(&msg, data)) {
263 MSG(DEBUG, "Cannot parse node in message\n");
264 return;
265 }
266
267 node = interface_get_node(host, msg.name);
268 node->check = 0;
269 node->node.freq = msg.freq;
270 node->node.n_assoc = msg.n_assoc;
271 node->node.max_assoc = msg.max_assoc;
272 node->node.noise = msg.noise;
273 node->node.load = msg.load;
274
275 memcpy(node->node.bssid, msg.bssid, sizeof(node->node.bssid));
276
277 snprintf(node->node.ssid, sizeof(node->node.ssid), "%s", msg.ssid);
278 usteer_node_set_blob(&node->node.rrm_nr, msg.rrm_nr);
279 usteer_node_set_blob(&node->node.node_info, msg.node_info);
280
281 blob_for_each_attr(cur, msg.stations, rem)
282 interface_add_station(node, cur);
283 }
284
285 static void
286 interface_recv_msg(struct interface *iface, char *addr_str, void *buf, int len)
287 {
288 struct usteer_remote_host *host;
289 struct blob_attr *data = buf;
290 struct apmsg msg;
291 struct blob_attr *cur;
292 int rem;
293
294 if (blob_pad_len(data) != len) {
295 MSG(DEBUG, "Invalid message length (header: %d, real: %d)\n", blob_pad_len(data), len);
296 return;
297 }
298
299 if (!parse_apmsg(&msg, data)) {
300 MSG(DEBUG, "Missing fields in message\n");
301 return;
302 }
303
304 if (msg.id == local_id)
305 return;
306
307 MSG(NETWORK, "Received message on %s (id=%08x->%08x seq=%d len=%d)\n",
308 interface_name(iface), msg.id, local_id, msg.seq, len);
309
310 host = interface_get_host(addr_str, msg.id);
311 usteer_node_set_blob(&host->host_info, msg.host_info);
312
313 blob_for_each_attr(cur, msg.nodes, rem)
314 interface_add_node(host, cur);
315 }
316
317 static struct interface *
318 interface_find_by_ifindex(int index)
319 {
320 struct interface *iface;
321
322 vlist_for_each_element(&interfaces, iface, node) {
323 if (iface->ifindex == index)
324 return iface;
325 }
326
327 return NULL;
328 }
329
330 static void
331 interface_recv_v4(struct uloop_fd *u, unsigned int events)
332 {
333 static char buf[APMGR_BUFLEN];
334 static char cmsg_buf[( CMSG_SPACE(sizeof(struct in_pktinfo)) + sizeof(int)) + 1];
335 static struct sockaddr_in sin;
336 char addr_str[INET_ADDRSTRLEN];
337 static struct iovec iov = {
338 .iov_base = buf,
339 .iov_len = sizeof(buf)
340 };
341 static struct msghdr msg = {
342 .msg_name = &sin,
343 .msg_namelen = sizeof(sin),
344 .msg_iov = &iov,
345 .msg_iovlen = 1,
346 .msg_control = cmsg_buf,
347 .msg_controllen = sizeof(cmsg_buf),
348 };
349 struct cmsghdr *cmsg;
350 int len;
351
352 do {
353 struct in_pktinfo *pkti = NULL;
354 struct interface *iface;
355
356 len = recvmsg(u->fd, &msg, 0);
357 if (len < 0) {
358 switch (errno) {
359 case EAGAIN:
360 return;
361 case EINTR:
362 continue;
363 default:
364 perror("recvmsg");
365 uloop_fd_delete(u);
366 return;
367 }
368 }
369
370 for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
371 if (cmsg->cmsg_type != IP_PKTINFO)
372 continue;
373
374 pkti = (struct in_pktinfo *) CMSG_DATA(cmsg);
375 }
376
377 if (!pkti) {
378 MSG(DEBUG, "Received packet without ifindex\n");
379 continue;
380 }
381
382 iface = interface_find_by_ifindex(pkti->ipi_ifindex);
383 if (!iface) {
384 MSG(DEBUG, "Received packet from unconfigured interface %d\n", pkti->ipi_ifindex);
385 continue;
386 }
387
388 inet_ntop(AF_INET, &sin.sin_addr, addr_str, sizeof(addr_str));
389
390 interface_recv_msg(iface, addr_str, buf, len);
391 } while (1);
392 }
393
394
395 static void interface_recv_v6(struct uloop_fd *u, unsigned int events){
396 static char buf[APMGR_BUFLEN];
397 static char cmsg_buf[( CMSG_SPACE(sizeof(struct in6_pktinfo)) + sizeof(int)) + 1];
398 static struct sockaddr_in6 sin;
399 static struct iovec iov = {
400 .iov_base = buf,
401 .iov_len = sizeof(buf)
402 };
403 static struct msghdr msg = {
404 .msg_name = &sin,
405 .msg_namelen = sizeof(sin),
406 .msg_iov = &iov,
407 .msg_iovlen = 1,
408 .msg_control = cmsg_buf,
409 .msg_controllen = sizeof(cmsg_buf),
410 };
411 struct cmsghdr *cmsg;
412 char addr_str[INET6_ADDRSTRLEN];
413 int len;
414
415 do {
416 struct in6_pktinfo *pkti = NULL;
417 struct interface *iface;
418
419 len = recvmsg(u->fd, &msg, 0);
420 if (len < 0) {
421 switch (errno) {
422 case EAGAIN:
423 return;
424 case EINTR:
425 continue;
426 default:
427 perror("recvmsg");
428 uloop_fd_delete(u);
429 return;
430 }
431 }
432
433 for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
434 if (cmsg->cmsg_type != IPV6_PKTINFO)
435 continue;
436
437 pkti = (struct in6_pktinfo *) CMSG_DATA(cmsg);
438 }
439
440 if (!pkti) {
441 MSG(DEBUG, "Received packet without ifindex\n");
442 continue;
443 }
444
445 iface = interface_find_by_ifindex(pkti->ipi6_ifindex);
446 if (!iface) {
447 MSG(DEBUG, "Received packet from unconfigured interface %d\n", pkti->ipi6_ifindex);
448 continue;
449 }
450
451 inet_ntop(AF_INET6, &sin.sin6_addr, addr_str, sizeof(addr_str));
452 if (sin.sin6_addr.s6_addr[0] == 0) {
453 /* IPv4 mapped address. Ignore. */
454 continue;
455 }
456
457 interface_recv_msg(iface, addr_str, buf, len);
458 } while (1);
459 }
460
461 static void interface_send_msg_v4(struct interface *iface, struct blob_attr *data)
462 {
463 static size_t cmsg_data[( CMSG_SPACE(sizeof(struct in_pktinfo)) / sizeof(size_t)) + 1];
464 static struct sockaddr_in a;
465 static struct iovec iov;
466 static struct msghdr m = {
467 .msg_name = (struct sockaddr *) &a,
468 .msg_namelen = sizeof(a),
469 .msg_iov = &iov,
470 .msg_iovlen = 1,
471 .msg_control = cmsg_data,
472 .msg_controllen = CMSG_LEN(sizeof(struct in_pktinfo)),
473 };
474 struct in_pktinfo *pkti;
475 struct cmsghdr *cmsg;
476
477 a.sin_family = AF_INET;
478 a.sin_port = htons(APMGR_PORT);
479 a.sin_addr.s_addr = ~0;
480
481 memset(cmsg_data, 0, sizeof(cmsg_data));
482 cmsg = CMSG_FIRSTHDR(&m);
483 cmsg->cmsg_len = m.msg_controllen;
484 cmsg->cmsg_level = IPPROTO_IP;
485 cmsg->cmsg_type = IP_PKTINFO;
486
487 pkti = (struct in_pktinfo *) CMSG_DATA(cmsg);
488 pkti->ipi_ifindex = iface->ifindex;
489
490 iov.iov_base = data;
491 iov.iov_len = blob_pad_len(data);
492
493 if (sendmsg(remote_fd.fd, &m, 0) < 0)
494 perror("sendmsg");
495 }
496
497
498 static void interface_send_msg_v6(struct interface *iface, struct blob_attr *data) {
499 static struct sockaddr_in6 groupSock = {};
500
501 groupSock.sin6_family = AF_INET6;
502 inet_pton(AF_INET6, APMGR_V6_MCAST_GROUP, &groupSock.sin6_addr);
503 groupSock.sin6_port = htons(APMGR_PORT);
504
505 setsockopt(remote_fd.fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, &iface->ifindex, sizeof(iface->ifindex));
506
507 if (sendto(remote_fd.fd, data, blob_pad_len(data), 0, (const struct sockaddr *)&groupSock, sizeof(groupSock)) < 0)
508 perror("sendmsg");
509 }
510
511 static void interface_send_msg(struct interface *iface, struct blob_attr *data){
512 if (config.ipv6) {
513 interface_send_msg_v6(iface, data);
514 } else {
515 interface_send_msg_v4(iface, data);
516 }
517 }
518
519 static void usteer_send_sta_info(struct sta_info *sta)
520 {
521 int seen = current_time - sta->seen;
522 void *c;
523
524 c = blob_nest_start(&buf, 0);
525 blob_put(&buf, APMSG_STA_ADDR, sta->sta->addr, 6);
526 blob_put_int8(&buf, APMSG_STA_CONNECTED, !!sta->connected);
527 blob_put_int32(&buf, APMSG_STA_SIGNAL, sta->signal);
528 blob_put_int32(&buf, APMSG_STA_SEEN, seen);
529 blob_put_int32(&buf, APMSG_STA_TIMEOUT, config.local_sta_timeout - seen);
530 blob_nest_end(&buf, c);
531 }
532
533 static void usteer_send_node(struct usteer_node *node, struct sta_info *sta)
534 {
535 void *c, *s, *r;
536
537 c = blob_nest_start(&buf, 0);
538
539 blob_put_string(&buf, APMSG_NODE_NAME, usteer_node_name(node));
540 blob_put_string(&buf, APMSG_NODE_SSID, node->ssid);
541 blob_put_int32(&buf, APMSG_NODE_FREQ, node->freq);
542 blob_put_int32(&buf, APMSG_NODE_NOISE, node->noise);
543 blob_put_int32(&buf, APMSG_NODE_LOAD, node->load);
544 blob_put_int32(&buf, APMSG_NODE_N_ASSOC, node->n_assoc);
545 blob_put_int32(&buf, APMSG_NODE_MAX_ASSOC, node->max_assoc);
546 blob_put(&buf, APMSG_NODE_BSSID, node->bssid, sizeof(node->bssid));
547 if (node->rrm_nr) {
548 r = blob_nest_start(&buf, APMSG_NODE_RRM_NR);
549 blobmsg_add_field(&buf, BLOBMSG_TYPE_ARRAY, "",
550 blobmsg_data(node->rrm_nr),
551 blobmsg_data_len(node->rrm_nr));
552 blob_nest_end(&buf, r);
553 }
554
555 if (node->node_info)
556 blob_put(&buf, APMSG_NODE_NODE_INFO,
557 blob_data(node->node_info),
558 blob_len(node->node_info));
559
560 s = blob_nest_start(&buf, APMSG_NODE_STATIONS);
561
562 if (sta) {
563 usteer_send_sta_info(sta);
564 } else {
565 list_for_each_entry(sta, &node->sta_info, node_list)
566 usteer_send_sta_info(sta);
567 }
568
569 blob_nest_end(&buf, s);
570
571 blob_nest_end(&buf, c);
572 }
573
574 static void
575 usteer_check_timeout(void)
576 {
577 struct usteer_remote_node *node, *tmp;
578 int timeout = config.remote_node_timeout;
579
580 list_for_each_entry_safe(node, tmp, &remote_nodes, list) {
581 if (node->check++ > timeout)
582 remote_node_free(node);
583 }
584 }
585
586 static void *
587 usteer_update_init(void)
588 {
589 blob_buf_init(&buf, 0);
590 blob_put_int32(&buf, APMSG_ID, local_id);
591 blob_put_int32(&buf, APMSG_SEQ, ++msg_seq);
592 if (host_info_blob)
593 blob_put(&buf, APMSG_HOST_INFO,
594 blob_data(host_info_blob),
595 blob_len(host_info_blob));
596
597 return blob_nest_start(&buf, APMSG_NODES);
598 }
599
600 static void
601 usteer_update_send(void *c)
602 {
603 struct interface *iface;
604
605 blob_nest_end(&buf, c);
606
607 vlist_for_each_element(&interfaces, iface, node)
608 interface_send_msg(iface, buf.head);
609 }
610
611 void
612 usteer_send_sta_update(struct sta_info *si)
613 {
614 void *c = usteer_update_init();
615 usteer_send_node(si->node, si);
616 usteer_update_send(c);
617 }
618
619 static void
620 usteer_send_update_timer(struct uloop_timeout *t)
621 {
622 struct usteer_node *node;
623 void *c;
624
625 usteer_update_time();
626 uloop_timeout_set(t, config.remote_update_interval);
627
628 if (!avl_is_empty(&local_nodes) || host_info_blob) {
629 c = usteer_update_init();
630 for_each_local_node(node)
631 usteer_send_node(node, NULL);
632
633 usteer_update_send(c);
634 }
635 usteer_check_timeout();
636 }
637
638 static int
639 usteer_init_local_id(void)
640 {
641 FILE *f;
642
643 f = fopen("/dev/urandom", "r");
644 if (!f) {
645 perror("fopen(/dev/urandom)");
646 return -1;
647 }
648
649 if (fread(&local_id, sizeof(local_id), 1, f) < 1)
650 return -1;
651
652 fclose(f);
653 return 0;
654 }
655
656 static int usteer_create_v4_socket() {
657 int yes = 1;
658 int fd;
659
660 fd = usock(USOCK_UDP | USOCK_SERVER | USOCK_NONBLOCK |
661 USOCK_NUMERIC | USOCK_IPV4ONLY,
662 "0.0.0.0", APMGR_PORT_STR);
663 if (fd < 0) {
664 perror("usock");
665 return - 1;
666 }
667
668 if (setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &yes, sizeof(yes)) < 0)
669 perror("setsockopt(IP_PKTINFO)");
670
671 if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &yes, sizeof(yes)) < 0)
672 perror("setsockopt(SO_BROADCAST)");
673
674 return fd;
675 }
676
677
678 static int usteer_create_v6_socket() {
679 struct interface *iface;
680 struct ipv6_mreq group;
681 int yes = 1;
682 int fd;
683
684 fd = usock(USOCK_UDP | USOCK_SERVER | USOCK_NONBLOCK |
685 USOCK_NUMERIC | USOCK_IPV6ONLY,
686 "::", APMGR_PORT_STR);
687 if (fd < 0) {
688 perror("usock");
689 return fd;
690 }
691
692 if (!inet_pton(AF_INET6, APMGR_V6_MCAST_GROUP, &group.ipv6mr_multiaddr.s6_addr))
693 perror("inet_pton(AF_INET6)");
694
695 /* Membership has to be added for every interface we listen on. */
696 vlist_for_each_element(&interfaces, iface, node) {
697 group.ipv6mr_interface = iface->ifindex;
698 if(setsockopt(fd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char *)&group, sizeof group) < 0)
699 perror("setsockopt(IPV6_ADD_MEMBERSHIP)");
700 }
701
702 if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &yes, sizeof(yes)) < 0)
703 perror("setsockopt(IPV6_RECVPKTINFO)");
704
705 if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &yes, sizeof(yes)) < 0)
706 perror("setsockopt(SO_BROADCAST)");
707
708 return fd;
709 }
710
711 static void usteer_reload_timer(struct uloop_timeout *t) {
712 /* Remove uloop descriptor */
713 if (remote_fd.fd && remote_fd.registered) {
714 uloop_fd_delete(&remote_fd);
715 close(remote_fd.fd);
716 }
717
718 if (config.ipv6) {
719 remote_fd.fd = usteer_create_v6_socket();
720 remote_fd.cb = interface_recv_v6;
721 } else {
722 remote_fd.fd = usteer_create_v4_socket();
723 remote_fd.cb = interface_recv_v4;
724 }
725
726 if (remote_fd.fd < 0)
727 return;
728
729 uloop_fd_add(&remote_fd, ULOOP_READ);
730 }
731
732 int usteer_interface_init(void)
733 {
734 if (usteer_init_local_id())
735 return -1;
736
737 remote_timer.cb = usteer_send_update_timer;
738 remote_timer.cb(&remote_timer);
739
740 reload_timer.cb = usteer_reload_timer;
741 reload_timer.cb(&reload_timer);
742
743 return 0;
744 }