Fix dependency on libol, should close #403
[openwrt.git] / package / busybox / patches / 110-telnetd.patch
1 diff -ur busybox-1.1.0/networking/telnetd.c busybox-1.1.0-owrt/networking/telnetd.c
2 --- busybox-1.1.0/networking/telnetd.c 2006-01-11 06:43:51.000000000 +0100
3 +++ busybox-1.1.0-owrt/networking/telnetd.c 2006-01-14 17:41:20.000000000 +0100
4 @@ -45,6 +45,7 @@
5 #include <arpa/telnet.h>
6 #include <ctype.h>
7 #include <sys/syslog.h>
8 +#include <net/if.h>
9
10 #include "busybox.h"
11
12 @@ -394,11 +395,13 @@
13 struct in_addr bind_addr = { .s_addr = 0x0 };
14 #endif /* CONFIG_FEATURE_TELNETD_INETD */
15 int c;
16 + char *interface_name = NULL;
17 + struct ifreq interface;
18 static const char options[] =
19 #ifdef CONFIG_FEATURE_TELNETD_INETD
20 - "f:l:";
21 + "i:f:l:";
22 #else /* CONFIG_EATURE_TELNETD_INETD */
23 - "f:l:p:b:";
24 + "i:f:l:p:b:";
25 #endif /* CONFIG_FEATURE_TELNETD_INETD */
26 int maxlen, w, r;
27
28 @@ -413,6 +416,9 @@
29 case 'f':
30 issuefile = optarg;
31 break;
32 + case 'i':
33 + interface_name = strdup(optarg);
34 + break;
35 case 'l':
36 loginpath = optarg;
37 break;
38 @@ -465,6 +471,13 @@
39 sa.sin_addr = bind_addr;
40 #endif
41
42 + /* Set it to listen on the specified interface */
43 + if (interface_name) {
44 + strncpy(interface.ifr_ifrn.ifrn_name, interface_name, IFNAMSIZ);
45 + (void)setsockopt(master_fd, SOL_SOCKET,
46 + SO_BINDTODEVICE, &interface, sizeof(interface));
47 + }
48 +
49 if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
50 bb_perror_msg_and_die("bind");
51 }
This page took 0.048498 seconds and 5 git commands to generate.