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

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

ipv6: tcp: fix TCLASS value in ACK messages sent from TIME_WAIT



commit 66b13d99 (ipv4: tcp: fix TOS value in ACK messages sent from
TIME_WAIT) fixed IPv4 only.

This part is for the IPv6 side, adding a tclass param to ip6_xmit()

We alias tw_tclass and tw_tos, if socket family is INET6.

[ if sockets is ipv4-mapped, only IP_TOS socket option is used to fill
TOS field, TCLASS is not taken into account ]

Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 138c4ae9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -134,6 +134,7 @@ struct inet_timewait_sock {
	struct inet_bind_bucket	*tw_tb;
	struct inet_bind_bucket	*tw_tb;
	struct hlist_node	tw_death_node;
	struct hlist_node	tw_death_node;
};
};
#define tw_tclass tw_tos


static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
				      struct hlist_nulls_head *list)
				      struct hlist_nulls_head *list)
+2 −1
Original line number Original line Diff line number Diff line
@@ -486,7 +486,8 @@ extern int ip6_rcv_finish(struct sk_buff *skb);
extern int			ip6_xmit(struct sock *sk,
extern int			ip6_xmit(struct sock *sk,
					 struct sk_buff *skb,
					 struct sk_buff *skb,
					 struct flowi6 *fl6,
					 struct flowi6 *fl6,
					 struct ipv6_txoptions *opt);
					 struct ipv6_txoptions *opt,
					 int tclass);


extern int			ip6_nd_hdr(struct sock *sk,
extern int			ip6_nd_hdr(struct sock *sk,
					   struct sk_buff *skb,
					   struct sk_buff *skb,
+2 −2
Original line number Original line Diff line number Diff line
@@ -271,7 +271,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
							 &ireq6->loc_addr,
							 &ireq6->loc_addr,
							 &ireq6->rmt_addr);
							 &ireq6->rmt_addr);
		ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
		ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
		err = ip6_xmit(sk, skb, &fl6, opt);
		err = ip6_xmit(sk, skb, &fl6, opt, np->tclass);
		err = net_xmit_eval(err);
		err = net_xmit_eval(err);
	}
	}


@@ -326,7 +326,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
	dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false);
	dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false);
	if (!IS_ERR(dst)) {
	if (!IS_ERR(dst)) {
		skb_dst_set(skb, dst);
		skb_dst_set(skb, dst);
		ip6_xmit(ctl_sk, skb, &fl6, NULL);
		ip6_xmit(ctl_sk, skb, &fl6, NULL, 0);
		DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
		DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
		DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
		DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
		return;
		return;
+1 −0
Original line number Original line Diff line number Diff line
@@ -345,6 +345,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
			tw6 = inet6_twsk((struct sock *)tw);
			tw6 = inet6_twsk((struct sock *)tw);
			ipv6_addr_copy(&tw6->tw_v6_daddr, &np->daddr);
			ipv6_addr_copy(&tw6->tw_v6_daddr, &np->daddr);
			ipv6_addr_copy(&tw6->tw_v6_rcv_saddr, &np->rcv_saddr);
			ipv6_addr_copy(&tw6->tw_v6_rcv_saddr, &np->rcv_saddr);
			tw->tw_tclass = np->tclass;
			tw->tw_ipv6only = np->ipv6only;
			tw->tw_ipv6only = np->ipv6only;
		}
		}
#endif
#endif
+1 −1
Original line number Original line Diff line number Diff line
@@ -248,7 +248,7 @@ int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused)
	/* Restore final destination back after routing done */
	/* Restore final destination back after routing done */
	ipv6_addr_copy(&fl6.daddr, &np->daddr);
	ipv6_addr_copy(&fl6.daddr, &np->daddr);


	res = ip6_xmit(sk, skb, &fl6, np->opt);
	res = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass);
	rcu_read_unlock();
	rcu_read_unlock();
	return res;
	return res;
}
}
Loading