@@ -719,7 +719,8 @@ static uint8_t get_ipaddr_diff(const uint8_t *src, const uint8_t *dst, int addr_
719
719
720
720
#if defined(CONFIG_NET_NATIVE_IPV4 ) || defined(CONFIG_NET_NATIVE_IPV6 )
721
721
static struct net_if_router * iface_router_lookup (struct net_if * iface ,
722
- uint8_t family , void * addr )
722
+ uint8_t family ,
723
+ const void * addr )
723
724
{
724
725
struct net_if_router * router = NULL ;
725
726
int i ;
@@ -735,10 +736,10 @@ static struct net_if_router *iface_router_lookup(struct net_if *iface,
735
736
736
737
if ((IS_ENABLED (CONFIG_NET_IPV6 ) && family == AF_INET6 &&
737
738
net_ipv6_addr_cmp (net_if_router_ipv6 (& routers [i ]),
738
- (struct in6_addr * )addr )) ||
739
+ (const struct in6_addr * )addr )) ||
739
740
(IS_ENABLED (CONFIG_NET_IPV4 ) && family == AF_INET &&
740
741
net_ipv4_addr_cmp (net_if_router_ipv4 (& routers [i ]),
741
- (struct in_addr * )addr ))) {
742
+ (const struct in_addr * )addr ))) {
742
743
router = & routers [i ];
743
744
goto out ;
744
745
}
@@ -849,7 +850,7 @@ static void iface_router_expired(struct k_work *work)
849
850
}
850
851
851
852
static struct net_if_router * iface_router_add (struct net_if * iface ,
852
- uint8_t family , void * addr ,
853
+ uint8_t family , const void * addr ,
853
854
bool is_default ,
854
855
uint16_t lifetime )
855
856
{
@@ -959,7 +960,8 @@ void net_if_router_rm(struct net_if_router *router)
959
960
}
960
961
961
962
static struct net_if_router * iface_router_find_default (struct net_if * iface ,
962
- uint8_t family , void * addr )
963
+ uint8_t family ,
964
+ const void * addr )
963
965
{
964
966
struct net_if_router * router = NULL ;
965
967
int i ;
@@ -1909,7 +1911,7 @@ struct net_if_addr *net_if_ipv6_addr_lookup_by_iface_raw(struct net_if *iface,
1909
1911
}
1910
1912
1911
1913
struct net_if_addr * net_if_ipv6_addr_lookup_by_iface (struct net_if * iface ,
1912
- struct in6_addr * addr )
1914
+ const struct in6_addr * addr )
1913
1915
{
1914
1916
return net_if_ipv6_addr_lookup_by_iface_raw (iface , addr -> s6_addr );
1915
1917
}
@@ -1957,7 +1959,7 @@ void net_if_ipv6_addr_update_lifetime(struct net_if_addr *ifaddr,
1957
1959
}
1958
1960
1959
1961
static struct net_if_addr * ipv6_addr_find (struct net_if * iface ,
1960
- struct in6_addr * addr )
1962
+ const struct in6_addr * addr )
1961
1963
{
1962
1964
struct net_if_ipv6 * ipv6 = iface -> config .ip .ipv6 ;
1963
1965
@@ -1977,7 +1979,7 @@ static struct net_if_addr *ipv6_addr_find(struct net_if *iface,
1977
1979
}
1978
1980
1979
1981
static inline void net_if_addr_init (struct net_if_addr * ifaddr ,
1980
- struct in6_addr * addr ,
1982
+ const struct in6_addr * addr ,
1981
1983
enum net_addr_type addr_type ,
1982
1984
uint32_t vlifetime )
1983
1985
{
@@ -2006,7 +2008,7 @@ static inline void net_if_addr_init(struct net_if_addr *ifaddr,
2006
2008
}
2007
2009
2008
2010
struct net_if_addr * net_if_ipv6_addr_add (struct net_if * iface ,
2009
- struct in6_addr * addr ,
2011
+ const struct in6_addr * addr ,
2010
2012
enum net_addr_type addr_type ,
2011
2013
uint32_t vlifetime )
2012
2014
{
@@ -2135,7 +2137,7 @@ bool net_if_ipv6_addr_rm(struct net_if *iface, const struct in6_addr *addr)
2135
2137
}
2136
2138
2137
2139
bool z_impl_net_if_ipv6_addr_add_by_index (int index ,
2138
- struct in6_addr * addr ,
2140
+ const struct in6_addr * addr ,
2139
2141
enum net_addr_type addr_type ,
2140
2142
uint32_t vlifetime )
2141
2143
{
@@ -2152,7 +2154,7 @@ bool z_impl_net_if_ipv6_addr_add_by_index(int index,
2152
2154
2153
2155
#ifdef CONFIG_USERSPACE
2154
2156
bool z_vrfy_net_if_ipv6_addr_add_by_index (int index ,
2155
- struct in6_addr * addr ,
2157
+ const struct in6_addr * addr ,
2156
2158
enum net_addr_type addr_type ,
2157
2159
uint32_t vlifetime )
2158
2160
{
@@ -2550,7 +2552,7 @@ struct in6_addr *net_if_ipv6_get_global_addr(enum net_addr_state state,
2550
2552
#if defined(CONFIG_NET_NATIVE_IPV6 )
2551
2553
static void remove_prefix_addresses (struct net_if * iface ,
2552
2554
struct net_if_ipv6 * ipv6 ,
2553
- struct in6_addr * addr ,
2555
+ const struct in6_addr * addr ,
2554
2556
uint8_t len )
2555
2557
{
2556
2558
ARRAY_FOR_EACH (ipv6 -> unicast , i ) {
@@ -2690,7 +2692,7 @@ static void prefix_start_timer(struct net_if_ipv6_prefix *ifprefix,
2690
2692
}
2691
2693
2692
2694
static struct net_if_ipv6_prefix * ipv6_prefix_find (struct net_if * iface ,
2693
- struct in6_addr * prefix ,
2695
+ const struct in6_addr * prefix ,
2694
2696
uint8_t prefix_len )
2695
2697
{
2696
2698
struct net_if_ipv6 * ipv6 = iface -> config .ip .ipv6 ;
@@ -2715,7 +2717,7 @@ static struct net_if_ipv6_prefix *ipv6_prefix_find(struct net_if *iface,
2715
2717
2716
2718
static void net_if_ipv6_prefix_init (struct net_if * iface ,
2717
2719
struct net_if_ipv6_prefix * ifprefix ,
2718
- struct in6_addr * addr , uint8_t len ,
2720
+ const struct in6_addr * addr , uint8_t len ,
2719
2721
uint32_t lifetime )
2720
2722
{
2721
2723
ifprefix -> is_used = true;
@@ -2731,7 +2733,7 @@ static void net_if_ipv6_prefix_init(struct net_if *iface,
2731
2733
}
2732
2734
2733
2735
struct net_if_ipv6_prefix * net_if_ipv6_prefix_add (struct net_if * iface ,
2734
- struct in6_addr * prefix ,
2736
+ const struct in6_addr * prefix ,
2735
2737
uint8_t len ,
2736
2738
uint32_t lifetime )
2737
2739
{
@@ -2788,7 +2790,7 @@ struct net_if_ipv6_prefix *net_if_ipv6_prefix_add(struct net_if *iface,
2788
2790
return ifprefix ;
2789
2791
}
2790
2792
2791
- bool net_if_ipv6_prefix_rm (struct net_if * iface , struct in6_addr * addr ,
2793
+ bool net_if_ipv6_prefix_rm (struct net_if * iface , const struct in6_addr * addr ,
2792
2794
uint8_t len )
2793
2795
{
2794
2796
bool ret = false;
@@ -2896,7 +2898,7 @@ struct net_if_ipv6_prefix *net_if_ipv6_prefix_get(struct net_if *iface,
2896
2898
}
2897
2899
2898
2900
struct net_if_ipv6_prefix * net_if_ipv6_prefix_lookup (struct net_if * iface ,
2899
- struct in6_addr * addr ,
2901
+ const struct in6_addr * addr ,
2900
2902
uint8_t len )
2901
2903
{
2902
2904
struct net_if_ipv6_prefix * prefix = NULL ;
@@ -2927,7 +2929,7 @@ struct net_if_ipv6_prefix *net_if_ipv6_prefix_lookup(struct net_if *iface,
2927
2929
return prefix ;
2928
2930
}
2929
2931
2930
- bool net_if_ipv6_addr_onlink (struct net_if * * iface , struct in6_addr * addr )
2932
+ bool net_if_ipv6_addr_onlink (struct net_if * * iface , const struct in6_addr * addr )
2931
2933
{
2932
2934
bool ret = false;
2933
2935
@@ -2991,13 +2993,13 @@ void net_if_ipv6_prefix_unset_timer(struct net_if_ipv6_prefix *prefix)
2991
2993
}
2992
2994
2993
2995
struct net_if_router * net_if_ipv6_router_lookup (struct net_if * iface ,
2994
- struct in6_addr * addr )
2996
+ const struct in6_addr * addr )
2995
2997
{
2996
2998
return iface_router_lookup (iface , AF_INET6 , addr );
2997
2999
}
2998
3000
2999
3001
struct net_if_router * net_if_ipv6_router_find_default (struct net_if * iface ,
3000
- struct in6_addr * addr )
3002
+ const struct in6_addr * addr )
3001
3003
{
3002
3004
return iface_router_find_default (iface , AF_INET6 , addr );
3003
3005
}
@@ -3016,7 +3018,7 @@ void net_if_ipv6_router_update_lifetime(struct net_if_router *router,
3016
3018
}
3017
3019
3018
3020
struct net_if_router * net_if_ipv6_router_add (struct net_if * iface ,
3019
- struct in6_addr * addr ,
3021
+ const struct in6_addr * addr ,
3020
3022
uint16_t lifetime )
3021
3023
{
3022
3024
return iface_router_add (iface , AF_INET6 , addr , false, lifetime );
@@ -4377,7 +4379,7 @@ bool z_vrfy_net_if_ipv4_set_gw_by_index(int index,
4377
4379
#endif /* CONFIG_USERSPACE */
4378
4380
4379
4381
static struct net_if_addr * ipv4_addr_find (struct net_if * iface ,
4380
- struct in_addr * addr )
4382
+ const struct in_addr * addr )
4381
4383
{
4382
4384
struct net_if_ipv4 * ipv4 = iface -> config .ip .ipv4 ;
4383
4385
@@ -4526,7 +4528,7 @@ void net_if_start_acd(struct net_if *iface)
4526
4528
#endif /* CONFIG_NET_IPV4_ACD */
4527
4529
4528
4530
struct net_if_addr * net_if_ipv4_addr_add (struct net_if * iface ,
4529
- struct in_addr * addr ,
4531
+ const struct in_addr * addr ,
4530
4532
enum net_addr_type addr_type ,
4531
4533
uint32_t vlifetime )
4532
4534
{
@@ -4671,7 +4673,7 @@ bool net_if_ipv4_addr_rm(struct net_if *iface, const struct in_addr *addr)
4671
4673
}
4672
4674
4673
4675
bool z_impl_net_if_ipv4_addr_add_by_index (int index ,
4674
- struct in_addr * addr ,
4676
+ const struct in_addr * addr ,
4675
4677
enum net_addr_type addr_type ,
4676
4678
uint32_t vlifetime )
4677
4679
{
@@ -4689,7 +4691,7 @@ bool z_impl_net_if_ipv4_addr_add_by_index(int index,
4689
4691
4690
4692
#ifdef CONFIG_USERSPACE
4691
4693
bool z_vrfy_net_if_ipv4_addr_add_by_index (int index ,
4692
- struct in_addr * addr ,
4694
+ const struct in_addr * addr ,
4693
4695
enum net_addr_type addr_type ,
4694
4696
uint32_t vlifetime )
4695
4697
{
@@ -5027,19 +5029,19 @@ void net_if_ipv4_set_mcast_ttl(struct net_if *iface, uint8_t ttl)
5027
5029
}
5028
5030
5029
5031
struct net_if_router * net_if_ipv4_router_lookup (struct net_if * iface ,
5030
- struct in_addr * addr )
5032
+ const struct in_addr * addr )
5031
5033
{
5032
5034
return iface_router_lookup (iface , AF_INET , addr );
5033
5035
}
5034
5036
5035
5037
struct net_if_router * net_if_ipv4_router_find_default (struct net_if * iface ,
5036
- struct in_addr * addr )
5038
+ const struct in_addr * addr )
5037
5039
{
5038
5040
return iface_router_find_default (iface , AF_INET , addr );
5039
5041
}
5040
5042
5041
5043
struct net_if_router * net_if_ipv4_router_add (struct net_if * iface ,
5042
- struct in_addr * addr ,
5044
+ const struct in_addr * addr ,
5043
5045
bool is_default ,
5044
5046
uint16_t lifetime )
5045
5047
{
0 commit comments