Commit 1086ca7c authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

ipv6: lockless IPV6_DONTFRAG implementation



Move np->dontfrag flag to inet->inet_flags to fix data-races.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5121516b
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -252,7 +252,6 @@ struct ipv6_pinfo {
						 * 010: prefer public address
						 * 100: prefer care-of address
						 */
				dontfrag:1,
				rtalert_isolate:1;
	__u8			min_hopcount;
	__u8			tclass;
+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ enum {
	INET_FLAGS_MC6_ALL	= 22,
	INET_FLAGS_AUTOFLOWLABEL_SET = 23,
	INET_FLAGS_AUTOFLOWLABEL = 24,
	INET_FLAGS_DONTFRAG	= 25,
};

/* cmsg flags for inet */
+3 −3
Original line number Diff line number Diff line
@@ -373,12 +373,12 @@ static inline void ipcm6_init(struct ipcm6_cookie *ipc6)
}

static inline void ipcm6_init_sk(struct ipcm6_cookie *ipc6,
				 const struct ipv6_pinfo *np)
				 const struct sock *sk)
{
	*ipc6 = (struct ipcm6_cookie) {
		.hlimit = -1,
		.tclass = np->tclass,
		.dontfrag = np->dontfrag,
		.tclass = inet6_sk(sk)->tclass,
		.dontfrag = inet6_test_bit(DONTFRAG, sk),
	};
}

+1 −1
Original line number Diff line number Diff line
@@ -2166,7 +2166,7 @@ static inline bool xfrm6_local_dontfrag(const struct sock *sk)

	proto = sk->sk_protocol;
	if (proto == IPPROTO_UDP || proto == IPPROTO_RAW)
		return inet6_sk(sk)->dontfrag;
		return inet6_test_bit(DONTFRAG, sk);

	return false;
}
+2 −2
Original line number Diff line number Diff line
@@ -588,7 +588,7 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
	else if (!fl6.flowi6_oif)
		fl6.flowi6_oif = np->ucast_oif;

	ipcm6_init_sk(&ipc6, np);
	ipcm6_init_sk(&ipc6, sk);
	ipc6.sockc.mark = mark;
	fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);

@@ -791,7 +791,7 @@ static enum skb_drop_reason icmpv6_echo_reply(struct sk_buff *skb)
	msg.offset = 0;
	msg.type = type;

	ipcm6_init_sk(&ipc6, np);
	ipcm6_init_sk(&ipc6, sk);
	ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);
	ipc6.tclass = ipv6_get_dsfield(ipv6_hdr(skb));
	ipc6.sockc.mark = mark;
Loading