diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-04-22 00:53:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-22 14:04:14 -0400 |
commit | b71d1d426d263b0b6cb5760322efebbfc89d4463 (patch) | |
tree | 226ca7390bd6187ec9139d2ccedd26fd94d8e57a /net/ipv6/route.c | |
parent | 5f8629c526b4f7e529a6d27bbd802c0dc7fcc357 (diff) |
inet: constify ip headers and in6_addr
Add const qualifiers to structs iphdr, ipv6hdr and in6_addr pointers
where possible, to make code intention more obvious.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index af26cc1073cb..852fc28ca818 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -89,12 +89,12 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu); | |||
89 | 89 | ||
90 | #ifdef CONFIG_IPV6_ROUTE_INFO | 90 | #ifdef CONFIG_IPV6_ROUTE_INFO |
91 | static struct rt6_info *rt6_add_route_info(struct net *net, | 91 | static struct rt6_info *rt6_add_route_info(struct net *net, |
92 | struct in6_addr *prefix, int prefixlen, | 92 | const struct in6_addr *prefix, int prefixlen, |
93 | struct in6_addr *gwaddr, int ifindex, | 93 | const struct in6_addr *gwaddr, int ifindex, |
94 | unsigned pref); | 94 | unsigned pref); |
95 | static struct rt6_info *rt6_get_route_info(struct net *net, | 95 | static struct rt6_info *rt6_get_route_info(struct net *net, |
96 | struct in6_addr *prefix, int prefixlen, | 96 | const struct in6_addr *prefix, int prefixlen, |
97 | struct in6_addr *gwaddr, int ifindex); | 97 | const struct in6_addr *gwaddr, int ifindex); |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) | 100 | static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) |
@@ -283,7 +283,7 @@ static __inline__ int rt6_check_expired(const struct rt6_info *rt) | |||
283 | time_after(jiffies, rt->rt6i_expires); | 283 | time_after(jiffies, rt->rt6i_expires); |
284 | } | 284 | } |
285 | 285 | ||
286 | static inline int rt6_need_strict(struct in6_addr *daddr) | 286 | static inline int rt6_need_strict(const struct in6_addr *daddr) |
287 | { | 287 | { |
288 | return ipv6_addr_type(daddr) & | 288 | return ipv6_addr_type(daddr) & |
289 | (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); | 289 | (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); |
@@ -295,7 +295,7 @@ static inline int rt6_need_strict(struct in6_addr *daddr) | |||
295 | 295 | ||
296 | static inline struct rt6_info *rt6_device_match(struct net *net, | 296 | static inline struct rt6_info *rt6_device_match(struct net *net, |
297 | struct rt6_info *rt, | 297 | struct rt6_info *rt, |
298 | struct in6_addr *saddr, | 298 | const struct in6_addr *saddr, |
299 | int oif, | 299 | int oif, |
300 | int flags) | 300 | int flags) |
301 | { | 301 | { |
@@ -507,7 +507,7 @@ static struct rt6_info *rt6_select(struct fib6_node *fn, int oif, int strict) | |||
507 | 507 | ||
508 | #ifdef CONFIG_IPV6_ROUTE_INFO | 508 | #ifdef CONFIG_IPV6_ROUTE_INFO |
509 | int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | 509 | int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, |
510 | struct in6_addr *gwaddr) | 510 | const struct in6_addr *gwaddr) |
511 | { | 511 | { |
512 | struct net *net = dev_net(dev); | 512 | struct net *net = dev_net(dev); |
513 | struct route_info *rinfo = (struct route_info *) opt; | 513 | struct route_info *rinfo = (struct route_info *) opt; |
@@ -670,8 +670,8 @@ int ip6_ins_rt(struct rt6_info *rt) | |||
670 | return __ip6_ins_rt(rt, &info); | 670 | return __ip6_ins_rt(rt, &info); |
671 | } | 671 | } |
672 | 672 | ||
673 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr, | 673 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, const struct in6_addr *daddr, |
674 | struct in6_addr *saddr) | 674 | const struct in6_addr *saddr) |
675 | { | 675 | { |
676 | struct rt6_info *rt; | 676 | struct rt6_info *rt; |
677 | 677 | ||
@@ -739,7 +739,7 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *dad | |||
739 | return rt; | 739 | return rt; |
740 | } | 740 | } |
741 | 741 | ||
742 | static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, struct in6_addr *daddr) | 742 | static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, const struct in6_addr *daddr) |
743 | { | 743 | { |
744 | struct rt6_info *rt = ip6_rt_copy(ort); | 744 | struct rt6_info *rt = ip6_rt_copy(ort); |
745 | if (rt) { | 745 | if (rt) { |
@@ -830,7 +830,7 @@ static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table * | |||
830 | 830 | ||
831 | void ip6_route_input(struct sk_buff *skb) | 831 | void ip6_route_input(struct sk_buff *skb) |
832 | { | 832 | { |
833 | struct ipv6hdr *iph = ipv6_hdr(skb); | 833 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
834 | struct net *net = dev_net(skb->dev); | 834 | struct net *net = dev_net(skb->dev); |
835 | int flags = RT6_LOOKUP_F_HAS_SADDR; | 835 | int flags = RT6_LOOKUP_F_HAS_SADDR; |
836 | struct flowi6 fl6 = { | 836 | struct flowi6 fl6 = { |
@@ -1272,7 +1272,7 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | if (cfg->fc_flags & RTF_GATEWAY) { | 1274 | if (cfg->fc_flags & RTF_GATEWAY) { |
1275 | struct in6_addr *gw_addr; | 1275 | const struct in6_addr *gw_addr; |
1276 | int gwa_type; | 1276 | int gwa_type; |
1277 | 1277 | ||
1278 | gw_addr = &cfg->fc_gateway; | 1278 | gw_addr = &cfg->fc_gateway; |
@@ -1512,9 +1512,9 @@ out: | |||
1512 | return rt; | 1512 | return rt; |
1513 | }; | 1513 | }; |
1514 | 1514 | ||
1515 | static struct rt6_info *ip6_route_redirect(struct in6_addr *dest, | 1515 | static struct rt6_info *ip6_route_redirect(const struct in6_addr *dest, |
1516 | struct in6_addr *src, | 1516 | const struct in6_addr *src, |
1517 | struct in6_addr *gateway, | 1517 | const struct in6_addr *gateway, |
1518 | struct net_device *dev) | 1518 | struct net_device *dev) |
1519 | { | 1519 | { |
1520 | int flags = RT6_LOOKUP_F_HAS_SADDR; | 1520 | int flags = RT6_LOOKUP_F_HAS_SADDR; |
@@ -1536,8 +1536,8 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest, | |||
1536 | flags, __ip6_route_redirect); | 1536 | flags, __ip6_route_redirect); |
1537 | } | 1537 | } |
1538 | 1538 | ||
1539 | void rt6_redirect(struct in6_addr *dest, struct in6_addr *src, | 1539 | void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src, |
1540 | struct in6_addr *saddr, | 1540 | const struct in6_addr *saddr, |
1541 | struct neighbour *neigh, u8 *lladdr, int on_link) | 1541 | struct neighbour *neigh, u8 *lladdr, int on_link) |
1542 | { | 1542 | { |
1543 | struct rt6_info *rt, *nrt = NULL; | 1543 | struct rt6_info *rt, *nrt = NULL; |
@@ -1611,7 +1611,7 @@ out: | |||
1611 | * i.e. Path MTU discovery | 1611 | * i.e. Path MTU discovery |
1612 | */ | 1612 | */ |
1613 | 1613 | ||
1614 | static void rt6_do_pmtu_disc(struct in6_addr *daddr, struct in6_addr *saddr, | 1614 | static void rt6_do_pmtu_disc(const struct in6_addr *daddr, const struct in6_addr *saddr, |
1615 | struct net *net, u32 pmtu, int ifindex) | 1615 | struct net *net, u32 pmtu, int ifindex) |
1616 | { | 1616 | { |
1617 | struct rt6_info *rt, *nrt; | 1617 | struct rt6_info *rt, *nrt; |
@@ -1696,7 +1696,7 @@ out: | |||
1696 | dst_release(&rt->dst); | 1696 | dst_release(&rt->dst); |
1697 | } | 1697 | } |
1698 | 1698 | ||
1699 | void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, | 1699 | void rt6_pmtu_discovery(const struct in6_addr *daddr, const struct in6_addr *saddr, |
1700 | struct net_device *dev, u32 pmtu) | 1700 | struct net_device *dev, u32 pmtu) |
1701 | { | 1701 | { |
1702 | struct net *net = dev_net(dev); | 1702 | struct net *net = dev_net(dev); |
@@ -1756,8 +1756,8 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) | |||
1756 | 1756 | ||
1757 | #ifdef CONFIG_IPV6_ROUTE_INFO | 1757 | #ifdef CONFIG_IPV6_ROUTE_INFO |
1758 | static struct rt6_info *rt6_get_route_info(struct net *net, | 1758 | static struct rt6_info *rt6_get_route_info(struct net *net, |
1759 | struct in6_addr *prefix, int prefixlen, | 1759 | const struct in6_addr *prefix, int prefixlen, |
1760 | struct in6_addr *gwaddr, int ifindex) | 1760 | const struct in6_addr *gwaddr, int ifindex) |
1761 | { | 1761 | { |
1762 | struct fib6_node *fn; | 1762 | struct fib6_node *fn; |
1763 | struct rt6_info *rt = NULL; | 1763 | struct rt6_info *rt = NULL; |
@@ -1788,8 +1788,8 @@ out: | |||
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | static struct rt6_info *rt6_add_route_info(struct net *net, | 1790 | static struct rt6_info *rt6_add_route_info(struct net *net, |
1791 | struct in6_addr *prefix, int prefixlen, | 1791 | const struct in6_addr *prefix, int prefixlen, |
1792 | struct in6_addr *gwaddr, int ifindex, | 1792 | const struct in6_addr *gwaddr, int ifindex, |
1793 | unsigned pref) | 1793 | unsigned pref) |
1794 | { | 1794 | { |
1795 | struct fib6_config cfg = { | 1795 | struct fib6_config cfg = { |
@@ -1817,7 +1817,7 @@ static struct rt6_info *rt6_add_route_info(struct net *net, | |||
1817 | } | 1817 | } |
1818 | #endif | 1818 | #endif |
1819 | 1819 | ||
1820 | struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *dev) | 1820 | struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_device *dev) |
1821 | { | 1821 | { |
1822 | struct rt6_info *rt; | 1822 | struct rt6_info *rt; |
1823 | struct fib6_table *table; | 1823 | struct fib6_table *table; |
@@ -1839,7 +1839,7 @@ struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *d | |||
1839 | return rt; | 1839 | return rt; |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr, | 1842 | struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr, |
1843 | struct net_device *dev, | 1843 | struct net_device *dev, |
1844 | unsigned int pref) | 1844 | unsigned int pref) |
1845 | { | 1845 | { |
@@ -2049,7 +2049,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
2049 | 2049 | ||
2050 | int ip6_route_get_saddr(struct net *net, | 2050 | int ip6_route_get_saddr(struct net *net, |
2051 | struct rt6_info *rt, | 2051 | struct rt6_info *rt, |
2052 | struct in6_addr *daddr, | 2052 | const struct in6_addr *daddr, |
2053 | unsigned int prefs, | 2053 | unsigned int prefs, |
2054 | struct in6_addr *saddr) | 2054 | struct in6_addr *saddr) |
2055 | { | 2055 | { |