Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5811662b authored by Changli Gao's avatar Changli Gao Committed by David S. Miller
Browse files

net: use the macros defined for the members of flowi



Use the macros defined for the members of flowi to clean the code up.

Signed-off-by: default avatarChangli Gao <xiaosuo@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dd68ad22
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -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);

+2 −1
Original line number Diff line number Diff line
@@ -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) {
+2 −7
Original line number Diff line number Diff line
@@ -413,13 +413,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);

+5 −8
Original line number Diff line number Diff line
@@ -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);
+9 −13
Original line number Diff line number Diff line
@@ -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_re

static 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 };
Loading