diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 23:37:59 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 23:37:59 (GMT) |
commit | 839c5d2511fadc35cc4e8a8ffa833d76668700b2 (patch) | |
tree | 8c5150c50dba619ec88818e1610263582d476217 /net/core | |
parent | 96fad28a781069eb40156f78b8f50c349805b652 (diff) | |
parent | 5e43db7730e7cef7d37968ea789c41392519a864 (diff) | |
download | linux-fsl-qoriq-839c5d2511fadc35cc4e8a8ffa833d76668700b2.tar.xz |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/sock.c | 13 | ||||
-rw-r--r-- | net/core/utils.c | 37 |
2 files changed, 43 insertions, 7 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 8b35ccd..12f6d9a 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -206,13 +206,14 @@ int sock_setsockopt(struct socket *sock, int level, int optname, */ #ifdef SO_DONTLINGER /* Compatibility item... */ - switch (optname) { - case SO_DONTLINGER: - sock_reset_flag(sk, SOCK_LINGER); - return 0; + if (optname == SO_DONTLINGER) { + lock_sock(sk); + sock_reset_flag(sk, SOCK_LINGER); + release_sock(sk); + return 0; } -#endif - +#endif + if(optlen<sizeof(int)) return(-EINVAL); diff --git a/net/core/utils.c b/net/core/utils.c index e11a865..88eb8b6 100644 --- a/net/core/utils.c +++ b/net/core/utils.c @@ -23,10 +23,10 @@ #include <linux/percpu.h> #include <linux/init.h> +#include <asm/byteorder.h> #include <asm/system.h> #include <asm/uaccess.h> - /* This is a maximally equidistributed combined Tausworthe generator based on code from GNU Scientific Library 1.5 (30 Jun 2004) @@ -153,3 +153,38 @@ int net_ratelimit(void) EXPORT_SYMBOL(net_random); EXPORT_SYMBOL(net_ratelimit); EXPORT_SYMBOL(net_srandom); + +/* + * Convert an ASCII string to binary IP. + * This is outside of net/ipv4/ because various code that uses IP addresses + * is otherwise not dependent on the TCP/IP stack. + */ + +__u32 in_aton(const char *str) +{ + unsigned long l; + unsigned int val; + int i; + + l = 0; + for (i = 0; i < 4; i++) + { + l <<= 8; + if (*str != '\0') + { + val = 0; + while (*str != '\0' && *str != '.') + { + val *= 10; + val += *str - '0'; + str++; + } + l |= val; + if (*str != '\0') + str++; + } + } + return(htonl(l)); +} + +EXPORT_SYMBOL(in_aton); |