Deleted Added
full compact
key.c (279735) key.c (281693)
1/* $FreeBSD: head/sys/netipsec/key.c 279735 2015-03-07 18:44:52Z ae $ */
1/* $FreeBSD: head/sys/netipsec/key.c 281693 2015-04-18 16:46:31Z ae $ */
2/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
3
4/*-
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 3841 unchanged lines hidden (view full) ---

3851 return 0;
3852}
3853
3854#ifdef INET6
3855/*
3856 * compare my own address for IPv6.
3857 * 1: ours
3858 * 0: other
2/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
3
4/*-
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 3841 unchanged lines hidden (view full) ---

3851 return 0;
3852}
3853
3854#ifdef INET6
3855/*
3856 * compare my own address for IPv6.
3857 * 1: ours
3858 * 0: other
3859 * NOTE: derived ip6_input() in KAME. This is necessary to modify more.
3860 */
3859 */
3861#include <netinet6/in6_var.h>
3862
3863static int
3864key_ismyaddr6(struct sockaddr_in6 *sin6)
3865{
3860static int
3861key_ismyaddr6(struct sockaddr_in6 *sin6)
3862{
3866 struct in6_ifaddr *ia;
3867#if 0
3868 struct in6_multi *in6m;
3869#endif
3863 struct in6_addr in6;
3870
3864
3871 IN6_IFADDR_RLOCK();
3872 TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
3873 if (key_sockaddrcmp((struct sockaddr *)sin6,
3874 (struct sockaddr *)&ia->ia_addr, 0) == 0) {
3875 IN6_IFADDR_RUNLOCK();
3876 return 1;
3877 }
3865 if (!IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr))
3866 return (in6_localip(&sin6->sin6_addr));
3878
3867
3879#if 0
3880 /*
3881 * XXX Multicast
3882 * XXX why do we care about multlicast here while we don't care
3883 * about IPv4 multicast??
3884 * XXX scope
3885 */
3886 in6m = NULL;
3887 IN6_LOOKUP_MULTI(sin6->sin6_addr, ia->ia_ifp, in6m);
3888 if (in6m) {
3889 IN6_IFADDR_RUNLOCK();
3890 return 1;
3891 }
3892#endif
3893 }
3894 IN6_IFADDR_RUNLOCK();
3895
3896 /* loopback, just for safety */
3897 if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
3898 return 1;
3899
3900 return 0;
3868 /* Convert address into kernel-internal form */
3869 in6 = sin6->sin6_addr;
3870 in6.s6_addr16[1] = htons(sin6->sin6_scope_id & 0xffff);
3871 return (in6_localip(&in6));
3901}
3902#endif /*INET6*/
3903
3904/*
3905 * compare two secasindex structure.
3906 * flag can specify to compare 2 saidxes.
3907 * compare two secasindex structure without both mode and reqid.
3908 * don't compare port.

--- 3927 unchanged lines hidden ---
3872}
3873#endif /*INET6*/
3874
3875/*
3876 * compare two secasindex structure.
3877 * flag can specify to compare 2 saidxes.
3878 * compare two secasindex structure without both mode and reqid.
3879 * don't compare port.

--- 3927 unchanged lines hidden ---