Commit 7b58e63e authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski
Browse files

inet: udp{4|6}_lib_lookup_skb() skb argument is const



The skb is needed only to fetch the keys for the lookup.

Both functions are used from GRO stack, we do not want
accidental modification of the skb.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarAlexander Lobakin <alobakin@pm.me>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d6bb2d1e
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -164,7 +164,7 @@ static inline void udp_csum_pull_header(struct sk_buff *skb)
	UDP_SKB_CB(skb)->cscov -= sizeof(struct udphdr);
	UDP_SKB_CB(skb)->cscov -= sizeof(struct udphdr);
}
}


typedef struct sock *(*udp_lookup_t)(struct sk_buff *skb, __be16 sport,
typedef struct sock *(*udp_lookup_t)(const struct sk_buff *skb, __be16 sport,
				     __be16 dport);
				     __be16 dport);


INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *,
INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *,
@@ -313,7 +313,7 @@ struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
			       __be32 daddr, __be16 dport, int dif, int sdif,
			       __be32 daddr, __be16 dport, int dif, int sdif,
			       struct udp_table *tbl, struct sk_buff *skb);
			       struct udp_table *tbl, struct sk_buff *skb);
struct sock *udp4_lib_lookup_skb(struct sk_buff *skb,
struct sock *udp4_lib_lookup_skb(const struct sk_buff *skb,
				 __be16 sport, __be16 dport);
				 __be16 sport, __be16 dport);
struct sock *udp6_lib_lookup(struct net *net,
struct sock *udp6_lib_lookup(struct net *net,
			     const struct in6_addr *saddr, __be16 sport,
			     const struct in6_addr *saddr, __be16 sport,
@@ -324,7 +324,7 @@ struct sock *__udp6_lib_lookup(struct net *net,
			       const struct in6_addr *daddr, __be16 dport,
			       const struct in6_addr *daddr, __be16 dport,
			       int dif, int sdif, struct udp_table *tbl,
			       int dif, int sdif, struct udp_table *tbl,
			       struct sk_buff *skb);
			       struct sk_buff *skb);
struct sock *udp6_lib_lookup_skb(struct sk_buff *skb,
struct sock *udp6_lib_lookup_skb(const struct sk_buff *skb,
				 __be16 sport, __be16 dport);
				 __be16 sport, __be16 dport);


/* UDP uses skb->dev_scratch to cache as much information as possible and avoid
/* UDP uses skb->dev_scratch to cache as much information as possible and avoid
+1 −1
Original line number Original line Diff line number Diff line
@@ -541,7 +541,7 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,
				 inet_sdif(skb), udptable, skb);
				 inet_sdif(skb), udptable, skb);
}
}


struct sock *udp4_lib_lookup_skb(struct sk_buff *skb,
struct sock *udp4_lib_lookup_skb(const struct sk_buff *skb,
				 __be16 sport, __be16 dport)
				 __be16 sport, __be16 dport)
{
{
	const struct iphdr *iph = ip_hdr(skb);
	const struct iphdr *iph = ip_hdr(skb);
+1 −1
Original line number Original line Diff line number Diff line
@@ -276,7 +276,7 @@ static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb,
				 inet6_sdif(skb), udptable, skb);
				 inet6_sdif(skb), udptable, skb);
}
}


struct sock *udp6_lib_lookup_skb(struct sk_buff *skb,
struct sock *udp6_lib_lookup_skb(const struct sk_buff *skb,
				 __be16 sport, __be16 dport)
				 __be16 sport, __be16 dport)
{
{
	const struct ipv6hdr *iph = ipv6_hdr(skb);
	const struct ipv6hdr *iph = ipv6_hdr(skb);