@@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_if, CONFIG_NET_IF_LOG_LEVEL);
16
16
#include <string.h>
17
17
#include <zephyr/net/igmp.h>
18
18
#include <zephyr/net/net_core.h>
19
+ #include <zephyr/net/net_event.h>
19
20
#include <zephyr/net/net_pkt.h>
20
21
#include <zephyr/net/net_if.h>
21
22
#include <zephyr/net/net_mgmt.h>
@@ -2220,9 +2221,20 @@ static void prefix_lifetime_expired(struct net_if_ipv6_prefix *ifprefix)
2220
2221
remove_prefix_addresses (ifprefix -> iface , ipv6 , & ifprefix -> prefix ,
2221
2222
ifprefix -> len );
2222
2223
2223
- net_mgmt_event_notify_with_info (
2224
- NET_EVENT_IPV6_PREFIX_DEL , ifprefix -> iface ,
2225
- & ifprefix -> prefix , sizeof (struct in6_addr ));
2224
+ if (IS_ENABLED (CONFIG_NET_MGMT_EVENT_INFO )) {
2225
+ struct net_event_ipv6_prefix info ;
2226
+
2227
+ net_ipaddr_copy (& info .addr , & ifprefix -> prefix );
2228
+ info .len = ifprefix -> len ;
2229
+ info .lifetime = 0 ;
2230
+
2231
+ net_mgmt_event_notify_with_info (NET_EVENT_IPV6_PREFIX_DEL ,
2232
+ ifprefix -> iface ,
2233
+ (const void * ) & info ,
2234
+ sizeof (struct net_event_ipv6_prefix ));
2235
+ } else {
2236
+ net_mgmt_event_notify (NET_EVENT_IPV6_PREFIX_DEL , ifprefix -> iface );
2237
+ }
2226
2238
2227
2239
net_if_unlock (ifprefix -> iface );
2228
2240
}
@@ -2384,9 +2396,19 @@ struct net_if_ipv6_prefix *net_if_ipv6_prefix_add(struct net_if *iface,
2384
2396
NET_DBG ("[%d] interface %p prefix %s/%d added" , i , iface ,
2385
2397
net_sprint_ipv6_addr (prefix ), len );
2386
2398
2387
- net_mgmt_event_notify_with_info (
2388
- NET_EVENT_IPV6_PREFIX_ADD , iface ,
2389
- & ipv6 -> prefix [i ].prefix , sizeof (struct in6_addr ));
2399
+ if (IS_ENABLED (CONFIG_NET_MGMT_EVENT_INFO )) {
2400
+ struct net_event_ipv6_prefix info ;
2401
+
2402
+ net_ipaddr_copy (& info .addr , prefix );
2403
+ info .len = len ;
2404
+ info .lifetime = lifetime ;
2405
+
2406
+ net_mgmt_event_notify_with_info (NET_EVENT_IPV6_PREFIX_ADD ,
2407
+ iface , (const void * ) & info ,
2408
+ sizeof (struct net_event_ipv6_prefix ));
2409
+ } else {
2410
+ net_mgmt_event_notify (NET_EVENT_IPV6_PREFIX_ADD , iface );
2411
+ }
2390
2412
2391
2413
ifprefix = & ipv6 -> prefix [i ];
2392
2414
goto out ;
@@ -2431,9 +2453,19 @@ bool net_if_ipv6_prefix_rm(struct net_if *iface, struct in6_addr *addr,
2431
2453
*/
2432
2454
remove_prefix_addresses (iface , ipv6 , addr , len );
2433
2455
2434
- net_mgmt_event_notify_with_info (
2435
- NET_EVENT_IPV6_PREFIX_DEL , iface ,
2436
- & ipv6 -> prefix [i ].prefix , sizeof (struct in6_addr ));
2456
+ if (IS_ENABLED (CONFIG_NET_MGMT_EVENT_INFO )) {
2457
+ struct net_event_ipv6_prefix info ;
2458
+
2459
+ net_ipaddr_copy (& info .addr , addr );
2460
+ info .len = len ;
2461
+ info .lifetime = 0 ;
2462
+
2463
+ net_mgmt_event_notify_with_info (NET_EVENT_IPV6_PREFIX_DEL ,
2464
+ iface , (const void * ) & info ,
2465
+ sizeof (struct net_event_ipv6_prefix ));
2466
+ } else {
2467
+ net_mgmt_event_notify (NET_EVENT_IPV6_PREFIX_DEL , iface );
2468
+ }
2437
2469
2438
2470
ret = true;
2439
2471
goto out ;
0 commit comments