Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: Constify the sk parameter of several helper functions.

icmpv6_flow_init(), ip6_datagram_flow_key_init() and ip6_mc_hdr() don't
need to modify their sk argument. Make that explicit using const.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Guillaume Nault and committed by
David S. Miller
5bc67a85 8d6eba33

+13 -18
+4 -6
include/linux/icmpv6.h
··· 85 85 86 86 struct flowi6; 87 87 struct in6_addr; 88 - extern void icmpv6_flow_init(struct sock *sk, 89 - struct flowi6 *fl6, 90 - u8 type, 91 - const struct in6_addr *saddr, 92 - const struct in6_addr *daddr, 93 - int oif); 88 + 89 + void icmpv6_flow_init(const struct sock *sk, struct flowi6 *fl6, u8 type, 90 + const struct in6_addr *saddr, 91 + const struct in6_addr *daddr, int oif); 94 92 95 93 static inline void icmpv6_param_prob(struct sk_buff *skb, u8 code, int pos) 96 94 {
+4 -3
net/ipv6/datagram.c
··· 38 38 return ipv6_addr_v4mapped(a) && (a->s6_addr32[3] == 0); 39 39 } 40 40 41 - static void ip6_datagram_flow_key_init(struct flowi6 *fl6, struct sock *sk) 41 + static void ip6_datagram_flow_key_init(struct flowi6 *fl6, 42 + const struct sock *sk) 42 43 { 43 - struct inet_sock *inet = inet_sk(sk); 44 - struct ipv6_pinfo *np = inet6_sk(sk); 44 + const struct inet_sock *inet = inet_sk(sk); 45 + const struct ipv6_pinfo *np = inet6_sk(sk); 45 46 int oif = sk->sk_bound_dev_if; 46 47 47 48 memset(fl6, 0, sizeof(*fl6));
+2 -4
net/ipv6/icmp.c
··· 1034 1034 return 0; 1035 1035 } 1036 1036 1037 - void icmpv6_flow_init(struct sock *sk, struct flowi6 *fl6, 1038 - u8 type, 1037 + void icmpv6_flow_init(const struct sock *sk, struct flowi6 *fl6, u8 type, 1039 1038 const struct in6_addr *saddr, 1040 - const struct in6_addr *daddr, 1041 - int oif) 1039 + const struct in6_addr *daddr, int oif) 1042 1040 { 1043 1041 memset(fl6, 0, sizeof(*fl6)); 1044 1042 fl6->saddr = *saddr;
+3 -5
net/ipv6/mcast.c
··· 1699 1699 return scount; 1700 1700 } 1701 1701 1702 - static void ip6_mc_hdr(struct sock *sk, struct sk_buff *skb, 1703 - struct net_device *dev, 1704 - const struct in6_addr *saddr, 1705 - const struct in6_addr *daddr, 1706 - int proto, int len) 1702 + static void ip6_mc_hdr(const struct sock *sk, struct sk_buff *skb, 1703 + struct net_device *dev, const struct in6_addr *saddr, 1704 + const struct in6_addr *daddr, int proto, int len) 1707 1705 { 1708 1706 struct ipv6hdr *hdr; 1709 1707