net: use the macros defined for the members of flowi
Subsystems (11)
PATCH 1/1 net: use the macros defined for the members of flowi
Use the macros defined for the members of flowi to clean the code up.
--- include/net/route.h | 12 ++++------- net/atm/clip.c | 3 +- net/bridge/br_netfilter.c | 9 +------- net/dccp/ipv4.c | 13 ++++-------- net/decnet/dn_route.c | 22 ++++++++------------ net/decnet/dn_rules.c | 2 - net/ipv4/af_inet.c | 18 ++++------------ net/ipv4/arp.c | 12 +++++------ net/ipv4/fib_frontend.c | 28 +++++++------------------- net/ipv4/fib_semantics.c | 8 +------ net/ipv4/icmp.c | 28 ++++++++------------------ net/ipv4/igmp.c | 8 ++----- net/ipv4/inet_connection_sock.c | 15 +++++-------- net/ipv4/ip_gre.c | 30 ++++++++------------------- net/ipv4/ip_output.c | 25 +++++++++-------------- net/ipv4/ipip.c | 20 +++++------------- net/ipv4/ipmr.c | 18 ++++------------ net/ipv4/netfilter.c | 8 +++---- net/ipv4/raw.c | 7 ++---- net/ipv4/route.c | 43 +++++++++++++++------------------------- net/ipv4/syncookies.c | 15 +++++-------- net/ipv4/udp.c | 12 ++++------- net/ipv4/xfrm4_policy.c | 8 +------ net/ipv6/ip6mr.c | 4 --- net/ipv6/netfilter.c | 6 +---- net/ipv6/route.c | 24 +++++----------------- net/ipv6/sit.c | 14 +++++-------- net/l2tp/l2tp_ip.c | 12 ++++------- net/netfilter/ipvs/ip_vs_ctl.c | 6 +---- net/netfilter/ipvs/ip_vs_xmit.c | 34 +++++++------------------------ net/netfilter/xt_TEE.c | 12 +++++------ net/rxrpc/ar-peer.c | 10 ++++----- 32 files changed, 171 insertions(+), 315 deletions(-)
include/net/route.h +5 -7
@@ -169,14 +169,12 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, {struct flowi fl = { .oif = oif, .mark = sk->sk_mark, - .nl_u = { .ip4_u = { .daddr = dst, - .saddr = src, - .tos = tos } }, + .fl4_dst = dst, + .fl4_src = src, + .fl4_tos = tos, .proto = protocol, - .uli_u = { .ports = - { .sport = sport, - .dport = dport } } }; - + .fl_ip_sport = sport, + .fl_ip_dport = dport };int err;struct net *net =sock_net (sk);
net/atm/clip.c +2 -1
@@ -502,7 +502,8 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)struct atmarp_entry *entry;int error;struct clip_vcc *clip_vcc; -struct flowi fl = { .nl_u = { .ip4_u = { .daddr = ip, .tos =1 }} }; +struct flowi fl = { .fl4_dst = ip, + .fl4_tos =1 };struct rtable *rt;if (vcc->push != clip_push) {
net/bridge/br_netfilter.c +2 -7
@@ -412,13 +412,8 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)if (dnat_took_place (skb)) {if ((err =ip_route_input (skb, iph->daddr, iph->saddr, iph->tos, dev))) {struct flowi fl = { - .nl_u = { - .ip4_u = { - .daddr = iph->daddr, - .saddr =0 , - .tos =RT_TOS (iph->tos) }, - }, - .proto =0 , + .fl4_dst = iph->daddr, + .fl4_tos =RT_TOS (iph->tos), };struct in_device *in_dev =__in_dev_get_rcu (dev);
net/dccp/ipv4.c +5 -8
@@ -462,15 +462,12 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk, {struct rtable *rt;struct flowi fl = { .oif =skb_rtable (skb)->rt_iif, - .nl_u = { .ip4_u = - { .daddr =ip_hdr (skb)->saddr, - .saddr =ip_hdr (skb)->daddr, - .tos =RT_CONN_FLAGS (sk) } }, + .fl4_dst =ip_hdr (skb)->saddr, + .fl4_src =ip_hdr (skb)->daddr, + .fl4_tos =RT_CONN_FLAGS (sk), .proto = sk->sk_protocol, - .uli_u = { .ports = - { .sport =dccp_hdr (skb)->dccph_dport, - .dport =dccp_hdr (skb)->dccph_sport } - } + .fl_ip_sport =dccp_hdr (skb)->dccph_dport, + .fl_ip_dport =dccp_hdr (skb)->dccph_sport };security_skb_classify_flow (skb, &fl);
net/decnet/dn_route.c +9 -13
@@ -271,10 +271,10 @@ static void dn_dst_link_failure(struct sk_buff *skb)static inline int compare_keys (struct flowi *fl1,struct flowi *fl2) { -return ((fl1->nl_u.dn_u.daddr ^ fl2->nl_u.dn_u.daddr) | - (fl1->nl_u.dn_u.saddr ^ fl2->nl_u.dn_u.saddr) | +return ((fl1->fld_dst ^ fl2->fld_dst) | + (fl1->fld_src ^ fl2->fld_src) | (fl1->mark ^ fl2->mark) | - (fl1->nl_u.dn_u.scope ^ fl2->nl_u.dn_u.scope) | + (fl1->fld_scope ^ fl2->fld_scope) | (fl1->oif ^ fl2->oif) | (fl1->iif ^ fl2->iif)) ==0 ; }
@@ -882,11 +882,9 @@ static inline __le16 dn_fib_rules_map_destination(__le16 daddr, struct dn_fib_restatic int dn_route_output_slow (struct dst_entry **pprt,const struct flowi *oldflp,int try_hard) { -struct flowi fl = { .nl_u = { .dn_u = - { .daddr = oldflp->fld_dst, - .saddr = oldflp->fld_src, - .scope =RT_SCOPE_UNIVERSE , - } }, +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 };
@@ -1230,11 +1228,9 @@ static int dn_route_input_slow(struct sk_buff *skb)int flags =0 ;__le16 gateway =0 ;__le16 local_src =0 ; -struct flowi fl = { .nl_u = { .dn_u = - { .daddr = cb->dst, - .saddr = cb->src, - .scope =RT_SCOPE_UNIVERSE , - } }, +struct flowi fl = { .fld_dst = cb->dst, + .fld_src = cb->src, + .fld_scope =RT_SCOPE_UNIVERSE , .mark = skb->mark, .iif = skb->dev->ifindex };struct dn_fib_res res = { .fi =NULL , .type =RTN_UNREACHABLE };
net/decnet/dn_rules.c +1 -1
@@ -175,7 +175,7 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,unsigned dnet_addr_type (__le16 addr) { -struct flowi fl = { .nl_u = { .dn_u = { .daddr = addr } } }; +struct flowi fl = { .fld_dst = addr };struct dn_fib_res res;unsigned ret =RTN_UNICAST ;struct dn_fib_table *tb =dn_fib_get_table (RT_TABLE_LOCAL ,0 );
net/ipv4/af_inet.c +5 -13
@@ -1148,21 +1148,13 @@ int inet_sk_rebuild_header(struct sock *sk)struct flowi fl = { .oif = sk->sk_bound_dev_if, .mark = sk->sk_mark, - .nl_u = { - .ip4_u = { - .daddr = daddr, - .saddr = inet->inet_saddr, - .tos =RT_CONN_FLAGS (sk), - }, - }, + .fl4_dst = daddr, + .fl4_src = inet->inet_saddr, + .fl4_tos =RT_CONN_FLAGS (sk), .proto = sk->sk_protocol, .flags =inet_sk_flowi_flags (sk), - .uli_u = { - .ports = { - .sport = inet->inet_sport, - .dport = inet->inet_dport, - }, - }, + .fl_ip_sport = inet->inet_sport, + .fl_ip_dport = inet->inet_dport, };security_sk_classify_flow (sk, &fl);
net/ipv4/arp.c +6 -6
@@ -433,8 +433,8 @@ static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)static int arp_filter (__be32 sip,__be32 tip,struct net_device *dev) { -struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, - .saddr = tip } } }; +struct flowi fl = { .fl4_dst = sip, + .fl4_src = tip };struct rtable *rt;int flag =0 ;/*unsigned long now; */
@@ -1061,8 +1061,8 @@ static int arp_req_set(struct net *net, struct arpreq *r,if (r->arp_flags &ATF_PERM ) r->arp_flags |=ATF_COM ;if (dev ==NULL ) { -struct flowi fl = { .nl_u.ip4_u = { .daddr = ip, - .tos =RTO_ONLINK } }; +struct flowi fl = { .fl4_dst = ip, + .fl4_tos =RTO_ONLINK };struct rtable *rt; err =ip_route_output_key (net, &rt, &fl);if (err !=0 )
@@ -1169,8 +1169,8 @@ static int arp_req_delete(struct net *net, struct arpreq *r, ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;if (dev ==NULL ) { -struct flowi fl = { .nl_u.ip4_u = { .daddr = ip, - .tos =RTO_ONLINK } }; +struct flowi fl = { .fl4_dst = ip, + .fl4_tos =RTO_ONLINK };struct rtable *rt; err =ip_route_output_key (net, &rt, &fl);if (err !=0 )
net/ipv4/fib_frontend.c +8 -20
@@ -158,11 +158,7 @@ static void fib_flush(struct net *net)struct net_device *__ip_dev_find (struct net *net,__be32 addr,bool devref) {struct flowi fl = { - .nl_u = { - .ip4_u = { - .daddr = addr - } - }, + .fl4_dst = addr, .flags =FLOWI_FLAG_MATCH_ANY_IIF };struct fib_result res = {0 };
@@ -193,7 +189,7 @@ static inline unsigned __inet_dev_addr_type(struct net *net,const struct net_device *dev, __be32 addr) { - struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; + struct flowi fl = { .fl4_dst = addr };struct fib_result res;unsigned ret =RTN_BROADCAST ;struct fib_table *local_table;
@@ -247,13 +243,9 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, {struct in_device *in_dev;struct flowi fl = { - .nl_u = { - .ip4_u = { - .daddr = src, - .saddr = dst, - .tos = tos - } - }, + .fl4_dst = src, + .fl4_src = dst, + .fl4_tos = tos, .mark = mark, .iif = oif };
@@ -853,13 +845,9 @@ 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, - .nl_u = { - .ip4_u = { - .daddr = frn->fl_addr, - .tos = frn->fl_tos, - .scope = frn->fl_scope - } - } + .fl4_dst = frn->fl_addr, + .fl4_tos = frn->fl_tos, + .fl4_scope = frn->fl_scope, };#ifdef CONFIG_IP_MULTIPLE_TABLES
net/ipv4/fib_semantics.c +2 -6
@@ -563,12 +563,8 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,rcu_read_lock (); {struct flowi fl = { - .nl_u = { - .ip4_u = { - .daddr = nh->nh_gw, - .scope = cfg->fc_scope +1 , - }, - }, + .fl4_dst = nh->nh_gw, + .fl4_scope = cfg->fc_scope +1 , .oif = nh->nh_oif, };
net/ipv4/icmp.c +9 -19
@@ -386,10 +386,9 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) daddr = icmp_param->replyopts.faddr; } { -struct flowi fl = { .nl_u = { .ip4_u = - { .daddr = daddr, - .saddr = rt->rt_spec_dst, - .tos =RT_TOS (ip_hdr (skb)->tos) } }, +struct flowi fl = { .fl4_dst= daddr, + .fl4_src = rt->rt_spec_dst, + .fl4_tos =RT_TOS (ip_hdr (skb)->tos), .proto =IPPROTO_ICMP };security_skb_classify_flow (skb, &fl);if (ip_route_output_key (net, &rt, &fl))
@@ -542,22 +541,13 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) {struct flowi fl = { - .nl_u = { - .ip4_u = { - .daddr = icmp_param.replyopts.srr ? - icmp_param.replyopts.faddr : - iph->saddr, - .saddr = saddr, - .tos =RT_TOS (tos) - } - }, + .fl4_dst = icmp_param.replyopts.srr ? + icmp_param.replyopts.faddr : iph->saddr, + .fl4_src = saddr, + .fl4_tos =RT_TOS (tos), .proto =IPPROTO_ICMP , - .uli_u = { - .icmpt = { - .type = type, - .code = code - } - } + .fl_icmp_type = type, + .fl_icmp_code = code, };int err;struct rtable *rt2;
net/ipv4/igmp.c +3 -5
@@ -298,8 +298,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) {struct flowi fl = { .oif = dev->ifindex, - .nl_u = { .ip4_u = { - .daddr =IGMPV3_ALL_MCR } }, + .fl4_dst =IGMPV3_ALL_MCR , .proto =IPPROTO_IGMP };if (ip_route_output_key (net, &rt, &fl)) {kfree_skb (skb);
@@ -644,7 +643,7 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, {struct flowi fl = { .oif = dev->ifindex, - .nl_u = { .ip4_u = { .daddr = dst } }, + .fl4_dst = dst, .proto =IPPROTO_IGMP };if (ip_route_output_key (net, &rt, &fl))return -1 ;
@@ -1421,8 +1420,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev)/* RTNL is locked */ static struct in_device *ip_mc_find_dev (struct net *net,struct ip_mreqn *imr) { -struct flowi fl = { .nl_u = { .ip4_u = - { .daddr = imr->imr_multiaddr.s_addr } } }; +struct flowi fl = { .fl4_dst = imr->imr_multiaddr.s_addr };struct rtable *rt;struct net_device *dev =NULL ;struct in_device *idev =NULL ;
net/ipv4/inet_connection_sock.c +6 -9
@@ -358,17 +358,14 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,struct ip_options *opt =inet_rsk (req)->opt;struct flowi fl = { .oif = sk->sk_bound_dev_if, .mark = sk->sk_mark, - .nl_u = { .ip4_u = - { .daddr = ((opt && opt->srr) ? - opt->faddr : - ireq->rmt_addr), - .saddr = ireq->loc_addr, - .tos =RT_CONN_FLAGS (sk) } }, + .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), - .uli_u = { .ports = - { .sport =inet_sk (sk)->inet_sport, - .dport = ireq->rmt_port } } }; + .fl_ip_sport =inet_sk (sk)->inet_sport, + .fl_ip_dport = ireq->rmt_port };struct net *net =sock_net (sk);security_req_classify_flow (req, &fl);
net/ipv4/ip_gre.c +9 -21
@@ -772,13 +772,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev {struct flowi fl = { .oif = tunnel->parms.link, - .nl_u = { - .ip4_u = { - .daddr = dst, - .saddr = tiph->saddr, - .tos =RT_TOS (tos) - } - }, + .fl4_dst = dst, + .fl4_src = tiph->saddr, + .fl4_tos =RT_TOS (tos), .proto =IPPROTO_GRE } ;
@@ -951,13 +947,9 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)if (iph->daddr) {struct flowi fl = { .oif = tunnel->parms.link, - .nl_u = { - .ip4_u = { - .daddr = iph->daddr, - .saddr = iph->saddr, - .tos =RT_TOS (iph->tos) - } - }, + .fl4_dst = iph->daddr, + .fl4_src = iph->saddr, + .fl4_tos =RT_TOS (iph->tos), .proto =IPPROTO_GRE };struct rtable *rt;
@@ -1216,13 +1208,9 @@ static int ipgre_open(struct net_device *dev)if (ipv4_is_multicast (t->parms.iph.daddr)) {struct flowi fl = { .oif = t->parms.link, - .nl_u = { - .ip4_u = { - .daddr = t->parms.iph.daddr, - .saddr = t->parms.iph.saddr, - .tos =RT_TOS (t->parms.iph.tos) - } - }, + .fl4_dst = t->parms.iph.daddr, + .fl4_src = t->parms.iph.saddr, + .fl4_tos =RT_TOS (t->parms.iph.tos), .proto =IPPROTO_GRE };struct rtable *rt;
net/ipv4/ip_output.c +10 -15
@@ -341,15 +341,13 @@ int ip_queue_xmit(struct sk_buff *skb) {struct flowi fl = { .oif = sk->sk_bound_dev_if, .mark = sk->sk_mark, - .nl_u = { .ip4_u = - { .daddr = daddr, - .saddr = inet->inet_saddr, - .tos =RT_CONN_FLAGS (sk) } }, + .fl4_dst = daddr, + .fl4_src = inet->inet_saddr, + .fl4_tos =RT_CONN_FLAGS (sk), .proto = sk->sk_protocol, .flags =inet_sk_flowi_flags (sk), - .uli_u = { .ports = - { .sport = inet->inet_sport, - .dport = inet->inet_dport } } }; + .fl_ip_sport = inet->inet_sport, + .fl_ip_dport = inet->inet_dport };/* If this fails, retransmit mechanism of transport layer will * keep trying until route appears or the connection times
@@ -1404,14 +1402,11 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar {struct flowi fl = { .oif = arg->bound_dev_if, - .nl_u = { .ip4_u = - { .daddr = daddr, - .saddr = rt->rt_spec_dst, - .tos =RT_TOS (ip_hdr (skb)->tos) } }, -/* Not quite clean, but right. */ - .uli_u = { .ports = - { .sport =tcp_hdr (skb)->dest, - .dport =tcp_hdr (skb)->source } }, + .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) };security_skb_classify_flow (skb, &fl);
net/ipv4/ipip.c +6 -14
@@ -463,13 +463,9 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) {struct flowi fl = { .oif = tunnel->parms.link, - .nl_u = { - .ip4_u = { - .daddr = dst, - .saddr = tiph->saddr, - .tos =RT_TOS (tos) - } - }, + .fl4_dst = dst, + .fl4_src= tiph->saddr, + .fl4_tos =RT_TOS (tos), .proto =IPPROTO_IPIP };
@@ -589,13 +585,9 @@ static void ipip_tunnel_bind_dev(struct net_device *dev)if (iph->daddr) {struct flowi fl = { .oif = tunnel->parms.link, - .nl_u = { - .ip4_u = { - .daddr = iph->daddr, - .saddr = iph->saddr, - .tos =RT_TOS (iph->tos) - } - }, + .fl4_dst = iph->daddr, + .fl4_src = iph->saddr, + .fl4_tos =RT_TOS (iph->tos), .proto =IPPROTO_IPIP };struct rtable *rt;
net/ipv4/ipmr.c +5 -13
@@ -1537,13 +1537,9 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt,if (vif->flags &VIFF_TUNNEL ) {struct flowi fl = { .oif = vif->link, - .nl_u = { - .ip4_u = { - .daddr = vif->remote, - .saddr = vif->local, - .tos =RT_TOS (iph->tos) - } - }, + .fl4_dst = vif->remote, + .fl4_src = vif->local, + .fl4_tos =RT_TOS (iph->tos), .proto =IPPROTO_IPIP };
@@ -1553,12 +1549,8 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt, }else {struct flowi fl = { .oif = vif->link, - .nl_u = { - .ip4_u = { - .daddr = iph->daddr, - .tos =RT_TOS (iph->tos) - } - }, + .fl4_dst = iph->daddr, + .fl4_tos =RT_TOS (iph->tos), .proto =IPPROTO_IPIP };
net/ipv4/netfilter.c +4 -4
@@ -31,10 +31,10 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)* packets with foreign saddr to appear on the NF_INET_LOCAL_OUT hook. */ if (addr_type ==RTN_LOCAL ) { - fl.nl_u.ip4_u.daddr = iph->daddr; + fl.fl4_dst = iph->daddr;if (type ==RTN_LOCAL ) - fl.nl_u.ip4_u.saddr = iph->saddr; - fl.nl_u.ip4_u.tos =RT_TOS (iph->tos); + fl.fl4_src = iph->saddr; + fl.fl4_tos =RT_TOS (iph->tos); fl.oif = skb->sk ? skb->sk->sk_bound_dev_if :0 ; fl.mark = skb->mark; fl.flags = skb->sk ?inet_sk_flowi_flags (skb->sk) :0 ;
@@ -47,7 +47,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) }else {/* non-local src, find valid iif to satisfy * rp-filter when calling ip_route_input. */ - fl.nl_u.ip4_u.daddr = iph->saddr; + fl.fl4_dst = iph->saddr;if (ip_route_output_key (net, &rt, &fl) !=0 )return -1 ;
net/ipv4/raw.c +3 -4
@@ -549,10 +549,9 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, {struct flowi fl = { .oif = ipc.oif, .mark = sk->sk_mark, - .nl_u = { .ip4_u = - { .daddr = daddr, - .saddr = saddr, - .tos = tos } }, + .fl4_dst = daddr, + .fl4_src = saddr, + .fl4_tos = tos, .proto = inet->hdrincl ?IPPROTO_RAW : sk->sk_protocol, };
net/ipv4/route.c +17 -26
73 lines not on this page · raw message
net/ipv4/syncookies.c +6 -9
@@ -346,17 +346,14 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,*/ {struct flowi fl = { .mark = sk->sk_mark, - .nl_u = { .ip4_u = - { .daddr = ((opt && opt->srr) ? - opt->faddr : - ireq->rmt_addr), - .saddr = ireq->loc_addr, - .tos =RT_CONN_FLAGS (sk) } }, + .fl4_dst = ((opt && opt->srr) ? + opt->faddr : ireq->rmt_addr), + .fl4_src = ireq->loc_addr, + .fl4_tos =RT_CONN_FLAGS (sk), .proto =IPPROTO_TCP , .flags =inet_sk_flowi_flags (sk), - .uli_u = { .ports = - { .sport = th->dest, - .dport = th->source } } }; + .fl_ip_sport = th->dest, + .fl_ip_dport = th->source };security_req_classify_flow (req, &fl);if (ip_route_output_key (sock_net (sk), &rt, &fl)) {reqsk_free (req);
net/ipv4/udp.c +5 -7
@@ -890,15 +890,13 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,if (rt ==NULL ) {struct flowi fl = { .oif = ipc.oif, .mark = sk->sk_mark, - .nl_u = { .ip4_u = - { .daddr = faddr, - .saddr = saddr, - .tos = tos } }, + .fl4_dst = faddr, + .fl4_src = saddr, + .fl4_tos = tos, .proto = sk->sk_protocol, .flags =inet_sk_flowi_flags (sk), - .uli_u = { .ports = - { .sport = inet->inet_sport, - .dport = dport } } }; + .fl_ip_sport = inet->inet_sport, + .fl_ip_dport = dport };struct net *net =sock_net (sk);security_sk_classify_flow (sk, &fl);
net/ipv4/xfrm4_policy.c +2 -6
@@ -22,12 +22,8 @@ static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, xfrm_address_t *daddr) {struct flowi fl = { - .nl_u = { - .ip4_u = { - .tos = tos, - .daddr = daddr->a4, - }, - }, + .fl4_dst = daddr->a4, + .fl4_tos = tos, };struct dst_entry *dst;struct rtable *rt;
net/ipv6/ip6mr.c +1 -3
@@ -1843,9 +1843,7 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt, fl = (struct flowi ) { .oif = vif->link, - .nl_u = { .ip6_u = - { .daddr = ipv6h->daddr, } - } + .fl6_dst = ipv6h->daddr, }; dst =ip6_route_output (net,NULL , &fl);
net/ipv6/netfilter.c +2 -4
@@ -18,10 +18,8 @@ int ip6_route_me_harder(struct sk_buff *skb)struct flowi fl = { .oif = skb->sk ? skb->sk->sk_bound_dev_if :0 , .mark = skb->mark, - .nl_u = - { .ip6_u = - { .daddr = iph->daddr, - .saddr = iph->saddr, } }, + .fl6_dst = iph->daddr, + .fl6_src = iph->saddr, }; dst =ip6_route_output (net, skb->sk, &fl);
net/ipv6/route.c +6 -18
@@ -558,11 +558,7 @@ struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr, {struct flowi fl = { .oif = oif, - .nl_u = { - .ip6_u = { - .daddr = *daddr, - }, - }, + .fl6_dst = *daddr, };struct dst_entry *dst;int flags = strict ?RT6_LOOKUP_F_IFACE :0 ;
@@ -778,13 +774,9 @@ void ip6_route_input(struct sk_buff *skb)int flags =RT6_LOOKUP_F_HAS_SADDR ;struct flowi fl = { .iif = skb->dev->ifindex, - .nl_u = { - .ip6_u = { - .daddr = iph->daddr, - .saddr = iph->saddr, - .flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK , - }, - }, + .fl6_dst = iph->daddr, + .fl6_src = iph->saddr, + .fl6_flowlabel = (* (__be32 *) iph)&IPV6_FLOWINFO_MASK , .mark = skb->mark, .proto = iph->nexthdr, };
@@ -1463,12 +1455,8 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,struct ip6rd_flowi rdfl = { .fl = { .oif = dev->ifindex, - .nl_u = { - .ip6_u = { - .daddr = *dest, - .saddr = *src, - }, - }, + .fl6_dst = *dest, + .fl6_src = *src, }, };
net/ipv6/sit.c +6 -8
@@ -730,10 +730,9 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, } { -struct flowi fl = { .nl_u = { .ip4_u = - { .daddr = dst, - .saddr = tiph->saddr, - .tos =RT_TOS (tos) } }, +struct flowi fl = { .fl4_dst = dst, + .fl4_src = tiph->saddr, + .fl4_tos =RT_TOS (tos), .oif = tunnel->parms.link, .proto =IPPROTO_IPV6 };if (ip_route_output_key (dev_net (dev), &rt, &fl)) {
@@ -855,10 +854,9 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev) iph = &tunnel->parms.iph;if (iph->daddr) { -struct flowi fl = { .nl_u = { .ip4_u = - { .daddr = iph->daddr, - .saddr = iph->saddr, - .tos =RT_TOS (iph->tos) } }, +struct flowi fl = { .fl4_dst = iph->daddr, + .fl4_src = iph->saddr, + .fl4_tos =RT_TOS (iph->tos), .oif = tunnel->parms.link, .proto =IPPROTO_IPV6 };struct rtable *rt;
net/l2tp/l2tp_ip.c +5 -7
@@ -476,15 +476,13 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m {struct flowi fl = { .oif = sk->sk_bound_dev_if, - .nl_u = { .ip4_u = { - .daddr = daddr, - .saddr = inet->inet_saddr, - .tos =RT_CONN_FLAGS (sk) } }, + .fl4_dst = daddr, + .fl4_src = inet->inet_saddr, + .fl4_tos =RT_CONN_FLAGS (sk), .proto = sk->sk_protocol, .flags =inet_sk_flowi_flags (sk), - .uli_u = { .ports = { - .sport = inet->inet_sport, - .dport = inet->inet_dport } } }; + .fl_ip_sport = inet->inet_sport, + .fl_ip_dport = inet->inet_dport };/* If this fails, retransmit mechanism of transport layer will * keep trying until route appears or the connection times
net/netfilter/ipvs/ip_vs_ctl.c +2 -4
@@ -110,10 +110,8 @@ static int __ip_vs_addr_is_local_v6(const struct in6_addr *addr)struct rt6_info *rt;struct flowi fl = { .oif =0 , - .nl_u = { - .ip6_u = { - .daddr = *addr, - .saddr = { .s6_addr32 = {0 ,0 ,0 ,0 } }, } }, + .fl6_dst = *addr, + .fl6_src = { .s6_addr32 = {0 ,0 ,0 ,0 } }, }; rt = (struct rt6_info *)ip6_route_output (&init_net,NULL , &fl);
net/netfilter/ipvs/ip_vs_xmit.c +8 -26
@@ -96,12 +96,8 @@ __ip_vs_get_out_rt(struct sk_buff *skb, struct ip_vs_dest *dest,if (!(rt = (struct rtable *)__ip_vs_dst_check (dest, rtos))) {struct flowi fl = { - .oif =0 , - .nl_u = { - .ip4_u = { - .daddr = dest->addr.ip, - .saddr =0 , - .tos = rtos, } }, + .fl4_dst = dest->addr.ip, + .fl4_tos = rtos, };if (ip_route_output_key (net, &rt, &fl)) {
@@ -118,12 +114,8 @@ __ip_vs_get_out_rt(struct sk_buff *skb, struct ip_vs_dest *dest,spin_unlock (&dest->dst_lock); }else {struct flowi fl = { - .oif =0 , - .nl_u = { - .ip4_u = { - .daddr = daddr, - .saddr =0 , - .tos = rtos, } }, + .fl4_dst = daddr, + .fl4_tos = rtos, };if (ip_route_output_key (net, &rt, &fl)) {
@@ -178,14 +170,9 @@ __ip_vs_reroute_locally(struct sk_buff *skb)refdst_drop (orefdst); }else {struct flowi fl = { - .oif =0 , - .nl_u = { - .ip4_u = { - .daddr = iph->daddr, - .saddr = iph->saddr, - .tos =RT_TOS (iph->tos), - } - }, + .fl4_dst = iph->daddr, + .fl4_src = iph->saddr, + .fl4_tos =RT_TOS (iph->tos), .mark = skb->mark, };struct rtable *rt;
@@ -216,12 +203,7 @@ __ip_vs_route_output_v6(struct net *net, struct in6_addr *daddr, {struct dst_entry *dst;struct flowi fl = { - .oif =0 , - .nl_u = { - .ip6_u = { - .daddr = *daddr, - }, - }, + .fl6_dst = *daddr, }; dst =ip6_route_output (net,NULL , &fl);
net/netfilter/xt_TEE.c +6 -6
@@ -70,9 +70,9 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info)return false; fl.oif = info->priv->oif; } - fl.nl_u.ip4_u.daddr = info->gw.ip; - fl.nl_u.ip4_u.tos =RT_TOS (iph->tos); - fl.nl_u.ip4_u.scope =RT_SCOPE_UNIVERSE ; + fl.fl4_dst = info->gw.ip; + fl.fl4_tos =RT_TOS (iph->tos); + fl.fl4_scope =RT_SCOPE_UNIVERSE ;if (ip_route_output_key (net, &rt, &fl) !=0 )return false;
@@ -150,9 +150,9 @@ tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info)return false; fl.oif = info->priv->oif; } - fl.nl_u.ip6_u.daddr = info->gw.in6; - fl.nl_u.ip6_u.flowlabel = ((iph->flow_lbl[0 ] &0xF ) <<16 ) | - (iph->flow_lbl[1 ] <<8 ) | iph->flow_lbl[2 ]; + fl.fl6_dst = info->gw.in6; + fl.fl6_flowlabel = ((iph->flow_lbl[0 ] &0xF ) <<16 ) | + (iph->flow_lbl[1 ] <<8 ) | iph->flow_lbl[2 ]; dst =ip6_route_output (net,NULL , &fl);if (dst ==NULL )return false;
net/rxrpc/ar-peer.c +5 -5
@@ -47,12 +47,12 @@ static void rxrpc_assess_MTU_size(struct rxrpc_peer *peer)case AF_INET : fl.oif =0 ; fl.proto =IPPROTO_UDP , - fl.nl_u.ip4_u.saddr =0 ; - fl.nl_u.ip4_u.daddr = peer->srx.transport.sin.sin_addr.s_addr; - fl.nl_u.ip4_u.tos =0 ; + fl.fl4_dst = peer->srx.transport.sin.sin_addr.s_addr; + fl.fl4_src =0 ; + fl.fl4_tos =0 ;/* assume AFS.CM talking to AFS.FS */ - fl.uli_u.ports.sport =htons (7001 ); - fl.uli_u.ports.dport =htons (7000 ); + fl.fl_ip_sport =htons (7001 ); + fl.fl_ip_dport =htons (7000 );break ;default :BUG ();
Quoted 10 lines · Changli Gao
Use the macros defined for the members of flowi to clean the code up.
net/bridge/br_netfilter.c +0
-0@@ -412,13 +412,8 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)if (dnat_took_place (skb)) {if ((err =ip_route_input (skb, iph->daddr, iph->saddr, iph->tos, dev))) { struct flowi fl = {
net/bridge/br_netfilter.c static int br_nf_pre_routing_finish(struct sk_buff *skb) · line 417
Quoted 10 lines
net/bridge/br_netfilter.c +2
-7- .nl_u = { - .ip4_u = { - .daddr = iph->daddr, - .saddr = 0, - .tos = RT_TOS(iph->tos) }, - }, - .proto = 0, + .fl4_dst = iph->daddr, + .fl4_tos = RT_TOS(iph->tos), };
Are these actually equivalent? You dropped two assignments to zero. I always thought things on the stack weren't.
Thanks,
-Brian
Quoted 16 lines · Brian Haley
Quoted 15 lines · Changli Gao
Use the macros defined for the members of flowi to clean the code up.
net/bridge/br_netfilter.c +0
-5@@ -412,13 +412,8 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)if (dnat_took_place (skb)) {if ((err =ip_route_input (skb, iph->daddr, iph->saddr, iph->tos, dev))) { struct flowi fl = { - .nl_u = { - .ip4_u = { - .daddr = iph->daddr, - .saddr =0 , - .tos =RT_TOS (iph->tos) },
Quoted 8 lines
net/bridge/br_netfilter.c static int br_nf_pre_routing_finish(struct sk_buff *skb) · line 417
Quoted 5 lines
net/bridge/br_netfilter.c +2
-2- }, - .proto = 0, + .fl4_dst = iph->daddr, + .fl4_tos = RT_TOS(iph->tos), };Are these actually equivalent? You dropped two assignments to zero. I always thought things on the stack weren't.
Same question on lkml few hours ago. I think gcc does the assignement to zero, even on automatic variables (at least done on x86), but could not find a doc on it.
Quoted 3 lines · Eric Dumazet
Same question on lkml few hours ago. I think gcc does the assignement to zero, even on automatic variables (at least done on x86), but could not find a doc on it.
Oh well, for sure fields that are not mentioned are set to 0, thanks to C99.
My question on lkml was about padding holes (security related)
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Mon, 15 Nov 2010 22:38:46 +0100
Quoted 26 lines · Brian Haley
Quoted 16 lines · Changli Gao
Quoted 15 lines
Use the macros defined for the members of flowi to clean the code up.
net/bridge/br_netfilter.c +0
-5@@ -412,13 +412,8 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)if (dnat_took_place (skb)) {if ((err =ip_route_input (skb, iph->daddr, iph->saddr, iph->tos, dev))) { struct flowi fl = { - .nl_u = { - .ip4_u = { - .daddr = iph->daddr, - .saddr =0 , - .tos =RT_TOS (iph->tos) },Quoted 8 lines
net/bridge/br_netfilter.c static int br_nf_pre_routing_finish(struct sk_buff *skb) · line 417
Quoted 5 lines
net/bridge/br_netfilter.c +2
-2- }, - .proto = 0, + .fl4_dst = iph->daddr, + .fl4_tos = RT_TOS(iph->tos), };Are these actually equivalent? You dropped two assignments to zero. I always thought things on the stack weren't.
Quoted 3 lines
Same question on lkml few hours ago. I think gcc does the assignement to zero, even on automatic variables (at least done on x86), but could not find a doc on it.
It always has, it always will. "type var = { };" always zeros out the structure.
From: Changli Gao <[email protected]>
Date: Sat, 13 Nov 2010 12:43:55 +0800
Quoted 3 lines
Use the macros defined for the members of flowi to clean the code up.
Signed-off-by Changli Gao <[email protected]>
Applied, thank you.