diff -ruN netkit-tftp-0.15.orig/tftpd/tftpd.c netkit-tftp-0.15/tftpd/tftpd.c --- netkit-tftp-0.15.orig/tftpd/tftpd.c Sun Aug 1 22:11:33 1999 +++ netkit-tftp-0.15/tftpd/tftpd.c Wed Jul 26 14:48:16 2000 @@ -101,12 +101,24 @@ register struct tftphdr *tp; register int n = 0; int on = 1; + int bound = 0; + /* open the log earlier, to log supplied address errors */ + openlog("tftpd", LOG_PID, LOG_DAEMON); ac--; av++; + /* "-b ip.addr.ess" handling */ + if (ac > 0 && !strncmp(av[0], "-b", 2)) { + if (inet_aton(av[1], &s_in.sin_addr) < 0) { + syslog(LOG_ERR, "inet_aton: %m\n"); + exit(1); + } + ac-=2; + av+=2; + bound = 1; + } if (ac==0) dirs[0] = "/tftpboot"; /* default directory */ while (ac-- > 0 && n < MAXARG) dirs[n++] = *av++; - openlog("tftpd", LOG_PID, LOG_DAEMON); if (ioctl(0, FIONBIO, &on) < 0) { syslog(LOG_ERR, "ioctl(FIONBIO): %m\n"); exit(1); @@ -191,6 +203,8 @@ syslog(LOG_ERR, "socket: %m\n"); exit(1); } + if (bound) + syslog(LOG_NOTICE, "binding to address %s\n", inet_ntoa(s_in.sin_addr)); if (bind(peer, (struct sockaddr *)&s_in, sizeof (s_in)) < 0) { syslog(LOG_ERR, "bind: %m\n"); exit(1);