Commit 1d28f42c authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parent ca116922
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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)
+2 −2
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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);
Loading