source: freewrt/package/busybox/patches/patch-networking_telnetd_c@ c6b195c

freewrt_1_0 freewrt_2_0
Last change on this file since c6b195c was c6b195c, checked in by Waldemar Brodkorb <wbx@…>, 19 years ago

use make update-patches to generate patches. start ucdhcp as background process, so that you can later attach a cable and still get an ip address without reboot. add address/broadcast parameters to ip link set

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@1215 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 1.5 KB
Line 
1$FreeWRT$
2--- busybox-1.1.3.orig/networking/telnetd.c Wed Mar 22 22:16:19 2006
3+++ busybox-1.1.3/networking/telnetd.c Sat Nov 25 19:54:19 2006
4@@ -45,11 +45,14 @@
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 #define BUFSIZE 4000
13
14+#undef CONFIG_FEATURE_IPV6
15+
16 #ifdef CONFIG_FEATURE_IPV6
17 #define SOCKET_TYPE AF_INET6
18 typedef struct sockaddr_in6 sockaddr_type;
19@@ -394,11 +397,13 @@ telnetd_main(int argc, char **argv)
20 struct in_addr bind_addr = { .s_addr = 0x0 };
21 #endif /* CONFIG_FEATURE_TELNETD_INETD */
22 int c;
23+ char *interface_name = NULL;
24+ struct ifreq interface;
25 static const char options[] =
26 #ifdef CONFIG_FEATURE_TELNETD_INETD
27- "f:l:";
28+ "i:f:l:";
29 #else /* CONFIG_EATURE_TELNETD_INETD */
30- "f:l:p:b:";
31+ "i:f:l:p:b:";
32 #endif /* CONFIG_FEATURE_TELNETD_INETD */
33 int maxlen, w, r;
34
35@@ -413,6 +418,9 @@ telnetd_main(int argc, char **argv)
36 case 'f':
37 issuefile = optarg;
38 break;
39+ case 'i':
40+ interface_name = strdup(optarg);
41+ break;
42 case 'l':
43 loginpath = optarg;
44 break;
45@@ -464,6 +472,13 @@ telnetd_main(int argc, char **argv)
46 sa.sin_port = htons(portnbr);
47 sa.sin_addr = bind_addr;
48 #endif
49+
50+ /* Set it to listen on the specified interface */
51+ if (interface_name) {
52+ strncpy(interface.ifr_ifrn.ifrn_name, interface_name, IFNAMSIZ);
53+ (void)setsockopt(master_fd, SOL_SOCKET,
54+ SO_BINDTODEVICE, &interface, sizeof(interface));
55+ }
56
57 if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
58 bb_perror_msg_and_die("bind");
Note: See TracBrowser for help on using the repository browser.