Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/netflow/netflow.c
Show First 20 Lines • Show All 358 Lines • ▼ Show 20 Lines | if (rt != NULL) { | ||||
uint32_t scopeid; | uint32_t scopeid; | ||||
struct nhop_object *nh = nhop_select_func(rnd.rnd_nhop, 0); | struct nhop_object *nh = nhop_select_func(rnd.rnd_nhop, 0); | ||||
int plen; | int plen; | ||||
rt_get_inet_prefix_plen(rt, &addr, &plen, &scopeid); | rt_get_inet_prefix_plen(rt, &addr, &plen, &scopeid); | ||||
fle->f.fle_o_ifx = nh->nh_ifp->if_index; | fle->f.fle_o_ifx = nh->nh_ifp->if_index; | ||||
if (nh->gw_sa.sa_family == AF_INET) | if (nh->gw_sa.sa_family == AF_INET) | ||||
fle->f.next_hop = nh->gw4_sa.sin_addr; | fle->f.next_hop = nh->gw4_sa.sin_addr; | ||||
/* FIXME nh->gw_sa.sa_family == AF_INET6 */ | |||||
melifaro: Probably worth explicitly stating we're leaving an empty gateway here for IPv6 nexthops. | |||||
fle->f.dst_mask = plen; | fle->f.dst_mask = plen; | ||||
} | } | ||||
} | } | ||||
/* Do route lookup on source address, to fill in src_mask. */ | /* Do route lookup on source address, to fill in src_mask. */ | ||||
if ((flags & NG_NETFLOW_CONF_NOSRCLOOKUP) == 0) { | if ((flags & NG_NETFLOW_CONF_NOSRCLOOKUP) == 0) { | ||||
struct rtentry *rt; | struct rtentry *rt; | ||||
struct route_nhop_data rnd; | struct route_nhop_data rnd; | ||||
rt = fib4_lookup_rt(r->fib, fle->f.r.r_src, 0, NHR_NONE, &rnd); | rt = fib4_lookup_rt(r->fib, fle->f.r.r_src, 0, NHR_NONE, &rnd); | ||||
if (rt != NULL) { | if (rt != NULL) { | ||||
struct in_addr addr; | struct in_addr addr; | ||||
uint32_t scopeid; | uint32_t scopeid; | ||||
int plen; | int plen; | ||||
rt_get_inet_prefix_plen(rt, &addr, &plen, &scopeid); | rt_get_inet_prefix_plen(rt, &addr, &plen, &scopeid); | ||||
fle->f.src_mask = plen; | fle->f.src_mask = plen; | ||||
/* FIXME nh->gw_sa.sa_family == AF_INET6 */ | |||||
} | } | ||||
} | } | ||||
/* Push new flow at the and of hash. */ | /* Push new flow at the and of hash. */ | ||||
TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); | TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 787 Lines • Show Last 20 Lines |
Probably worth explicitly stating we're leaving an empty gateway here for IPv6 nexthops.