1 diff -urN busybox-1.00-pre8/networking/telnetd.c busybox-1.00-pre8-openwrt/networking/telnetd.c
2 --- busybox-1.00-pre8/networking/telnetd.c 2004-02-22 03:45:57.000000000 -0600
3 +++ busybox-1.00-pre8-openwrt/networking/telnetd.c 2004-03-05 01:32:57.000000000 -0600
5 #include <arpa/telnet.h>
7 #include <sys/syslog.h>
15 #endif /* CONFIG_FEATURE_TELNETD_INETD */
17 + char *interface_name = NULL;
18 + struct ifreq interface;
19 static const char options[] =
20 #ifdef CONFIG_FEATURE_TELNETD_INETD
22 -#else /* CONFIG_EATURE_TELNETD_INETD */
25 +#else /* CONFIG_FEATURE_TELNETD_INETD */
27 #endif /* CONFIG_FEATURE_TELNETD_INETD */
32 issuefile = strdup (optarg);
35 + interface_name = strdup(optarg);
38 loginpath = strdup (optarg);
41 sa.sin_family = AF_INET;
42 sa.sin_port = htons(portnbr);
44 + /* Set it to listen on the specified interface */
45 + if (interface_name) {
46 + strncpy(interface.ifr_ifrn.ifrn_name, interface_name, IFNAMSIZ);
47 + (void)setsockopt(master_fd, SOL_SOCKET,
48 + SO_BINDTODEVICE, &interface, sizeof(interface));
51 if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
52 bb_perror_msg_and_die("bind");