@@ -54,8 +54,6 @@ void ipv6_frag_cb(struct net_ipv6_reassembly *reass, void *user_data)
5454}
5555#endif /* CONFIG_NET_IPV6_FRAGMENT */
5656
57- #if defined(CONFIG_NET_NATIVE_IPV6 )
58-
5957#if defined(CONFIG_NET_IPV6_PE )
6058static void ipv6_pe_filter_cb (struct in6_addr * prefix , bool is_denylist ,
6159 void * user_data )
@@ -78,6 +76,7 @@ static void ipv6_pe_filter_cb(struct in6_addr *prefix, bool is_denylist,
7876}
7977#endif /* CONFIG_NET_IPV6_PE */
8078
79+ #if defined(CONFIG_NET_IPV6 )
8180static void address_lifetime_cb (struct net_if * iface , void * user_data )
8281{
8382 struct net_shell_user_data * data = user_data ;
@@ -99,25 +98,25 @@ static void address_lifetime_cb(struct net_if *iface, void *user_data)
9998 PR ("Type \tState \tLifetime (sec)\tRef\tAddress\n" );
10099
101100 ARRAY_FOR_EACH (ipv6 -> unicast , i ) {
102- struct net_if_ipv6_prefix * prefix ;
103101 char remaining_str [sizeof ("01234567890" )];
104- uint32_t remaining ;
105- uint8_t prefix_len ;
102+ uint8_t prefix_len = 128U ;
106103
107104 if (!ipv6 -> unicast [i ].is_used ||
108105 ipv6 -> unicast [i ].address .family != AF_INET6 ) {
109106 continue ;
110107 }
111108
109+ #if defined(CONFIG_NET_NATIVE_IPV6 )
110+ struct net_if_ipv6_prefix * prefix ;
111+ uint32_t remaining ;
112+
112113 remaining = net_timeout_remaining (& ipv6 -> unicast [i ].lifetime ,
113114 k_uptime_get_32 ());
114115
115116 prefix = net_if_ipv6_prefix_get (iface ,
116117 & ipv6 -> unicast [i ].address .in6_addr );
117118 if (prefix ) {
118119 prefix_len = prefix -> len ;
119- } else {
120- prefix_len = 128U ;
121120 }
122121
123122 if (ipv6 -> unicast [i ].is_infinite ) {
@@ -127,6 +126,9 @@ static void address_lifetime_cb(struct net_if *iface, void *user_data)
127126 snprintk (remaining_str , sizeof (remaining_str ) - 1 ,
128127 "%u" , remaining );
129128 }
129+ #else
130+ snprintk (remaining_str , sizeof (remaining_str ) - 1 , "infinite" );
131+ #endif /* CONFIG_NET_NATIVE_IPV6 */
130132
131133 PR ("%s \t%s\t%14s\t%ld\t%s/%d%s\n" ,
132134 addrtype2str (ipv6 -> unicast [i ].addr_type ),
@@ -137,13 +139,13 @@ static void address_lifetime_cb(struct net_if *iface, void *user_data)
137139 ipv6 -> unicast [i ].is_temporary ? " (temporary)" : "" );
138140 }
139141}
140- #endif /* CONFIG_NET_NATIVE_IPV6 */
142+ #endif /* CONFIG_NET_IPV6 */
141143
142144static int cmd_net_ipv6 (const struct shell * sh , size_t argc , char * argv [])
143145{
144- #if defined(CONFIG_NET_NATIVE_IPV6 )
146+ #if defined(CONFIG_NET_IPV6 )
145147 struct net_shell_user_data user_data ;
146- #endif
148+ #endif /* CONFIG_NET_IPV6 */
147149
148150 PR ("IPv6 support : %s\n" ,
149151 IS_ENABLED (CONFIG_NET_IPV6 ) ?
@@ -189,8 +191,10 @@ static int cmd_net_ipv6(const struct shell *sh, size_t argc, char *argv[])
189191 PR ("Max number of IPv6 privacy extension filters "
190192 " : %d\n" ,
191193 CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT );
192- #endif
194+ #endif /* CONFIG_NET_IPV6_PE */
195+ #endif /* CONFIG_NET_NATIVE_IPV6 */
193196
197+ #if defined(CONFIG_NET_IPV6 )
194198 PR ("Max number of IPv6 network interfaces "
195199 "in the system : %d\n" ,
196200 CONFIG_NET_IF_MAX_IPV6_COUNT );
@@ -209,15 +213,14 @@ static int cmd_net_ipv6(const struct shell *sh, size_t argc, char *argv[])
209213
210214 /* Print information about address lifetime */
211215 net_if_foreach (address_lifetime_cb , & user_data );
212-
213- #endif /* CONFIG_NET_NATIVE_IPV6 */
216+ #endif /* CONFIG_NET_IPV6 */
214217
215218 return 0 ;
216219}
217220
218221static int cmd_net_ip6_add (const struct shell * sh , size_t argc , char * argv [])
219222{
220- #if defined(CONFIG_NET_NATIVE_IPV6 )
223+ #if defined(CONFIG_NET_IPV6 )
221224 struct net_if * iface = NULL ;
222225 int idx ;
223226 struct in6_addr addr ;
@@ -262,16 +265,15 @@ static int cmd_net_ip6_add(const struct shell *sh, size_t argc, char *argv[])
262265 }
263266 }
264267
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 */
269271 return 0 ;
270272}
271273
272274static int cmd_net_ip6_del (const struct shell * sh , size_t argc , char * argv [])
273275{
274- #if defined(CONFIG_NET_NATIVE_IPV6 )
276+ #if defined(CONFIG_NET_IPV6 )
275277 struct net_if * iface = NULL ;
276278 int idx ;
277279 struct in6_addr addr ;
@@ -317,10 +319,9 @@ static int cmd_net_ip6_del(const struct shell *sh, size_t argc, char *argv[])
317319 }
318320 }
319321
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 */
324325 return 0 ;
325326}
326327
0 commit comments