You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
net: Put flowi_* prefix on AF independent members of struct flowi
I intend to turn struct flowi into a union of AF specific flowi structs. There will be a common structure that each variant includes first, much like struct sock_common. This is the first step to move in that direction. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -239,7 +239,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
|
||||
memset(&fl, 0, sizeof fl);
|
||||
ipv6_addr_copy(&fl.fl6_dst, &dst_in->sin6_addr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &src_in->sin6_addr);
|
||||
fl.oif = addr->bound_dev_if;
|
||||
fl.flowi_oif = addr->bound_dev_if;
|
||||
|
||||
dst = ip6_route_output(&init_net, NULL, &fl);
|
||||
if ((ret = dst->error))
|
||||
|
||||
+1
-1
@@ -3429,7 +3429,7 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
ipv6_addr_copy(&fl.fl6_dst, &dst_addr->sin6_addr);
|
||||
if (ipv6_addr_type(&fl.fl6_dst) & IPV6_ADDR_LINKLOCAL)
|
||||
fl.oif = dst_addr->sin6_scope_id;
|
||||
fl.flowi_oif = dst_addr->sin6_scope_id;
|
||||
|
||||
*dst = ip6_route_output(&init_net, NULL, &fl);
|
||||
if (*dst)
|
||||
|
||||
@@ -82,12 +82,12 @@ struct dn_route {
|
||||
|
||||
static inline bool dn_is_input_route(struct dn_route *rt)
|
||||
{
|
||||
return rt->fl.iif != 0;
|
||||
return rt->fl.flowi_iif != 0;
|
||||
}
|
||||
|
||||
static inline bool dn_is_output_route(struct dn_route *rt)
|
||||
{
|
||||
return rt->fl.iif == 0;
|
||||
return rt->fl.flowi_iif == 0;
|
||||
}
|
||||
|
||||
extern void dn_route_init(void);
|
||||
|
||||
+11
-11
@@ -11,17 +11,17 @@
|
||||
#include <asm/atomic.h>
|
||||
|
||||
struct flowi {
|
||||
int oif;
|
||||
int iif;
|
||||
__u32 mark;
|
||||
__u8 tos;
|
||||
__u8 scope;
|
||||
__u8 proto;
|
||||
__u8 flags;
|
||||
int flowi_oif;
|
||||
int flowi_iif;
|
||||
__u32 flowi_mark;
|
||||
__u8 flowi_tos;
|
||||
__u8 flowi_scope;
|
||||
__u8 flowi_proto;
|
||||
__u8 flowi_flags;
|
||||
#define FLOWI_FLAG_ANYSRC 0x01
|
||||
#define FLOWI_FLAG_PRECOW_METRICS 0x02
|
||||
#define FLOWI_FLAG_CAN_SLEEP 0x04
|
||||
__u32 secid;
|
||||
__u32 flowi_secid;
|
||||
|
||||
union {
|
||||
struct {
|
||||
@@ -49,8 +49,8 @@ struct flowi {
|
||||
#define fl6_flowlabel nl_u.ip6_u.flowlabel
|
||||
#define fl4_dst nl_u.ip4_u.daddr
|
||||
#define fl4_src nl_u.ip4_u.saddr
|
||||
#define fl4_tos tos
|
||||
#define fl4_scope scope
|
||||
#define fl4_tos flowi_tos
|
||||
#define fl4_scope flowi_scope
|
||||
|
||||
union {
|
||||
struct {
|
||||
@@ -116,7 +116,7 @@ extern atomic_t flow_cache_genid;
|
||||
static inline int flow_cache_uli_match(const struct flowi *fl1,
|
||||
const struct flowi *fl2)
|
||||
{
|
||||
return (fl1->proto == fl2->proto &&
|
||||
return (fl1->flowi_proto == fl2->flowi_proto &&
|
||||
!memcmp(&fl1->uli_u, &fl2->uli_u, sizeof(fl1->uli_u)));
|
||||
}
|
||||
|
||||
|
||||
+18
-18
@@ -136,7 +136,7 @@ static inline struct rtable *ip_route_output(struct net *net, __be32 daddr,
|
||||
__be32 saddr, u8 tos, int oif)
|
||||
{
|
||||
struct flowi fl = {
|
||||
.oif = oif,
|
||||
.flowi_oif = oif,
|
||||
.fl4_dst = daddr,
|
||||
.fl4_src = saddr,
|
||||
.fl4_tos = tos,
|
||||
@@ -150,13 +150,13 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct sock
|
||||
__u8 proto, __u8 tos, int oif)
|
||||
{
|
||||
struct flowi fl = {
|
||||
.oif = oif,
|
||||
.flags = sk ? inet_sk_flowi_flags(sk) : 0,
|
||||
.mark = sk ? sk->sk_mark : 0,
|
||||
.flowi_oif = oif,
|
||||
.flowi_flags = sk ? inet_sk_flowi_flags(sk) : 0,
|
||||
.flowi_mark = sk ? sk->sk_mark : 0,
|
||||
.fl4_dst = daddr,
|
||||
.fl4_src = saddr,
|
||||
.fl4_tos = tos,
|
||||
.proto = proto,
|
||||
.flowi_proto = proto,
|
||||
.fl_ip_dport = dport,
|
||||
.fl_ip_sport = sport,
|
||||
};
|
||||
@@ -170,11 +170,11 @@ static inline struct rtable *ip_route_output_gre(struct net *net,
|
||||
__be32 gre_key, __u8 tos, int oif)
|
||||
{
|
||||
struct flowi fl = {
|
||||
.oif = oif,
|
||||
.flowi_oif = oif,
|
||||
.fl4_dst = daddr,
|
||||
.fl4_src = saddr,
|
||||
.fl4_tos = tos,
|
||||
.proto = IPPROTO_GRE,
|
||||
.flowi_proto = IPPROTO_GRE,
|
||||
.fl_gre_key = gre_key,
|
||||
};
|
||||
return ip_route_output_key(net, &fl);
|
||||
@@ -228,23 +228,23 @@ static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos,
|
||||
__be16 sport, __be16 dport,
|
||||
struct sock *sk, bool can_sleep)
|
||||
{
|
||||
struct flowi fl = { .oif = oif,
|
||||
.mark = sk->sk_mark,
|
||||
struct flowi fl = { .flowi_oif = oif,
|
||||
.flowi_mark = sk->sk_mark,
|
||||
.fl4_dst = dst,
|
||||
.fl4_src = src,
|
||||
.fl4_tos = tos,
|
||||
.proto = protocol,
|
||||
.flowi_proto = protocol,
|
||||
.fl_ip_sport = sport,
|
||||
.fl_ip_dport = dport };
|
||||
struct net *net = sock_net(sk);
|
||||
struct rtable *rt;
|
||||
|
||||
if (inet_sk(sk)->transparent)
|
||||
fl.flags |= FLOWI_FLAG_ANYSRC;
|
||||
fl.flowi_flags |= FLOWI_FLAG_ANYSRC;
|
||||
if (protocol == IPPROTO_TCP)
|
||||
fl.flags |= FLOWI_FLAG_PRECOW_METRICS;
|
||||
fl.flowi_flags |= FLOWI_FLAG_PRECOW_METRICS;
|
||||
if (can_sleep)
|
||||
fl.flags |= FLOWI_FLAG_CAN_SLEEP;
|
||||
fl.flowi_flags |= FLOWI_FLAG_CAN_SLEEP;
|
||||
|
||||
if (!dst || !src) {
|
||||
rt = __ip_route_output_key(net, &fl);
|
||||
@@ -264,19 +264,19 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
|
||||
__be16 dport, struct sock *sk)
|
||||
{
|
||||
if (sport != orig_sport || dport != orig_dport) {
|
||||
struct flowi fl = { .oif = rt->rt_oif,
|
||||
.mark = rt->rt_mark,
|
||||
struct flowi fl = { .flowi_oif = rt->rt_oif,
|
||||
.flowi_mark = rt->rt_mark,
|
||||
.fl4_dst = rt->rt_key_dst,
|
||||
.fl4_src = rt->rt_key_src,
|
||||
.fl4_tos = rt->rt_tos,
|
||||
.proto = protocol,
|
||||
.flowi_proto = protocol,
|
||||
.fl_ip_sport = sport,
|
||||
.fl_ip_dport = dport };
|
||||
|
||||
if (inet_sk(sk)->transparent)
|
||||
fl.flags |= FLOWI_FLAG_ANYSRC;
|
||||
fl.flowi_flags |= FLOWI_FLAG_ANYSRC;
|
||||
if (protocol == IPPROTO_TCP)
|
||||
fl.flags |= FLOWI_FLAG_PRECOW_METRICS;
|
||||
fl.flowi_flags |= FLOWI_FLAG_PRECOW_METRICS;
|
||||
ip_rt_put(rt);
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
return ip_route_output_flow(sock_net(sk), &fl, sk);
|
||||
|
||||
+2
-2
@@ -803,7 +803,7 @@ static __inline__
|
||||
__be16 xfrm_flowi_sport(const struct flowi *fl)
|
||||
{
|
||||
__be16 port;
|
||||
switch(fl->proto) {
|
||||
switch(fl->flowi_proto) {
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_UDPLITE:
|
||||
@@ -830,7 +830,7 @@ static __inline__
|
||||
__be16 xfrm_flowi_dport(const struct flowi *fl)
|
||||
{
|
||||
__be16 port;
|
||||
switch(fl->proto) {
|
||||
switch(fl->flowi_proto) {
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_UDPLITE:
|
||||
|
||||
@@ -181,13 +181,13 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (rule->iifindex && (rule->iifindex != fl->iif))
|
||||
if (rule->iifindex && (rule->iifindex != fl->flowi_iif))
|
||||
goto out;
|
||||
|
||||
if (rule->oifindex && (rule->oifindex != fl->oif))
|
||||
if (rule->oifindex && (rule->oifindex != fl->flowi_oif))
|
||||
goto out;
|
||||
|
||||
if ((rule->mark ^ fl->mark) & rule->mark_mask)
|
||||
if ((rule->mark ^ fl->flowi_mark) & rule->mark_mask)
|
||||
goto out;
|
||||
|
||||
ret = ops->match(rule, fl, flags);
|
||||
|
||||
+4
-3
@@ -465,13 +465,14 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct rtable *rt;
|
||||
struct flowi fl = { .oif = skb_rtable(skb)->rt_iif,
|
||||
struct flowi fl = {
|
||||
.flowi_oif = skb_rtable(skb)->rt_iif,
|
||||
.fl4_dst = ip_hdr(skb)->saddr,
|
||||
.fl4_src = ip_hdr(skb)->daddr,
|
||||
.fl4_tos = RT_CONN_FLAGS(sk),
|
||||
.proto = sk->sk_protocol,
|
||||
.flowi_proto = sk->sk_protocol,
|
||||
.fl_ip_sport = dccp_hdr(skb)->dccph_dport,
|
||||
.fl_ip_dport = dccp_hdr(skb)->dccph_sport
|
||||
.fl_ip_dport = dccp_hdr(skb)->dccph_sport,
|
||||
};
|
||||
|
||||
security_skb_classify_flow(skb, &fl);
|
||||
|
||||
+10
-10
@@ -154,10 +154,10 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||
for now.
|
||||
*/
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.proto = IPPROTO_DCCP;
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
|
||||
fl.oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.fl_ip_dport = inet->inet_dport;
|
||||
fl.fl_ip_sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
@@ -248,11 +248,11 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
|
||||
struct dst_entry *dst;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.proto = IPPROTO_DCCP;
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
|
||||
fl.fl6_flowlabel = 0;
|
||||
fl.oif = ireq6->iif;
|
||||
fl.flowi_oif = ireq6->iif;
|
||||
fl.fl_ip_dport = inet_rsk(req)->rmt_port;
|
||||
fl.fl_ip_sport = inet_rsk(req)->loc_port;
|
||||
security_req_classify_flow(req, &fl);
|
||||
@@ -321,8 +321,8 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
|
||||
ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &rxip6h->daddr);
|
||||
|
||||
fl.proto = IPPROTO_DCCP;
|
||||
fl.oif = inet6_iif(rxskb);
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
fl.flowi_oif = inet6_iif(rxskb);
|
||||
fl.fl_ip_dport = dccp_hdr(skb)->dccph_dport;
|
||||
fl.fl_ip_sport = dccp_hdr(skb)->dccph_sport;
|
||||
security_skb_classify_flow(rxskb, &fl);
|
||||
@@ -530,11 +530,11 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
|
||||
struct flowi fl;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.proto = IPPROTO_DCCP;
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
|
||||
final_p = fl6_update_dst(&fl, opt, &final);
|
||||
ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
|
||||
fl.oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.fl_ip_dport = inet_rsk(req)->rmt_port;
|
||||
fl.fl_ip_sport = inet_rsk(req)->loc_port;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
@@ -953,10 +953,10 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
if (!ipv6_addr_any(&np->rcv_saddr))
|
||||
saddr = &np->rcv_saddr;
|
||||
|
||||
fl.proto = IPPROTO_DCCP;
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr);
|
||||
fl.oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.fl_ip_dport = usin->sin6_port;
|
||||
fl.fl_ip_sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
|
||||
@@ -948,11 +948,11 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
|
||||
|
||||
err = -EHOSTUNREACH;
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.fld_dst = dn_saddr2dn(&scp->peer);
|
||||
fl.fld_src = dn_saddr2dn(&scp->addr);
|
||||
dn_sk_ports_copy(&fl, scp);
|
||||
fl.proto = DNPROTO_NSP;
|
||||
fl.flowi_proto = DNPROTO_NSP;
|
||||
if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, flags) < 0)
|
||||
goto out;
|
||||
sk->sk_route_caps = sk->sk_dst_cache->dev->features;
|
||||
|
||||
+2
-2
@@ -223,7 +223,7 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.fld_dst = nh->nh_gw;
|
||||
fl.oif = nh->nh_oif;
|
||||
fl.flowi_oif = nh->nh_oif;
|
||||
fl.fld_scope = r->rtm_scope + 1;
|
||||
|
||||
if (fl.fld_scope < RT_SCOPE_LINK)
|
||||
@@ -424,7 +424,7 @@ int dn_fib_semantic_match(int type, struct dn_fib_info *fi, const struct flowi *
|
||||
for_nexthops(fi) {
|
||||
if (nh->nh_flags & RTNH_F_DEAD)
|
||||
continue;
|
||||
if (!fl->oif || fl->oif == nh->nh_oif)
|
||||
if (!fl->flowi_oif || fl->flowi_oif == nh->nh_oif)
|
||||
break;
|
||||
}
|
||||
if (nhsel < fi->fib_nhs) {
|
||||
|
||||
@@ -92,11 +92,11 @@ try_again:
|
||||
}
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.fld_src = dn_saddr2dn(&scp->addr);
|
||||
fl.fld_dst = dn_saddr2dn(&scp->peer);
|
||||
dn_sk_ports_copy(&fl, scp);
|
||||
fl.proto = DNPROTO_NSP;
|
||||
fl.flowi_proto = DNPROTO_NSP;
|
||||
if (dn_route_output_sock(&sk->sk_dst_cache, &fl, sk, 0) == 0) {
|
||||
dst = sk_dst_get(sk);
|
||||
sk->sk_route_caps = dst->dev->features;
|
||||
|
||||
+46
-42
@@ -286,10 +286,10 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
|
||||
{
|
||||
return ((fl1->fld_dst ^ fl2->fld_dst) |
|
||||
(fl1->fld_src ^ fl2->fld_src) |
|
||||
(fl1->mark ^ fl2->mark) |
|
||||
(fl1->flowi_mark ^ fl2->flowi_mark) |
|
||||
(fl1->fld_scope ^ fl2->fld_scope) |
|
||||
(fl1->oif ^ fl2->oif) |
|
||||
(fl1->iif ^ fl2->iif)) == 0;
|
||||
(fl1->flowi_oif ^ fl2->flowi_oif) |
|
||||
(fl1->flowi_iif ^ fl2->flowi_iif)) == 0;
|
||||
}
|
||||
|
||||
static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route **rp)
|
||||
@@ -905,12 +905,14 @@ static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_re
|
||||
|
||||
static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *oldflp, int try_hard)
|
||||
{
|
||||
struct flowi fl = { .fld_dst = oldflp->fld_dst,
|
||||
struct flowi fl = {
|
||||
.fld_dst = oldflp->fld_dst,
|
||||
.fld_src = oldflp->fld_src,
|
||||
.fld_scope = RT_SCOPE_UNIVERSE,
|
||||
.mark = oldflp->mark,
|
||||
.iif = init_net.loopback_dev->ifindex,
|
||||
.oif = oldflp->oif };
|
||||
.flowi_mark = oldflp->flowi_mark,
|
||||
.flowi_iif = init_net.loopback_dev->ifindex,
|
||||
.flowi_oif = oldflp->flowi_oif,
|
||||
};
|
||||
struct dn_route *rt = NULL;
|
||||
struct net_device *dev_out = NULL, *dev;
|
||||
struct neighbour *neigh = NULL;
|
||||
@@ -926,11 +928,11 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
|
||||
"dn_route_output_slow: dst=%04x src=%04x mark=%d"
|
||||
" iif=%d oif=%d\n", le16_to_cpu(oldflp->fld_dst),
|
||||
le16_to_cpu(oldflp->fld_src),
|
||||
oldflp->mark, init_net.loopback_dev->ifindex, oldflp->oif);
|
||||
oldflp->flowi_mark, init_net.loopback_dev->ifindex, oldflp->flowi_oif);
|
||||
|
||||
/* If we have an output interface, verify its a DECnet device */
|
||||
if (oldflp->oif) {
|
||||
dev_out = dev_get_by_index(&init_net, oldflp->oif);
|
||||
if (oldflp->flowi_oif) {
|
||||
dev_out = dev_get_by_index(&init_net, oldflp->flowi_oif);
|
||||
err = -ENODEV;
|
||||
if (dev_out && dev_out->dn_ptr == NULL) {
|
||||
dev_put(dev_out);
|
||||
@@ -988,7 +990,7 @@ source_ok:
|
||||
if (!fl.fld_dst)
|
||||
goto out;
|
||||
}
|
||||
fl.oif = init_net.loopback_dev->ifindex;
|
||||
fl.flowi_oif = init_net.loopback_dev->ifindex;
|
||||
res.type = RTN_LOCAL;
|
||||
goto make_route;
|
||||
}
|
||||
@@ -998,7 +1000,7 @@ source_ok:
|
||||
"dn_route_output_slow: initial checks complete."
|
||||
" dst=%o4x src=%04x oif=%d try_hard=%d\n",
|
||||
le16_to_cpu(fl.fld_dst), le16_to_cpu(fl.fld_src),
|
||||
fl.oif, try_hard);
|
||||
fl.flowi_oif, try_hard);
|
||||
|
||||
/*
|
||||
* N.B. If the kernel is compiled without router support then
|
||||
@@ -1023,8 +1025,8 @@ source_ok:
|
||||
if (!try_hard) {
|
||||
neigh = neigh_lookup_nodev(&dn_neigh_table, &init_net, &fl.fld_dst);
|
||||
if (neigh) {
|
||||
if ((oldflp->oif &&
|
||||
(neigh->dev->ifindex != oldflp->oif)) ||
|
||||
if ((oldflp->flowi_oif &&
|
||||
(neigh->dev->ifindex != oldflp->flowi_oif)) ||
|
||||
(oldflp->fld_src &&
|
||||
(!dn_dev_islocal(neigh->dev,
|
||||
oldflp->fld_src)))) {
|
||||
@@ -1078,7 +1080,7 @@ select_source:
|
||||
if (fl.fld_src == 0 && res.type != RTN_LOCAL)
|
||||
goto e_addr;
|
||||
}
|
||||
fl.oif = dev_out->ifindex;
|
||||
fl.flowi_oif = dev_out->ifindex;
|
||||
goto make_route;
|
||||
}
|
||||
free_res = 1;
|
||||
@@ -1093,14 +1095,14 @@ select_source:
|
||||
dev_put(dev_out);
|
||||
dev_out = init_net.loopback_dev;
|
||||
dev_hold(dev_out);
|
||||
fl.oif = dev_out->ifindex;
|
||||
fl.flowi_oif = dev_out->ifindex;
|
||||
if (res.fi)
|
||||
dn_fib_info_put(res.fi);
|
||||
res.fi = NULL;
|
||||
goto make_route;
|
||||
}
|
||||
|
||||
if (res.fi->fib_nhs > 1 && fl.oif == 0)
|
||||
if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0)
|
||||
dn_fib_select_multipath(&fl, &res);
|
||||
|
||||
/*
|
||||
@@ -1115,7 +1117,7 @@ select_source:
|
||||
dev_put(dev_out);
|
||||
dev_out = DN_FIB_RES_DEV(res);
|
||||
dev_hold(dev_out);
|
||||
fl.oif = dev_out->ifindex;
|
||||
fl.flowi_oif = dev_out->ifindex;
|
||||
gateway = DN_FIB_RES_GW(res);
|
||||
|
||||
make_route:
|
||||
@@ -1131,9 +1133,9 @@ make_route:
|
||||
|
||||
rt->fl.fld_src = oldflp->fld_src;
|
||||
rt->fl.fld_dst = oldflp->fld_dst;
|
||||
rt->fl.oif = oldflp->oif;
|
||||
rt->fl.iif = 0;
|
||||
rt->fl.mark = oldflp->mark;
|
||||
rt->fl.flowi_oif = oldflp->flowi_oif;
|
||||
rt->fl.flowi_iif = 0;
|
||||
rt->fl.flowi_mark = oldflp->flowi_mark;
|
||||
|
||||
rt->rt_saddr = fl.fld_src;
|
||||
rt->rt_daddr = fl.fld_dst;
|
||||
@@ -1201,9 +1203,9 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
|
||||
rt = rcu_dereference_bh(rt->dst.dn_next)) {
|
||||
if ((flp->fld_dst == rt->fl.fld_dst) &&
|
||||
(flp->fld_src == rt->fl.fld_src) &&
|
||||
(flp->mark == rt->fl.mark) &&
|
||||
(flp->flowi_mark == rt->fl.flowi_mark) &&
|
||||
dn_is_output_route(rt) &&
|
||||
(rt->fl.oif == flp->oif)) {
|
||||
(rt->fl.flowi_oif == flp->flowi_oif)) {
|
||||
dst_use(&rt->dst, jiffies);
|
||||
rcu_read_unlock_bh();
|
||||
*pprt = &rt->dst;
|
||||
@@ -1221,7 +1223,7 @@ static int dn_route_output_key(struct dst_entry **pprt, struct flowi *flp, int f
|
||||
int err;
|
||||
|
||||
err = __dn_route_output_key(pprt, flp, flags);
|
||||
if (err == 0 && flp->proto) {
|
||||
if (err == 0 && flp->flowi_proto) {
|
||||
*pprt = xfrm_lookup(&init_net, *pprt, flp, NULL, 0);
|
||||
if (IS_ERR(*pprt)) {
|
||||
err = PTR_ERR(*pprt);
|
||||
@@ -1236,9 +1238,9 @@ int dn_route_output_sock(struct dst_entry **pprt, struct flowi *fl, struct sock
|
||||
int err;
|
||||
|
||||
err = __dn_route_output_key(pprt, fl, flags & MSG_TRYHARD);
|
||||
if (err == 0 && fl->proto) {
|
||||
if (err == 0 && fl->flowi_proto) {
|
||||
if (!(flags & MSG_DONTWAIT))
|
||||
fl->flags |= FLOWI_FLAG_CAN_SLEEP;
|
||||
fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP;
|
||||
*pprt = xfrm_lookup(&init_net, *pprt, fl, sk, 0);
|
||||
if (IS_ERR(*pprt)) {
|
||||
err = PTR_ERR(*pprt);
|
||||
@@ -1260,11 +1262,13 @@ static int dn_route_input_slow(struct sk_buff *skb)
|
||||
int flags = 0;
|
||||
__le16 gateway = 0;
|
||||
__le16 local_src = 0;
|
||||
struct flowi fl = { .fld_dst = cb->dst,
|
||||
struct flowi fl = {
|
||||
.fld_dst = cb->dst,
|
||||
.fld_src = cb->src,
|
||||
.fld_scope = RT_SCOPE_UNIVERSE,
|
||||
.mark = skb->mark,
|
||||
.iif = skb->dev->ifindex };
|
||||
.flowi_mark = skb->mark,
|
||||
.flowi_iif = skb->dev->ifindex,
|
||||
};
|
||||
struct dn_fib_res res = { .fi = NULL, .type = RTN_UNREACHABLE };
|
||||
int err = -EINVAL;
|
||||
int free_res = 0;
|
||||
@@ -1343,7 +1347,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
|
||||
if (dn_db->parms.forwarding == 0)
|
||||
goto e_inval;
|
||||
|
||||
if (res.fi->fib_nhs > 1 && fl.oif == 0)
|
||||
if (res.fi->fib_nhs > 1 && fl.flowi_oif == 0)
|
||||
dn_fib_select_multipath(&fl, &res);
|
||||
|
||||
/*
|
||||
@@ -1408,9 +1412,9 @@ make_route:
|
||||
|
||||
rt->fl.fld_src = cb->src;
|
||||
rt->fl.fld_dst = cb->dst;
|
||||
rt->fl.oif = 0;
|
||||
rt->fl.iif = in_dev->ifindex;
|
||||
rt->fl.mark = fl.mark;
|
||||
rt->fl.flowi_oif = 0;
|
||||
rt->fl.flowi_iif = in_dev->ifindex;
|
||||
rt->fl.flowi_mark = fl.flowi_mark;
|
||||
|
||||
rt->dst.flags = DST_HOST;
|
||||
rt->dst.neighbour = neigh;
|
||||
@@ -1482,9 +1486,9 @@ static int dn_route_input(struct sk_buff *skb)
|
||||
rt = rcu_dereference(rt->dst.dn_next)) {
|
||||
if ((rt->fl.fld_src == cb->src) &&
|
||||
(rt->fl.fld_dst == cb->dst) &&
|
||||
(rt->fl.oif == 0) &&
|
||||
(rt->fl.mark == skb->mark) &&
|
||||
(rt->fl.iif == cb->iif)) {
|
||||
(rt->fl.flowi_oif == 0) &&
|
||||
(rt->fl.flowi_mark == skb->mark) &&
|
||||
(rt->fl.flowi_iif == cb->iif)) {
|
||||
dst_use(&rt->dst, jiffies);
|
||||
rcu_read_unlock();
|
||||
skb_dst_set(skb, (struct dst_entry *)rt);
|
||||
@@ -1541,7 +1545,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
|
||||
rt->dst.error) < 0)
|
||||
goto rtattr_failure;
|
||||
if (dn_is_input_route(rt))
|
||||
RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif);
|
||||
RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.flowi_iif);
|
||||
|
||||
nlh->nlmsg_len = skb_tail_pointer(skb) - b;
|
||||
return skb->len;
|
||||
@@ -1570,7 +1574,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
|
||||
return -EINVAL;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.proto = DNPROTO_NSP;
|
||||
fl.flowi_proto = DNPROTO_NSP;
|
||||
|
||||
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
|
||||
if (skb == NULL)
|
||||
@@ -1583,11 +1587,11 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
|
||||
if (rta[RTA_DST-1])
|
||||
memcpy(&fl.fld_dst, RTA_DATA(rta[RTA_DST-1]), 2);
|
||||
if (rta[RTA_IIF-1])
|
||||
memcpy(&fl.iif, RTA_DATA(rta[RTA_IIF-1]), sizeof(int));
|
||||
memcpy(&fl.flowi_iif, RTA_DATA(rta[RTA_IIF-1]), sizeof(int));
|
||||
|
||||
if (fl.iif) {
|
||||
if (fl.flowi_iif) {
|
||||
struct net_device *dev;
|
||||
if ((dev = dev_get_by_index(&init_net, fl.iif)) == NULL) {
|
||||
if ((dev = dev_get_by_index(&init_net, fl.flowi_iif)) == NULL) {
|
||||
kfree_skb(skb);
|
||||
return -ENODEV;
|
||||
}
|
||||
@@ -1611,7 +1615,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
|
||||
int oif = 0;
|
||||
if (rta[RTA_OIF - 1])
|
||||
memcpy(&oif, RTA_DATA(rta[RTA_OIF - 1]), sizeof(int));
|
||||
fl.oif = oif;
|
||||
fl.flowi_oif = oif;
|
||||
err = dn_route_output_key((struct dst_entry **)&rt, &fl, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -200,9 +200,9 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
|
||||
int ret;
|
||||
struct net *net;
|
||||
|
||||
fl.oif = 0;
|
||||
fl.iif = oif;
|
||||
fl.mark = mark;
|
||||
fl.flowi_oif = 0;
|
||||
fl.flowi_iif = oif;
|
||||
fl.flowi_mark = mark;
|
||||
fl.fl4_dst = src;
|
||||
fl.fl4_src = dst;
|
||||
fl.fl4_tos = tos;
|
||||
@@ -215,7 +215,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
|
||||
rpf = IN_DEV_RPFILTER(in_dev);
|
||||
accept_local = IN_DEV_ACCEPT_LOCAL(in_dev);
|
||||
if (mark && !IN_DEV_SRC_VMARK(in_dev))
|
||||
fl.mark = 0;
|
||||
fl.flowi_mark = 0;
|
||||
}
|
||||
|
||||
if (in_dev == NULL)
|
||||
@@ -253,7 +253,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
|
||||
goto last_resort;
|
||||
if (rpf == 1)
|
||||
goto e_rpf;
|
||||
fl.oif = dev->ifindex;
|
||||
fl.flowi_oif = dev->ifindex;
|
||||
|
||||
ret = 0;
|
||||
if (fib_lookup(net, &fl, &res) == 0) {
|
||||
@@ -797,7 +797,7 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb)
|
||||
|
||||
struct fib_result res;
|
||||
struct flowi fl = {
|
||||
.mark = frn->fl_mark,
|
||||
.flowi_mark = frn->fl_mark,
|
||||
.fl4_dst = frn->fl_addr,
|
||||
.fl4_tos = frn->fl_tos,
|
||||
.fl4_scope = frn->fl_scope,
|
||||
|
||||
@@ -563,7 +563,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
|
||||
struct flowi fl = {
|
||||
.fl4_dst = nh->nh_gw,
|
||||
.fl4_scope = cfg->fc_scope + 1,
|
||||
.oif = nh->nh_oif,
|
||||
.flowi_oif = nh->nh_oif,
|
||||
};
|
||||
|
||||
/* It is not necessary, but requires a bit of thinking */
|
||||
|
||||
+1
-1
@@ -1379,7 +1379,7 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l,
|
||||
|
||||
if (nh->nh_flags & RTNH_F_DEAD)
|
||||
continue;
|
||||
if (flp->oif && flp->oif != nh->nh_oif)
|
||||
if (flp->flowi_oif && flp->flowi_oif != nh->nh_oif)
|
||||
continue;
|
||||
|
||||
#ifdef CONFIG_IP_FIB_TRIE_STATS
|
||||
|
||||
+5
-3
@@ -353,10 +353,12 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
|
||||
daddr = icmp_param->replyopts.faddr;
|
||||
}
|
||||
{
|
||||
struct flowi fl = { .fl4_dst= daddr,
|
||||
struct flowi fl = {
|
||||
.fl4_dst = daddr,
|
||||
.fl4_src = rt->rt_spec_dst,
|
||||
.fl4_tos = RT_TOS(ip_hdr(skb)->tos),
|
||||
.proto = IPPROTO_ICMP };
|
||||
.flowi_proto = IPPROTO_ICMP,
|
||||
};
|
||||
security_skb_classify_flow(skb, &fl);
|
||||
rt = ip_route_output_key(net, &fl);
|
||||
if (IS_ERR(rt))
|
||||
@@ -381,7 +383,7 @@ static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in,
|
||||
param->replyopts.faddr : iph->saddr),
|
||||
.fl4_src = saddr,
|
||||
.fl4_tos = RT_TOS(tos),
|
||||
.proto = IPPROTO_ICMP,
|
||||
.flowi_proto = IPPROTO_ICMP,
|
||||
.fl_icmp_type = type,
|
||||
.fl_icmp_code = code,
|
||||
};
|
||||
|
||||
@@ -356,16 +356,18 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,
|
||||
struct rtable *rt;
|
||||
const struct inet_request_sock *ireq = inet_rsk(req);
|
||||
struct ip_options *opt = inet_rsk(req)->opt;
|
||||
struct flowi fl = { .oif = sk->sk_bound_dev_if,
|
||||
.mark = sk->sk_mark,
|
||||
struct flowi fl = {
|
||||
.flowi_oif = sk->sk_bound_dev_if,
|
||||
.flowi_mark = sk->sk_mark,
|
||||
.fl4_dst = ((opt && opt->srr) ?
|
||||
opt->faddr : ireq->rmt_addr),
|
||||
.fl4_src = ireq->loc_addr,
|
||||
.fl4_tos = RT_CONN_FLAGS(sk),
|
||||
.proto = sk->sk_protocol,
|
||||
.flags = inet_sk_flowi_flags(sk),
|
||||
.flowi_proto = sk->sk_protocol,
|
||||
.flowi_flags = inet_sk_flowi_flags(sk),
|
||||
.fl_ip_sport = inet_sk(sk)->inet_sport,
|
||||
.fl_ip_dport = ireq->rmt_port };
|
||||
.fl_ip_dport = ireq->rmt_port,
|
||||
};
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
security_req_classify_flow(req, &fl);
|
||||
|
||||
@@ -1474,14 +1474,16 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
|
||||
}
|
||||
|
||||
{
|
||||
struct flowi fl = { .oif = arg->bound_dev_if,
|
||||
struct flowi fl = {
|
||||
.flowi_oif = arg->bound_dev_if,
|
||||
.fl4_dst = daddr,
|
||||
.fl4_src = rt->rt_spec_dst,
|
||||
.fl4_tos = RT_TOS(ip_hdr(skb)->tos),
|
||||
.fl_ip_sport = tcp_hdr(skb)->dest,
|
||||
.fl_ip_dport = tcp_hdr(skb)->source,
|
||||
.proto = sk->sk_protocol,
|
||||
.flags = ip_reply_arg_flowi_flags(arg) };
|
||||
.flowi_proto = sk->sk_protocol,
|
||||
.flowi_flags = ip_reply_arg_flowi_flags(arg),
|
||||
};
|
||||
security_skb_classify_flow(skb, &fl);
|
||||
rt = ip_route_output_key(sock_net(sk), &fl);
|
||||
if (IS_ERR(rt))
|
||||
|
||||
+6
-6
@@ -436,9 +436,9 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
struct net *net = dev_net(dev);
|
||||
struct mr_table *mrt;
|
||||
struct flowi fl = {
|
||||
.oif = dev->ifindex,
|
||||
.iif = skb->skb_iif,
|
||||
.mark = skb->mark,
|
||||
.flowi_oif = dev->ifindex,
|
||||
.flowi_iif = skb->skb_iif,
|
||||
.flowi_mark = skb->mark,
|
||||
};
|
||||
int err;
|
||||
|
||||
@@ -1793,9 +1793,9 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct rtable *rt)
|
||||
.fl4_dst = rt->rt_key_dst,
|
||||
.fl4_src = rt->rt_key_src,
|
||||
.fl4_tos = rt->rt_tos,
|
||||
.oif = rt->rt_oif,
|
||||
.iif = rt->rt_iif,
|
||||
.mark = rt->rt_mark,
|
||||
.flowi_oif = rt->rt_oif,
|
||||
.flowi_iif = rt->rt_iif,
|
||||
.flowi_mark = rt->rt_mark,
|
||||
};
|
||||
struct mr_table *mrt;
|
||||
int err;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user