Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net use new constants
details: https://anonhg.NetBSD.org/src/rev/da585b0c35f4
branches: trunk
changeset: 790687:da585b0c35f4
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 19 15:47:02 2013 +0000
description:
use new constants
diffstat:
lib/libc/net/inet6_scopeid.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (42 lines):
diff -r dddc8bbcaa26 -r da585b0c35f4 lib/libc/net/inet6_scopeid.c
--- a/lib/libc/net/inet6_scopeid.c Sat Oct 19 15:44:29 2013 +0000
+++ b/lib/libc/net/inet6_scopeid.c Sat Oct 19 15:47:02 2013 +0000
@@ -34,7 +34,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: inet6_scopeid.c,v 1.1 2013/10/19 00:08:34 christos Exp $");
+__RCSID("$NetBSD: inet6_scopeid.c,v 1.2 2013/10/19 15:47:02 christos Exp $");
#include <sys/endian.h>
#include <string.h>
@@ -47,8 +47,12 @@
inet6_getscopeid(struct sockaddr_in6 *sin6, int flags)
{
#if defined(__KAME__)
- if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && (flags & 1)) ||
- (IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr) && (flags & 2))) {
+ if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) &&
+ (flags & INET6_IS_ADDR_LINKLOCAL)) ||
+ (IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr) &&
+ (flags & INET6_IS_ADDR_MC_LINKLOCAL)) ||
+ (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) &&
+ (flags & INET6_IS_ADDR_SITELOCAL))) {
uint16_t scope;
memcpy(&scope, &sin6->sin6_addr.s6_addr[2], sizeof(scope));
sin6->sin6_scope_id = ntohs(scope);
@@ -61,8 +65,12 @@
inet6_putscopeid(struct sockaddr_in6 *sin6, int flags)
{
#if defined(__KAME__)
- if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && (flags & 1)) ||
- (IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr) && (flags & 2))) {
+ if ((IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) &&
+ (flags & INET6_IS_ADDR_LINKLOCAL)) ||
+ (IN6_IS_ADDR_MC_LINKLOCAL(&sin6->sin6_addr) &&
+ (flags & INET6_IS_ADDR_MC_LINKLOCAL)) ||
+ (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) &&
+ (flags & INET6_IS_ADDR_SITELOCAL))) {
uint16_t scope = htons(sin6->sin6_scope_id);
memcpy(&sin6->sin6_addr.s6_addr[2], &scope, sizeof(scope));
sin6->sin6_scope_id = 0;
Home |
Main Index |
Thread Index |
Old Index