svn commit: r274763 - in projects/routing/sys: contrib/ipfilter/netinet net netinet netinet6 netpfil/ipfw netpfil/pf
Alexander V. Chernikov
melifaro at FreeBSD.org
Thu Nov 20 22:42:05 UTC 2014
Author: melifaro
Date: Thu Nov 20 22:41:59 2014
New Revision: 274763
URL: https://svnweb.freebsd.org/changeset/base/274763
Log:
Simplify API: use new NHOP_LOOKUP_AIFP flag to select what ifp
we need to return.
Rename fib[64]_lookup_nh_basic to fib[64]_lookup_nh, add flags
fields for all relevant functions.
Modified:
projects/routing/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
projects/routing/sys/net/if_stf.c
projects/routing/sys/net/rt_nhops.c
projects/routing/sys/net/rt_nhops.h
projects/routing/sys/netinet/in.c
projects/routing/sys/netinet/in_gif.c
projects/routing/sys/netinet/in_mcast.c
projects/routing/sys/netinet/ip_input.c
projects/routing/sys/netinet6/icmp6.c
projects/routing/sys/netinet6/in6.c
projects/routing/sys/netinet6/in6_gif.c
projects/routing/sys/netinet6/in6_mcast.c
projects/routing/sys/netinet6/in6_src.c
projects/routing/sys/netinet6/ip6_output.c
projects/routing/sys/netpfil/ipfw/ip_fw2.c
projects/routing/sys/netpfil/pf/pf.c
Modified: projects/routing/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- projects/routing/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -958,7 +958,7 @@ ipf_verifysrc(fin)
struct nhop4_basic nh4;
memset(&nh4, 0, sizeof(nh4));
- if (fib4_lookup_nh_basic(RT_DEFAULT_FIB, fin->fin_src, 0, &nh4) != 0)
+ if (fib4_lookup_nh(RT_DEFAULT_FIB, fin->fin_src, 0, 0, &nh4) != 0)
return (0);
return (fin->fin_ifp == nh4.nh_ifp);
Modified: projects/routing/sys/net/if_stf.c
==============================================================================
--- projects/routing/sys/net/if_stf.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/net/if_stf.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -574,7 +574,7 @@ stf_checkaddr4(sc, in, inifp)
if (sc && (STF2IFP(sc)->if_flags & IFF_LINK2) == 0 && inifp) {
struct nhop4_basic nh4;
- if (fib4_lookup_nh_basic(sc->sc_fibnum, *in, 0, &nh4) != 0)
+ if (fib4_lookup_nh(sc->sc_fibnum, *in, 0, 0, &nh4) != 0)
return (-1);
if (nh4.nh_ifp != inifp)
return (-1);
Modified: projects/routing/sys/net/rt_nhops.c
==============================================================================
--- projects/routing/sys/net/rt_nhops.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/net/rt_nhops.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -123,22 +123,22 @@ static inline uint16_t fib_rte_to_nh_fla
static void rib4_rte_to_nh_extended(struct rtentry *rte, struct in_addr dst,
struct rt4_extended *prt4);
static void fib4_rte_to_nh_extended(struct rtentry *rte, struct in_addr dst,
- struct nhop4_extended *pnh4);
-static void fib4_rte_to_nh_basic(struct rtentry *rte, struct in_addr dst,
- struct nhop4_basic *pnh4);
+ uint32_t flags, struct nhop4_extended *pnh4);
+static void fib4_rte_to_nh(struct rtentry *rte, struct in_addr dst,
+ uint32_t flags, struct nhop4_basic *pnh4);
#endif
#ifdef INET6
static void fib6_rte_to_nh_extended(struct rtentry *rte, struct in6_addr *dst,
- struct nhop6_extended *pnh6);
-static void fib6_rte_to_nh_basic(struct rtentry *rte, struct in6_addr *dst,
- struct nhop6_basic *pnh6);
+ uint32_t flags, struct nhop6_extended *pnh6);
+static void fib6_rte_to_nh(struct rtentry *rte, struct in6_addr *dst,
+ uint32_t flags, struct nhop6_basic *pnh6);
static int fib6_storelladdr(struct ifnet *ifp, struct in6_addr *dst,
int mm_flags, u_char *desten);
static uint16_t fib6_get_ifa(struct rtentry *rte);
static int fib6_lla_to_nh_basic(struct in6_addr *dst, uint32_t scopeid,
- struct nhop6_basic *pnh6);
+ uint32_t flags, struct nhop6_basic *pnh6);
static int fib6_lla_to_nh_extended(struct in6_addr *dst, uint32_t scopeid,
- struct nhop6_extended *pnh6);
+ uint32_t flags, struct nhop6_extended *pnh6);
static int fib6_lla_to_nh(struct in6_addr *dst, uint32_t scopeid,
struct nhop_prepend *nh, struct ifnet **lifp);
#endif
@@ -321,7 +321,7 @@ fib4_lookup_prepend(uint32_t fibnum, str
if (nh_ext != NULL) {
/* Fill in extended info */
- fib4_rte_to_nh_extended(rte, dst, nh_ext);
+ fib4_rte_to_nh_extended(rte, dst, 0, nh_ext);
}
RIB_RUNLOCK(rh);
@@ -413,12 +413,15 @@ fib_rte_to_nh_flags(int rt_flags)
}
static void
-fib4_rte_to_nh_basic(struct rtentry *rte, struct in_addr dst,
- struct nhop4_basic *pnh4)
+fib4_rte_to_nh(struct rtentry *rte, struct in_addr dst,
+ uint32_t flags, struct nhop4_basic *pnh4)
{
struct sockaddr_in *gw;
- pnh4->nh_ifp = rte->rt_ifa->ifa_ifp;
+ if ((flags & NHOP_LOOKUP_AIFP) == 0)
+ pnh4->nh_ifp = rte->rt_ifp;
+ else
+ pnh4->nh_ifp = rte->rt_ifa->ifa_ifp;
pnh4->nh_mtu = min(rte->rt_mtu, rte->rt_ifp->if_mtu);
if (rte->rt_flags & RTF_GATEWAY) {
gw = (struct sockaddr_in *)rte->rt_gateway;
@@ -435,12 +438,15 @@ fib4_rte_to_nh_basic(struct rtentry *rte
static void
fib4_rte_to_nh_extended(struct rtentry *rte, struct in_addr dst,
- struct nhop4_extended *pnh4)
+ uint32_t flags, struct nhop4_extended *pnh4)
{
struct sockaddr_in *gw;
struct in_ifaddr *ia;
- pnh4->nh_ifp = rte->rt_ifa->ifa_ifp;
+ if ((flags & NHOP_LOOKUP_AIFP) == 0)
+ pnh4->nh_ifp = rte->rt_ifp;
+ else
+ pnh4->nh_ifp = rte->rt_ifa->ifa_ifp;
pnh4->nh_mtu = min(rte->rt_mtu, rte->rt_ifp->if_mtu);
if (rte->rt_flags & RTF_GATEWAY) {
gw = (struct sockaddr_in *)rte->rt_gateway;
@@ -502,8 +508,8 @@ rib4_rte_to_nh_extended(struct rtentry *
* - howewer mtu from "transmit" interface will be returned.
*/
int
-fib4_lookup_nh_basic(uint32_t fibnum, struct in_addr dst, uint32_t flowid,
- struct nhop4_basic *pnh4)
+fib4_lookup_nh(uint32_t fibnum, struct in_addr dst, uint32_t flowid,
+ uint32_t flags, struct nhop4_basic *pnh4)
{
struct rib_head *rh;
struct radix_node *rn;
@@ -511,7 +517,7 @@ fib4_lookup_nh_basic(uint32_t fibnum, st
struct rtentry *rte;
RIB_LOCK_READER;
- KASSERT((fibnum < rt_numfibs), ("fib4_lookup_nh_basic: bad fibnum"));
+ KASSERT((fibnum < rt_numfibs), ("fib4_lookup_nh: bad fibnum"));
rh = rt_tables_get_rnh(fibnum, AF_INET);
if (rh == NULL)
return (ENOENT);
@@ -527,7 +533,7 @@ fib4_lookup_nh_basic(uint32_t fibnum, st
rte = RNTORT(rn);
/* Ensure route & ifp is UP */
if (RT_LINK_IS_UP(rte->rt_ifp)) {
- fib4_rte_to_nh_basic(rte, dst, pnh4);
+ fib4_rte_to_nh(rte, dst, flags, pnh4);
RIB_RUNLOCK(rh);
return (0);
@@ -538,43 +544,6 @@ fib4_lookup_nh_basic(uint32_t fibnum, st
return (ENOENT);
}
-int
-fib4_lookup_nh_ifp(uint32_t fibnum, struct in_addr dst, uint32_t flowid,
- struct nhop4_basic *pnh4)
-{
- struct rib_head *rh;
- struct radix_node *rn;
- struct sockaddr_in sin;
- struct rtentry *rte;
- RIB_LOCK_READER;
-
- KASSERT((fibnum < rt_numfibs), ("fib4_lookup_nh_ifp: bad fibnum"));
- rh = rt_tables_get_rnh(fibnum, AF_INET);
- if (rh == NULL)
- return (ENOENT);
-
- /* Prepare lookup key */
- memset(&sin, 0, sizeof(sin));
- sin.sin_len = sizeof(struct sockaddr_in);
- sin.sin_addr = dst;
-
- RIB_RLOCK(rh);
- rn = rh->rnh_matchaddr((void *)&sin, &rh->head);
- if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) {
- rte = RNTORT(rn);
- /* Ensure route & ifp is UP */
- if (RT_LINK_IS_UP(rte->rt_ifp)) {
- fib4_rte_to_nh_basic(rte, dst, pnh4);
- RIB_RUNLOCK(rh);
- pnh4->nh_ifp = rte->rt_ifp;
- return (0);
- }
- }
- RIB_RUNLOCK(rh);
-
- return (ENOENT);
-}
-
/*
* Performs IPv4 route table lookup on @dst. Returns 0 on success.
* Stores extende nexthop info provided @pnh4 structure.
@@ -610,7 +579,7 @@ fib4_lookup_nh_ext(uint32_t fibnum, stru
rte = RNTORT(rn);
/* Ensure route & ifp is UP */
if (RT_LINK_IS_UP(rte->rt_ifp)) {
- fib4_rte_to_nh_extended(rte, dst, pnh4);
+ fib4_rte_to_nh_extended(rte, dst, flags, pnh4);
if ((flags & NHOP_LOOKUP_REF) != 0) {
/* TODO: Do lwref on egress ifp's */
}
@@ -946,7 +915,7 @@ fib6_get_ifa(struct rtentry *rte)
static int
fib6_lla_to_nh_basic(struct in6_addr *dst, uint32_t scopeid,
- struct nhop6_basic *pnh6)
+ uint32_t flags, struct nhop6_basic *pnh6)
{
struct ifnet *ifp;
@@ -957,8 +926,13 @@ fib6_lla_to_nh_basic(struct in6_addr *ds
/* Do explicit nexthop zero unless we're copying it */
memset(pnh6, 0, sizeof(*pnh6));
- pnh6->nh_ifp = ifp;
pnh6->nh_mtu = IN6_LINKMTU(ifp);
+ pnh6->nh_ifp = ifp;
+ if ((flags & NHOP_LOOKUP_AIFP)!=0 && in6_ifawithifp_lla(ifp, dst) != 0){
+ if ((ifp = V_loif) != NULL)
+ pnh6->nh_ifp = ifp;
+ }
+
/* No flags set */
pnh6->nh_addr = *dst;
@@ -967,7 +941,7 @@ fib6_lla_to_nh_basic(struct in6_addr *ds
static int
fib6_lla_to_nh_extended(struct in6_addr *dst, uint32_t scopeid,
- struct nhop6_extended *pnh6)
+ uint32_t flags, struct nhop6_extended *pnh6)
{
struct ifnet *ifp;
@@ -978,8 +952,12 @@ fib6_lla_to_nh_extended(struct in6_addr
/* Do explicit nexthop zero unless we're copying it */
memset(pnh6, 0, sizeof(*pnh6));
- pnh6->nh_ifp = ifp;
pnh6->nh_mtu = IN6_LINKMTU(ifp);
+ pnh6->nh_ifp = ifp;
+ if ((flags & NHOP_LOOKUP_AIFP)!=0 && in6_ifawithifp_lla(ifp, dst) != 0){
+ if ((ifp = V_loif) != NULL)
+ pnh6->nh_ifp = ifp;
+ }
/* No flags set */
pnh6->nh_addr = *dst;
@@ -988,7 +966,7 @@ fib6_lla_to_nh_extended(struct in6_addr
static int
rib6_lla_to_nh_extended(struct in6_addr *dst, uint32_t scopeid,
- struct rt6_extended *prt6)
+ uint32_t flags, struct rt6_extended *prt6)
{
struct ifnet *ifp;
@@ -1047,15 +1025,18 @@ fib6_lla_to_nh(struct in6_addr *dst, uin
static void
-fib6_rte_to_nh_basic(struct rtentry *rte, struct in6_addr *dst,
- struct nhop6_basic *pnh6)
+fib6_rte_to_nh(struct rtentry *rte, struct in6_addr *dst,
+ uint32_t flags, struct nhop6_basic *pnh6)
{
struct sockaddr_in6 *gw;
/* Do explicit nexthop zero unless we're copying it */
memset(pnh6, 0, sizeof(*pnh6));
- pnh6->nh_ifp = ifnet_byindex(fib6_get_ifa(rte));
+ if ((flags & NHOP_LOOKUP_AIFP) == 0)
+ pnh6->nh_ifp = rte->rt_ifp;
+ else
+ pnh6->nh_ifp = ifnet_byindex(fib6_get_ifa(rte));
pnh6->nh_mtu = min(rte->rt_mtu, IN6_LINKMTU(rte->rt_ifp));
if (rte->rt_flags & RTF_GATEWAY) {
@@ -1073,7 +1054,7 @@ fib6_rte_to_nh_basic(struct rtentry *rte
static void
fib6_rte_to_nh_extended(struct rtentry *rte, struct in6_addr *dst,
- struct nhop6_extended *pnh6)
+ uint32_t flags, struct nhop6_extended *pnh6)
{
struct sockaddr_in6 *gw;
struct in6_ifaddr *ia;
@@ -1081,7 +1062,11 @@ fib6_rte_to_nh_extended(struct rtentry *
/* Do explicit nexthop zero unless we're copying it */
memset(pnh6, 0, sizeof(*pnh6));
- pnh6->nh_ifp = ifnet_byindex(fib6_get_ifa(rte));
+ if ((flags & NHOP_LOOKUP_AIFP) == 0)
+ pnh6->nh_ifp = rte->rt_ifp;
+ else
+ pnh6->nh_ifp = ifnet_byindex(fib6_get_ifa(rte));
+
pnh6->nh_mtu = min(rte->rt_mtu, IN6_LINKMTU(rte->rt_ifp));
if (rte->rt_flags & RTF_GATEWAY) {
gw = (struct sockaddr_in6 *)rte->rt_gateway;
@@ -1104,7 +1089,7 @@ fib6_rte_to_nh_extended(struct rtentry *
bitcount32((x).__u6_addr.__u6_addr32[3])
static void
rib6_rte_to_nh_extended(struct rtentry *rte, struct in6_addr *dst,
- struct rt6_extended *prt6)
+ uint32_t flags, struct rt6_extended *prt6)
{
struct sockaddr_in6 *gw;
@@ -1130,52 +1115,8 @@ rib6_rte_to_nh_extended(struct rtentry *
}
int
-fib6_lookup_nh_ifp(uint32_t fibnum, struct in6_addr *dst, uint32_t scopeid,
- uint32_t flowid, struct nhop6_basic *pnh6)
-{
- struct rib_head *rh;
- struct radix_node *rn;
- struct sockaddr_in6 sin6;
- struct rtentry *rte;
- RIB_LOCK_READER;
-
- if (IN6_IS_SCOPE_LINKLOCAL(dst)) {
- /* Do not lookup link-local addresses in rtable */
- /* XXX: Check if dst is local */
- return (fib6_lla_to_nh_basic(dst, scopeid, pnh6));
- }
-
- KASSERT((fibnum < rt_numfibs), ("fib6_lookup_nh_basic: bad fibnum"));
- rh = rt_tables_get_rnh(fibnum, AF_INET6);
- if (rh == NULL)
- return (ENOENT);
-
- /* Prepare lookup key */
- memset(&sin6, 0, sizeof(sin6));
- sin6.sin6_addr = *dst;
- sin6.sin6_scope_id = scopeid;
- sa6_embedscope(&sin6, 0);
-
- RIB_RLOCK(rh);
- rn = rh->rnh_matchaddr((void *)&sin6, &rh->head);
- if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) {
- rte = RNTORT(rn);
- /* Ensure route & ifp is UP */
- if (RT_LINK_IS_UP(rte->rt_ifp)) {
- fib6_rte_to_nh_basic(rte, dst, pnh6);
- pnh6->nh_ifp = rte->rt_ifp;
- RIB_RUNLOCK(rh);
- return (0);
- }
- }
- RIB_RUNLOCK(rh);
-
- return (ENOENT);
-}
-
-int
-fib6_lookup_nh_basic(uint32_t fibnum, struct in6_addr *dst, uint32_t scopeid,
- uint32_t flowid, struct nhop6_basic *pnh6)
+fib6_lookup_nh(uint32_t fibnum, struct in6_addr *dst, uint32_t scopeid,
+ uint32_t flowid, uint32_t flags, struct nhop6_basic *pnh6)
{
struct rib_head *rh;
struct radix_node *rn;
@@ -1185,10 +1126,10 @@ fib6_lookup_nh_basic(uint32_t fibnum, st
if (IN6_IS_SCOPE_LINKLOCAL(dst)) {
/* Do not lookup link-local addresses in rtable */
- return (fib6_lla_to_nh_basic(dst, scopeid, pnh6));
+ return (fib6_lla_to_nh_basic(dst, scopeid, flags, pnh6));
}
- KASSERT((fibnum < rt_numfibs), ("fib6_lookup_nh_basic: bad fibnum"));
+ KASSERT((fibnum < rt_numfibs), ("fib6_lookup_nh: bad fibnum"));
rh = rt_tables_get_rnh(fibnum, AF_INET6);
if (rh == NULL)
return (ENOENT);
@@ -1205,7 +1146,7 @@ fib6_lookup_nh_basic(uint32_t fibnum, st
rte = RNTORT(rn);
/* Ensure route & ifp is UP */
if (RT_LINK_IS_UP(rte->rt_ifp)) {
- fib6_rte_to_nh_basic(rte, dst, pnh6);
+ fib6_rte_to_nh(rte, dst, flags, pnh6);
RIB_RUNLOCK(rh);
return (0);
}
@@ -1237,7 +1178,7 @@ fib6_lookup_nh_ext(uint32_t fibnum, stru
if (IN6_IS_SCOPE_LINKLOCAL(dst)) {
/* Do not lookup link-local addresses in rtable */
/* XXX: Do lwref on egress ifp */
- return (fib6_lla_to_nh_extended(dst, scopeid, pnh6));
+ return (fib6_lla_to_nh_extended(dst, scopeid, flags, pnh6));
}
KASSERT((fibnum < rt_numfibs), ("fib4_lookup_nh_ext: bad fibnum"));
@@ -1258,7 +1199,7 @@ fib6_lookup_nh_ext(uint32_t fibnum, stru
rte = RNTORT(rn);
/* Ensure route & ifp is UP */
if (RT_LINK_IS_UP(rte->rt_ifp)) {
- fib6_rte_to_nh_extended(rte, dst, pnh6);
+ fib6_rte_to_nh_extended(rte, dst, flags, pnh6);
if ((flags & NHOP_LOOKUP_REF) != 0) {
/* TODO: Do lwref on egress ifp's */
}
@@ -1291,7 +1232,7 @@ rib6_lookup_nh_ext(uint32_t fibnum, stru
if (IN6_IS_SCOPE_LINKLOCAL(dst)) {
/* Do not lookup link-local addresses in rtable */
/* XXX: Do lwref on egress ifp */
- return (rib6_lla_to_nh_extended(dst, scopeid, prt6));
+ return (rib6_lla_to_nh_extended(dst, scopeid, flags, prt6));
}
KASSERT((fibnum < rt_numfibs), ("rib6_lookup_nh_ext: bad fibnum"));
@@ -1312,7 +1253,7 @@ rib6_lookup_nh_ext(uint32_t fibnum, stru
rte = RNTORT(rn);
/* Ensure route & ifp is UP */
if (RT_LINK_IS_UP(rte->rt_ifp)) {
- rib6_rte_to_nh_extended(rte, dst, prt6);
+ rib6_rte_to_nh_extended(rte, dst, flags, prt6);
if ((flags & NHOP_LOOKUP_REF) != 0) {
/* TODO: Do lwref on egress ifp's */
}
Modified: projects/routing/sys/net/rt_nhops.h
==============================================================================
--- projects/routing/sys/net/rt_nhops.h Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/net/rt_nhops.h Thu Nov 20 22:41:59 2014 (r274763)
@@ -216,23 +216,21 @@ struct route_info {
uint32_t scopeid; /* Desired scope id to use */
};
-int fib4_lookup_nh_ifp(uint32_t fibnum, struct in_addr dst, uint32_t flowid,
- struct nhop4_basic *pnh4);
-int fib4_lookup_nh_basic(uint32_t fibnum, struct in_addr dst, uint32_t flowid,
- struct nhop4_basic *pnh4);
+#define NHOP_LOOKUP_REF 0x01 /* reference objects in passed structure */
+#define NHOP_LOOKUP_AIFP 0x02 /* return route "address" interface */
+
+int fib4_lookup_nh(uint32_t fibnum, struct in_addr dst, uint32_t flowid,
+ uint32_t flags, struct nhop4_basic *pnh4);
int fib4_lookup_nh_ext(uint32_t fibnum, struct in_addr dst,
uint32_t flowid, uint32_t flags, struct nhop4_extended *pnh4);
void fib4_free_nh_ext(uint32_t fibnum, struct nhop4_extended *pnh4);
-#define NHOP_LOOKUP_REF 0x01
int rib4_lookup_nh_ext(uint32_t fibnum, struct in_addr dst, uint32_t flowid,
uint32_t flags, struct rt4_extended *prt4);
void rib4_free_nh_ext(uint32_t fibnum, struct rt4_extended *prt4);
-int fib6_lookup_nh_ifp(uint32_t fibnum, struct in6_addr *dst, uint32_t scopeid,
- uint32_t flowid, struct nhop6_basic *pnh6);
-int fib6_lookup_nh_basic(uint32_t fibnum, struct in6_addr *dst,
- uint32_t scopeid, uint32_t flowid, struct nhop6_basic *pnh6);
+int fib6_lookup_nh(uint32_t fibnum, struct in6_addr *dst, uint32_t scopeid,
+ uint32_t flowid, uint32_t flags, struct nhop6_basic *pnh6);
int fib6_lookup_nh_ext(uint32_t fibnum, struct in6_addr *dst,
uint32_t scopeid, uint32_t flowid, uint32_t flags,
struct nhop6_extended *pnh6);
Modified: projects/routing/sys/netinet/in.c
==============================================================================
--- projects/routing/sys/netinet/in.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet/in.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -1024,7 +1024,7 @@ in_lltable_rtcheck(struct ifnet *ifp, u_
("sin_family %d", l3addr->sa_family));
dst = ((struct sockaddr_in *)l3addr)->sin_addr;
- if (fib4_lookup_nh_ifp(ifp->if_fib, dst, 0, &nh4) != 0)
+ if (fib4_lookup_nh(ifp->if_fib, dst, 0, 0, &nh4) != 0)
return (EINVAL);
/*
Modified: projects/routing/sys/netinet/in_gif.c
==============================================================================
--- projects/routing/sys/netinet/in_gif.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet/in_gif.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -193,7 +193,7 @@ gif_validate4(const struct ip *ip, struc
fibnum = sc->gif_fibnum;
- if (fib4_lookup_nh_basic(fibnum, ip->ip_src, 0, &nh4) != 0)
+ if (fib4_lookup_nh(fibnum, ip->ip_src, 0, 0, &nh4) != 0)
return (0);
if (nh4.nh_ifp != ifp)
return (0);
Modified: projects/routing/sys/netinet/in_mcast.c
==============================================================================
--- projects/routing/sys/netinet/in_mcast.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet/in_mcast.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -1898,8 +1898,8 @@ inp_lookup_mcast_ifp(const struct inpcb
} else {
struct nhop4_basic nh4;
- if (fib4_lookup_nh_basic(inp ? inp->inp_inc.inc_fibnum : 0,
- gsin->sin_addr, 0, &nh4) != 0) {
+ if (fib4_lookup_nh(inp ? inp->inp_inc.inc_fibnum : 0,
+ gsin->sin_addr, 0, 0, &nh4) != 0) {
return (nh4.nh_ifp);
} else {
struct in_ifaddr *ia;
Modified: projects/routing/sys/netinet/ip_input.c
==============================================================================
--- projects/routing/sys/netinet/ip_input.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet/ip_input.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -1466,7 +1466,8 @@ ip_forward(struct mbuf *m, int srcrt)
#endif
pnh4 = &nh4;
- if (fib4_lookup_nh_basic(M_GETFIB(m), ip->ip_dst, 0, &nh4) != 0)
+ if (fib4_lookup_nh(M_GETFIB(m), ip->ip_dst, 0, NHOP_LOOKUP_AIFP,
+ &nh4) != 0)
pnh4 = NULL;
#ifndef IPSEC
/*
Modified: projects/routing/sys/netinet6/icmp6.c
==============================================================================
--- projects/routing/sys/netinet6/icmp6.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet6/icmp6.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -2401,7 +2401,7 @@ icmp6_redirect_input(struct mbuf *m, int
/* ip6->ip6_src must be equal to gw for icmp6->icmp6_reddst */
struct nhop6_basic nh6;
- if (fib6_lookup_nh_basic(RT_DEFAULT_FIB, &reddst6, 0, 0, &nh6)==0) {
+ if (fib6_lookup_nh(RT_DEFAULT_FIB, &reddst6, 0, 0, 0, &nh6)==0) {
/* XXX: Think about AF_LINK GW */
if ((nh6.nh_flags & NHF_GATEWAY) == 0) {
nd6log((LOG_ERR,
Modified: projects/routing/sys/netinet6/in6.c
==============================================================================
--- projects/routing/sys/netinet6/in6.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet6/in6.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -2188,7 +2188,7 @@ in6_lltable_rtcheck(struct ifnet *ifp,
/* Our local addresses are always only installed on the default FIB. */
in6_splitscope(&((struct sockaddr_in6 *)l3addr)->sin6_addr, &dst, &scopeid);
- error = fib6_lookup_nh_ifp(RT_DEFAULT_FIB, &dst, scopeid, 0, &nh6);
+ error = fib6_lookup_nh(RT_DEFAULT_FIB, &dst, scopeid, 0, 0, &nh6);
if (error != 0 || ((nh6.nh_flags & NHF_GATEWAY) != 0) || nh6.nh_ifp != ifp) {
struct ifaddr *ifa;
/*
Modified: projects/routing/sys/netinet6/in6_gif.c
==============================================================================
--- projects/routing/sys/netinet6/in6_gif.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet6/in6_gif.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -203,7 +203,7 @@ gif_validate6(const struct ip6_hdr *ip6,
fibnum = sc->gif_fibnum;
in6_splitscope(&ip6->ip6_src, &src, &scopeid);
- if (fib6_lookup_nh_basic(fibnum, &src, scopeid, 0, &nh6) != 0)
+ if (fib6_lookup_nh(fibnum, &src, scopeid, 0, 0, &nh6) != 0)
return (0);
if (nh6.nh_ifp != ifp)
return (0);
Modified: projects/routing/sys/netinet6/in6_mcast.c
==============================================================================
--- projects/routing/sys/netinet6/in6_mcast.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet6/in6_mcast.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -1786,7 +1786,7 @@ in6p_lookup_mcast_ifp(const struct inpcb
in6_splitscope(&gsin6->sin6_addr, &dst, &scopeid);
fibnum = in6p ? in6p->inp_inc.inc_fibnum : RT_DEFAULT_FIB;
- if (fib6_lookup_nh_ifp(fibnum, &dst, scopeid, 0, &nh6) != 0)
+ if (fib6_lookup_nh(fibnum, &dst, scopeid, 0, 0, &nh6) != 0)
return (NULL);
return (nh6.nh_ifp);
Modified: projects/routing/sys/netinet6/in6_src.c
==============================================================================
--- projects/routing/sys/netinet6/in6_src.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet6/in6_src.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -797,7 +797,7 @@ in6_selectif(uint32_t fibnum, struct soc
* XXX: Embedded form?
*/
in6_splitscope(&sin6_next->sin6_addr, &dst, &scopeid);
- if (fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, &nh6) != 0) {
+ if (fib6_lookup_nh(fibnum, &dst, scopeid, 0, 0, &nh6) != 0) {
error = EHOSTUNREACH;
goto done;
}
@@ -815,7 +815,7 @@ in6_selectif(uint32_t fibnum, struct soc
}
/* Do route lookup */
- if (fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, &nh6) != 0) {
+ if (fib6_lookup_nh(fibnum, &dst, scopeid, 0, 0, &nh6) != 0) {
error = EHOSTUNREACH;
goto done;
}
@@ -829,8 +829,6 @@ in6_selectif(uint32_t fibnum, struct soc
* (this may happen when we are sending a packet to one of
* our own addresses.)
*
- * XXX: basic_ means we return "proper" interface address.
- *
*/
if (opts && opts->ip6po_pktinfo && opts->ip6po_pktinfo->ipi6_ifindex) {
if (!(ifp->if_flags & IFF_LOOPBACK) &&
Modified: projects/routing/sys/netinet6/ip6_output.c
==============================================================================
--- projects/routing/sys/netinet6/ip6_output.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netinet6/ip6_output.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -1868,8 +1868,8 @@ do { \
* the outgoing interface.
* TODO: embedded, Multipath
*/
- if (fib6_lookup_nh_basic(so->so_fibnum,
- &in6p->in6p_faddr, 0, 0, &nh6) != 0) {
+ if (fib6_lookup_nh(so->so_fibnum,
+ &in6p->in6p_faddr, 0, 0, 0, &nh6) != 0) {
error = EHOSTUNREACH;
break;
}
Modified: projects/routing/sys/netpfil/ipfw/ip_fw2.c
==============================================================================
--- projects/routing/sys/netpfil/ipfw/ip_fw2.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netpfil/ipfw/ip_fw2.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -440,7 +440,7 @@ verify_path(struct in_addr src, struct i
#else
struct nhop4_basic nh4;
- if (fib4_lookup_nh_basic(fib, src, 0, &nh4) != 0)
+ if (fib4_lookup_nh(fib, src, 0, NHOP_LOOKUP_AIFP, &nh4) != 0)
return (0);
/*
@@ -519,7 +519,7 @@ verify_path6(struct in6_addr *src, struc
struct nhop6_basic nh6;
/* XXX: unembed scope? */
- if (fib6_lookup_nh_basic(fib, src, 0, 0, &nh6) != 0)
+ if (fib6_lookup_nh(fib, src, 0, 0, NHOP_LOOKUP_AIFP, &nh6) != 0)
return (0);
/* If ifp is provided, check for equality with route table. */
Modified: projects/routing/sys/netpfil/pf/pf.c
==============================================================================
--- projects/routing/sys/netpfil/pf/pf.c Thu Nov 20 21:54:32 2014 (r274762)
+++ projects/routing/sys/netpfil/pf/pf.c Thu Nov 20 22:41:59 2014 (r274763)
@@ -2915,15 +2915,14 @@ pf_calc_mss(struct pf_addr *addr, sa_fam
#ifdef INET
case AF_INET:
hlen = sizeof(struct ip);
- if (fib4_lookup_nh_basic(rtableid, addr->v4, 0, &nh.u.nh4) == 0)
+ if (fib4_lookup_nh(rtableid, addr->v4, 0, 0, &nh.u.nh4) == 0)
mss = nh.u.nh4.nh_mtu - hlen - sizeof(struct tcphdr);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
hlen = sizeof(struct ip6_hdr);
- if (fib6_lookup_nh_basic(rtableid, &addr->v6, 0, 0, &nh.u.nh6)
- == 0)
+ if (fib6_lookup_nh(rtableid, &addr->v6, 0, 0, 0, &nh.u.nh6)==0)
mss = nh.u.nh6.nh_mtu - hlen - sizeof(struct tcphdr);
break;
#endif /* INET6 */
@@ -5100,14 +5099,13 @@ pf_routable(struct pf_addr *addr, sa_fam
*/
if (IN6_IS_SCOPE_EMBED(&addr->v6))
return (1);
- if (fib6_lookup_nh_basic(rtableid, &addr->v6, 0, 0, &nh.u.nh6)
- != 0)
+ if (fib6_lookup_nh(rtableid, &addr->v6, 0, 0, 0, &nh.u.nh6)!=0)
return (0);
break;
#endif
#ifdef INET
case AF_INET:
- if (fib4_lookup_nh_basic(rtableid, addr->v4, 0, &nh.u.nh4) != 0)
+ if (fib4_lookup_nh(rtableid, addr->v4, 0, 0, &nh.u.nh4) != 0)
return (0);
break;
#endif
More information about the svn-src-projects
mailing list