Lines Matching +full:ftrace +full:- +full:size
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
52 int mhome; /* 1=want multi-homed host route */
75 int rip_sock = -1; /* RIP socket */
109 ftrace = stdout; in main()
114 epoch.tv_sec -= EPOCH; in main()
116 now_stale = EPOCH - STALE_TIME; in main()
117 now_expire = EPOCH - EXPIRE_TIME; in main()
118 now_garbage = EPOCH - GARBAGE_TIME; in main()
121 (void)gethostname(myname, sizeof(myname)-1); in main()
124 while ((n = getopt(argc, argv, "isqdghmAtvT:F:P:")) != -1) { in main()
148 msglog("bad -g: %s", cp); in main()
158 mhome = 1; /* on multi-homed hosts */ in main()
182 && n <= HOPCNT_INFINITY-1 in main()
187 msglog("bad network; \"-F %s\"", in main()
197 msglog("bad -F: %s", cp); in main()
206 msglog("%s in \"-P %s\"", cp, optarg); in main()
220 argc -= optind; in main()
225 argc--; in main()
231 logbad(0, "usage: routed [-sqdghmAtv] [-T tracefile]" in main()
232 " [-F net[,metric]] [-P parms]"); in main()
250 msglog("-s incompatible with ipforwarding=0"); in main()
252 msglog("-g incompatible with ipforwarding=0"); in main()
260 msglog("-g and -q incompatible"); in main()
287 if (fcntl(rt_sock, F_SETFL, O_NONBLOCK) == -1) in main()
298 strncpy(inittracename, tracename, sizeof(inittracename)-1); in main()
299 set_tracefile(inittracename, "%s", -1); in main()
301 tracelevel_msg("%s", -1); /* turn on tracing to stdio */ in main()
362 dt -= wtime.tv_sec; in main()
368 now_stale = now.tv_sec - STALE_TIME; in main()
369 now_expire = now.tv_sec - EXPIRE_TIME; in main()
370 now_garbage = now.tv_sec - GARBAGE_TIME; in main()
423 * pick a 30-second anniversary of the in main()
426 n = 1 + (0-t2.tv_sec)/SUPPLY_INTERVAL; in main()
498 n--; in main()
502 n--; in main()
506 n--; in main()
512 if (ifp->int_rip_sock >= 0 in main()
513 && FD_ISSET(ifp->int_rip_sock, &ibits)) { in main()
514 read_rip(ifp->int_rip_sock, ifp); in main()
515 n--; in main()
561 if (ifp->int_rip_sock >= 0) { in fix_select()
562 FD_SET(ifp->int_rip_sock, &fdbits); in fix_select()
563 if (sock_max <= ifp->int_rip_sock) in fix_select()
564 sock_max = ifp->int_rip_sock+1; in fix_select()
583 if (fcntl(sock, F_SETFL, O_NONBLOCK) == -1) in fix_sock()
603 for (rbuf = 60*1024; ; rbuf -= 4096) { in fix_sock()
644 return -1; in get_rip_sock()
669 rip_sock = -1; in rip_off()
671 /* get non-broadcast sockets to listen to queries. in rip_off()
674 if (ifp->int_state & IS_REMOTE) in rip_off()
676 if (ifp->int_rip_sock < 0) { in rip_off()
677 addr = ((ifp->int_if_flags & IFF_POINTOPOINT) in rip_off()
678 ? ifp->int_dstaddr in rip_off()
679 : ifp->int_addr); in rip_off()
680 ifp->int_rip_sock = get_rip_sock(addr, 0); in rip_off()
699 if (!IS_RIP_IN_OFF(ifp->int_state) in rip_mcast_on()
700 && (ifp->int_if_flags & IFF_MULTICAST) in rip_mcast_on()
701 && !(ifp->int_state & IS_ALIAS)) { in rip_mcast_on()
703 gr.gr_interface = ifp->int_index; in rip_mcast_on()
705 sin->sin_family = AF_INET; in rip_mcast_on()
707 sin->sin_len = sizeof(struct sockaddr_in); in rip_mcast_on()
709 sin->sin_addr.s_addr = htonl(INADDR_RIP_GROUP); in rip_mcast_on()
745 if (ifp->int_rip_sock >= 0) { in rip_on()
746 (void)close(ifp->int_rip_sock); in rip_on()
747 ifp->int_rip_sock = -1; in rip_on()
760 ifp->int_query_time = NEVER; in rip_on()
766 && !(ifp->int_state & IS_REMOTE) in rip_on()
767 && ifp->int_rip_sock < 0) { in rip_on()
771 ifp->int_rip_sock = get_rip_sock(ifp->int_addr, 0); in rip_on()
781 rtmalloc(size_t size, in rtmalloc() argument
784 void *p = malloc(size); in rtmalloc()
786 logbad(1,"malloc(%lu) failed in %s", (u_long)size, msg); in rtmalloc()
798 tp->tv_sec = (time_t)(hi == lo in intvl_random()
800 : (lo + arc4random_uniform(1 + hi - lo))); in intvl_random()
801 tp->tv_usec = arc4random_uniform(1000000); in intvl_random()
810 t1->tv_sec += t2->tv_sec; in timevaladd()
811 if ((t1->tv_usec += t2->tv_usec) >= 1000000) { in timevaladd()
812 t1->tv_sec++; in timevaladd()
813 t1->tv_usec -= 1000000; in timevaladd()
818 /* t1 = t2 - t3
825 t1->tv_sec = t2->tv_sec - t3->tv_sec; in timevalsub()
826 if ((t1->tv_usec = t2->tv_usec - t3->tv_usec) < 0) { in timevalsub()
827 t1->tv_sec--; in timevalsub()
828 t1->tv_usec += 1000000; in timevalsub()
845 if (ftrace != NULL) { in msglog()
846 if (ftrace == stdout) in msglog()
847 (void)fputs("routed: ", ftrace); in msglog()
849 (void)vfprintf(ftrace, p, args); in msglog()
851 (void)fputc('\n', ftrace); in msglog()
874 ms = ms1 = lim->subs; in msglim()
875 for (i = MSG_SUBJECT_N; ; i--, ms1++) { in msglim()
879 if (lim->reuse > now.tv_sec) { in msglim()
883 lim->reuse = now.tv_sec + 10*60; in msglim()
887 if (ms->addr == addr) { in msglim()
891 if (ms->until > now.tv_sec) in msglim()
895 if (ms->until < ms1->until) in msglim()
899 ms->addr = addr; in msglim()
900 ms->until = now.tv_sec + 60*60; /* 60 minutes */ in msglim()
911 if (ftrace != NULL) { in msglim()
913 (void)vfprintf(ftrace, p, args); in msglim()
915 (void)fputc('\n', ftrace); in msglim()