diff options
author | Eric Andersen | 2005-07-18 23:51:27 +0000 |
---|---|---|
committer | Eric Andersen | 2005-07-18 23:51:27 +0000 |
commit | 164a716f964bba247c660bc70149234f95146871 (patch) | |
tree | 95a8a6f75cb2ed1bb07cb6019088db7348ebf4d4 /busybox/networking/telnetd.c | |
parent | 8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373 (diff) | |
download | busybox-164a716f964bba247c660bc70149234f95146871.zip busybox-164a716f964bba247c660bc70149234f95146871.tar.gz |
busybox-1.0.1-rc1.patch
http://busybox.net/lists/busybox/2005-July/014974.html
Diffstat (limited to 'busybox/networking/telnetd.c')
-rw-r--r-- | busybox/networking/telnetd.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/busybox/networking/telnetd.c b/busybox/networking/telnetd.c index 491c66f..b3d0a11 100644 --- a/busybox/networking/telnetd.c +++ b/busybox/networking/telnetd.c @@ -49,6 +49,15 @@ #define BUFSIZE 4000 +#ifdef CONFIG_FEATURE_IPV6 +#define SOCKET_TYPE AF_INET6 +typedef struct sockaddr_in6 sockaddr_type; +#else +#define SOCKET_TYPE AF_INET +typedef struct sockaddr_in sockaddr_type; +#endif + + #ifdef CONFIG_LOGIN static const char *loginpath = "/bin/login"; #else @@ -373,7 +382,7 @@ int telnetd_main(int argc, char **argv) { #ifndef CONFIG_FEATURE_TELNETD_INETD - struct sockaddr_in sa; + sockaddr_type sa; int master_fd; #endif /* CONFIG_FEATURE_TELNETD_INETD */ fd_set rdfdset, wrfdset; @@ -431,7 +440,7 @@ telnetd_main(int argc, char **argv) /* Grab a TCP socket. */ - master_fd = socket(AF_INET, SOCK_STREAM, 0); + master_fd = socket(SOCKET_TYPE, SOCK_STREAM, 0); if (master_fd < 0) { bb_perror_msg_and_die("socket"); } @@ -440,8 +449,13 @@ telnetd_main(int argc, char **argv) /* Set it to listen to specified port. */ memset((void *)&sa, 0, sizeof(sa)); +#ifdef CONFIG_FEATURE_IPV6 + sa.sin6_family = AF_INET6; + sa.sin6_port = htons(portnbr); +#else sa.sin_family = AF_INET; sa.sin_port = htons(portnbr); +#endif if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) { bb_perror_msg_and_die("bind"); |