@@ -54,8 +54,6 @@ void ipv6_frag_cb(struct net_ipv6_reassembly *reass, void *user_data)
54
54
}
55
55
#endif /* CONFIG_NET_IPV6_FRAGMENT */
56
56
57
- #if defined(CONFIG_NET_NATIVE_IPV6 )
58
-
59
57
#if defined(CONFIG_NET_IPV6_PE )
60
58
static void ipv6_pe_filter_cb (struct in6_addr * prefix , bool is_denylist ,
61
59
void * user_data )
@@ -78,6 +76,7 @@ static void ipv6_pe_filter_cb(struct in6_addr *prefix, bool is_denylist,
78
76
}
79
77
#endif /* CONFIG_NET_IPV6_PE */
80
78
79
+ #if defined(CONFIG_NET_IPV6 )
81
80
static void address_lifetime_cb (struct net_if * iface , void * user_data )
82
81
{
83
82
struct net_shell_user_data * data = user_data ;
@@ -99,25 +98,25 @@ static void address_lifetime_cb(struct net_if *iface, void *user_data)
99
98
PR ("Type \tState \tLifetime (sec)\tRef\tAddress\n" );
100
99
101
100
ARRAY_FOR_EACH (ipv6 -> unicast , i ) {
102
- struct net_if_ipv6_prefix * prefix ;
103
101
char remaining_str [sizeof ("01234567890" )];
104
- uint32_t remaining ;
105
- uint8_t prefix_len ;
102
+ uint8_t prefix_len = 128U ;
106
103
107
104
if (!ipv6 -> unicast [i ].is_used ||
108
105
ipv6 -> unicast [i ].address .family != AF_INET6 ) {
109
106
continue ;
110
107
}
111
108
109
+ #if defined(CONFIG_NET_NATIVE_IPV6 )
110
+ struct net_if_ipv6_prefix * prefix ;
111
+ uint32_t remaining ;
112
+
112
113
remaining = net_timeout_remaining (& ipv6 -> unicast [i ].lifetime ,
113
114
k_uptime_get_32 ());
114
115
115
116
prefix = net_if_ipv6_prefix_get (iface ,
116
117
& ipv6 -> unicast [i ].address .in6_addr );
117
118
if (prefix ) {
118
119
prefix_len = prefix -> len ;
119
- } else {
120
- prefix_len = 128U ;
121
120
}
122
121
123
122
if (ipv6 -> unicast [i ].is_infinite ) {
@@ -127,6 +126,9 @@ static void address_lifetime_cb(struct net_if *iface, void *user_data)
127
126
snprintk (remaining_str , sizeof (remaining_str ) - 1 ,
128
127
"%u" , remaining );
129
128
}
129
+ #else
130
+ snprintk (remaining_str , sizeof (remaining_str ) - 1 , "infinite" );
131
+ #endif /* CONFIG_NET_NATIVE_IPV6 */
130
132
131
133
PR ("%s \t%s\t%14s\t%ld\t%s/%d%s\n" ,
132
134
addrtype2str (ipv6 -> unicast [i ].addr_type ),
@@ -137,13 +139,13 @@ static void address_lifetime_cb(struct net_if *iface, void *user_data)
137
139
ipv6 -> unicast [i ].is_temporary ? " (temporary)" : "" );
138
140
}
139
141
}
140
- #endif /* CONFIG_NET_NATIVE_IPV6 */
142
+ #endif /* CONFIG_NET_IPV6 */
141
143
142
144
static int cmd_net_ipv6 (const struct shell * sh , size_t argc , char * argv [])
143
145
{
144
- #if defined(CONFIG_NET_NATIVE_IPV6 )
146
+ #if defined(CONFIG_NET_IPV6 )
145
147
struct net_shell_user_data user_data ;
146
- #endif
148
+ #endif /* CONFIG_NET_IPV6 */
147
149
148
150
PR ("IPv6 support : %s\n" ,
149
151
IS_ENABLED (CONFIG_NET_IPV6 ) ?
@@ -189,8 +191,10 @@ static int cmd_net_ipv6(const struct shell *sh, size_t argc, char *argv[])
189
191
PR ("Max number of IPv6 privacy extension filters "
190
192
" : %d\n" ,
191
193
CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT );
192
- #endif
194
+ #endif /* CONFIG_NET_IPV6_PE */
195
+ #endif /* CONFIG_NET_NATIVE_IPV6 */
193
196
197
+ #if defined(CONFIG_NET_IPV6 )
194
198
PR ("Max number of IPv6 network interfaces "
195
199
"in the system : %d\n" ,
196
200
CONFIG_NET_IF_MAX_IPV6_COUNT );
@@ -209,15 +213,14 @@ static int cmd_net_ipv6(const struct shell *sh, size_t argc, char *argv[])
209
213
210
214
/* Print information about address lifetime */
211
215
net_if_foreach (address_lifetime_cb , & user_data );
212
-
213
- #endif /* CONFIG_NET_NATIVE_IPV6 */
216
+ #endif /* CONFIG_NET_IPV6 */
214
217
215
218
return 0 ;
216
219
}
217
220
218
221
static int cmd_net_ip6_add (const struct shell * sh , size_t argc , char * argv [])
219
222
{
220
- #if defined(CONFIG_NET_NATIVE_IPV6 )
223
+ #if defined(CONFIG_NET_IPV6 )
221
224
struct net_if * iface = NULL ;
222
225
int idx ;
223
226
struct in6_addr addr ;
@@ -262,16 +265,15 @@ static int cmd_net_ip6_add(const struct shell *sh, size_t argc, char *argv[])
262
265
}
263
266
}
264
267
265
- #else /* CONFIG_NET_NATIVE_IPV6 */
266
- PR_INFO ("Set %s and %s to enable native %s support.\n" ,
267
- "CONFIG_NET_NATIVE" , "CONFIG_NET_IPV6" , "IPv6" );
268
- #endif /* CONFIG_NET_NATIVE_IPV6 */
268
+ #else /* CONFIG_NET_IPV6 */
269
+ PR_INFO ("Set %s to enable %s support.\n" , "CONFIG_NET_IPV6" , "IPv6" );
270
+ #endif /* CONFIG_NET_IPV6 */
269
271
return 0 ;
270
272
}
271
273
272
274
static int cmd_net_ip6_del (const struct shell * sh , size_t argc , char * argv [])
273
275
{
274
- #if defined(CONFIG_NET_NATIVE_IPV6 )
276
+ #if defined(CONFIG_NET_IPV6 )
275
277
struct net_if * iface = NULL ;
276
278
int idx ;
277
279
struct in6_addr addr ;
@@ -317,10 +319,9 @@ static int cmd_net_ip6_del(const struct shell *sh, size_t argc, char *argv[])
317
319
}
318
320
}
319
321
320
- #else /* CONFIG_NET_NATIVE_IPV6 */
321
- PR_INFO ("Set %s and %s to enable native %s support.\n" ,
322
- "CONFIG_NET_NATIVE" , "CONFIG_NET_IPV6" , "IPv6" );
323
- #endif /* CONFIG_NET_NATIVE_IPV6 */
322
+ #else /* CONFIG_NET_IPV6 */
323
+ PR_INFO ("Set %s to enable %s support.\n" , "CONFIG_NET_IPV6" , "IPv6" );
324
+ #endif /* CONFIG_NET_IPV6 */
324
325
return 0 ;
325
326
}
326
327
0 commit comments