Skip to content

Commit 39d3628

Browse files
idoschkuba-moo
authored andcommitted
ipv4: Unmask upper DSCP bits in fib_compute_spec_dst()
As explained in commit 35ebf65 ("ipv4: Create and use fib_compute_spec_dst() helper."), the function is used - for example - to determine the source address for an ICMP reply. If we are responding to a multicast or broadcast packet, the source address is set to the source address that we would use if we were to send a packet to the unicast source of the original packet. This address is determined by performing a FIB lookup and using the preferred source address of the resulting route. Unmask the upper DSCP bits of the DS field of the packet that triggered the reply so that in the future the FIB lookup could be performed according to the full DSCP value. No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes. Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Guillaume Nault <[email protected]> Acked-by: Florian Westphal <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2bc9778 commit 39d3628

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/fib_frontend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb)
293293
.flowi4_iif = LOOPBACK_IFINDEX,
294294
.flowi4_l3mdev = l3mdev_master_ifindex_rcu(dev),
295295
.daddr = ip_hdr(skb)->saddr,
296-
.flowi4_tos = ip_hdr(skb)->tos & IPTOS_RT_MASK,
296+
.flowi4_tos = ip_hdr(skb)->tos & INET_DSCP_MASK,
297297
.flowi4_scope = scope,
298298
.flowi4_mark = vmark ? skb->mark : 0,
299299
};

0 commit comments

Comments
 (0)