diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-07-13 09:17:23 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-07-13 09:17:23 -0700 |
commit | 2585b03455c2c495ab3a0cfbe13c4e5d3ac70e11 (patch) | |
tree | 3a6e49420cd422cfda5d1fff658a2b7176106cf2 | |
parent | 5404e93739676fd24000702d6d2c39ed36e39d51 (diff) | |
download | quagga-2585b03455c2c495ab3a0cfbe13c4e5d3ac70e11.tar.bz2 quagga-2585b03455c2c495ab3a0cfbe13c4e5d3ac70e11.tar.xz |
Remove code in md5sig that attempts to normalize IPV4 mapped socket
The socket address is already normalize during the accept handling,
so the broken code in md5sig is unnecessary.
-rw-r--r-- | lib/sockopt.c | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c index 116ee498..2df41ab7 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -509,53 +509,13 @@ sockopt_tcp_signature (int sock, union sockunion *su, const char *password) #else int keylen = password ? strlen (password) : 0; struct tcp_md5sig md5sig; - union sockunion *su2, *susock; - - /* Figure out whether the socket and the sockunion are the same family.. - * adding AF_INET to AF_INET6 needs to be v4 mapped, you'd think.. - */ - if (!(susock = sockunion_getsockname (sock))) - return -1; - - if (susock->sa.sa_family == su->sa.sa_family) - su2 = su; - else - { - /* oops.. */ - su2 = susock; - - if (su2->sa.sa_family == AF_INET) - { - sockunion_free (susock); - return -1; - }; - -#ifdef HAVE_IPV6 - /* If this does not work, then all users of this sockopt will need to - * differentiate between IPv4 and IPv6, and keep seperate sockets for - * each. - * - * Sadly, it doesn't seem to work at present. It's unknown whether - * this is a bug or not. - */ - if (su2->sa.sa_family == AF_INET6 - && su->sa.sa_family == AF_INET) - { - su2->sin6.sin6_family = AF_INET6; - /* V4Map the address */ - memset (&su2->sin6.sin6_addr, 0, sizeof (struct in6_addr)); - su2->sin6.sin6_addr.s6_addr32[2] = htonl(0xffff); - memcpy (&su2->sin6.sin6_addr.s6_addr32[3], &su->sin.sin_addr, 4); - } -#endif - } - + memset (&md5sig, 0, sizeof (md5sig)); - memcpy (&md5sig.tcpm_addr, su2, sizeof (*su2)); + memcpy (&md5sig.tcpm_addr, su, sizeof(su)); + md5sig.tcpm_keylen = keylen; if (keylen) memcpy (md5sig.tcpm_key, password, keylen); - sockunion_free (susock); #endif /* GNU_LINUX */ ret = setsockopt (sock, IPPROTO_TCP, TCP_MD5SIG, &md5sig, sizeof md5sig); return ret; |