2006-08-08 13:27:25 +03:00
|
|
|
diff -ruN busybox-1.2.0-old/networking/telnetd.c busybox-1.2.0-new/networking/telnetd.c
|
|
|
|
--- busybox-1.2.0-old/networking/telnetd.c 2006-07-01 00:42:02.000000000 +0200
|
|
|
|
+++ busybox-1.2.0-new/networking/telnetd.c 2006-07-31 10:52:30.000000000 +0200
|
|
|
|
@@ -44,6 +44,7 @@
|
2005-02-06 03:32:23 +02:00
|
|
|
#include <arpa/telnet.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <sys/syslog.h>
|
|
|
|
+#include <net/if.h>
|
|
|
|
|
|
|
|
#include "busybox.h"
|
|
|
|
|
2006-08-08 13:27:25 +03:00
|
|
|
@@ -391,11 +392,13 @@
|
2006-01-14 19:22:39 +02:00
|
|
|
struct in_addr bind_addr = { .s_addr = 0x0 };
|
2005-02-06 03:32:23 +02:00
|
|
|
#endif /* CONFIG_FEATURE_TELNETD_INETD */
|
|
|
|
int c;
|
|
|
|
+ char *interface_name = NULL;
|
|
|
|
+ struct ifreq interface;
|
|
|
|
static const char options[] =
|
|
|
|
#ifdef CONFIG_FEATURE_TELNETD_INETD
|
|
|
|
- "f:l:";
|
|
|
|
+ "i:f:l:";
|
2006-01-14 19:22:39 +02:00
|
|
|
#else /* CONFIG_EATURE_TELNETD_INETD */
|
|
|
|
- "f:l:p:b:";
|
|
|
|
+ "i:f:l:p:b:";
|
2005-02-06 03:32:23 +02:00
|
|
|
#endif /* CONFIG_FEATURE_TELNETD_INETD */
|
|
|
|
int maxlen, w, r;
|
|
|
|
|
2006-08-08 13:27:25 +03:00
|
|
|
@@ -410,6 +413,9 @@
|
2005-02-06 03:32:23 +02:00
|
|
|
case 'f':
|
2006-01-14 19:22:39 +02:00
|
|
|
issuefile = optarg;
|
2005-02-06 03:32:23 +02:00
|
|
|
break;
|
2006-01-14 19:22:39 +02:00
|
|
|
+ case 'i':
|
|
|
|
+ interface_name = strdup(optarg);
|
|
|
|
+ break;
|
2005-02-06 03:32:23 +02:00
|
|
|
case 'l':
|
2006-01-14 19:22:39 +02:00
|
|
|
loginpath = optarg;
|
2005-02-06 03:32:23 +02:00
|
|
|
break;
|
2006-08-08 13:27:25 +03:00
|
|
|
@@ -459,6 +465,13 @@
|
2006-01-14 19:22:39 +02:00
|
|
|
sa.sin_addr = bind_addr;
|
|
|
|
#endif
|
2005-02-06 03:32:23 +02:00
|
|
|
|
2006-08-08 13:27:25 +03:00
|
|
|
+ /* Set it to listen on the specified interface */
|
|
|
|
+ if (interface_name) {
|
|
|
|
+ strncpy(interface.ifr_ifrn.ifrn_name, interface_name, IFNAMSIZ);
|
|
|
|
+ (void)setsockopt(master_fd, SOL_SOCKET,
|
|
|
|
+ SO_BINDTODEVICE, &interface, sizeof(interface));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
bb_xbind(master_fd, (struct sockaddr *) &sa, sizeof(sa));
|
|
|
|
bb_xlisten(master_fd, 1);
|
|
|
|
bb_xdaemon(0, 0);
|