Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net When working with address preferences, sockaddr_exte...
details: https://anonhg.NetBSD.org/src/rev/497444cb0c9b
branches: trunk
changeset: 747455:497444cb0c9b
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Tue Sep 15 23:24:34 2009 +0000
description:
When working with address preferences, sockaddr_externalize() both
addresses before comparing them.
This allows IPv6 link-local addresses (which have an embedded scope id)
to have a preference set on them.
ok dyoung
diffstat:
sys/net/if.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (42 lines):
diff -r 7257bd6c87d2 -r 497444cb0c9b sys/net/if.c
--- a/sys/net/if.c Tue Sep 15 21:07:58 2009 +0000
+++ b/sys/net/if.c Tue Sep 15 23:24:34 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.235 2009/09/11 22:06:29 dyoung Exp $ */
+/* $NetBSD: if.c,v 1.236 2009/09/15 23:24:34 jakllsch Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.235 2009/09/11 22:06:29 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.236 2009/09/15 23:24:34 jakllsch Exp $");
#include "opt_inet.h"
@@ -1583,7 +1583,7 @@
union {
struct sockaddr sa;
struct sockaddr_storage ss;
- } u;
+ } u, v;
switch (cmd) {
case SIOCSIFADDRPREF:
@@ -1610,11 +1610,13 @@
if ((any = sockaddr_any(sa)) == NULL || sa->sa_len != any->sa_len)
return EINVAL;
+ sockaddr_externalize(&v.sa, sizeof(v.ss), sa);
+
IFADDR_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != sa->sa_family)
continue;
sockaddr_externalize(&u.sa, sizeof(u.ss), ifa->ifa_addr);
- if (sockaddr_cmp(&u.sa, sa) == 0)
+ if (sockaddr_cmp(&u.sa, &v.sa) == 0)
break;
}
if (ifa == NULL)
Home |
Main Index |
Thread Index |
Old Index