Re: Callback on DNS added/removed


Hi Jukka,
That seems to fix it for (NET_EVENT_IPV4_ADDR_ADD | NET_EVENT_IPV4_CMD_ROUTER_ADD) but (NET_EVENT_IF_UP | NET_EVENT_IPV4_ADDR_ADD | NET_EVENT_IPV4_CMD_ROUTER_ADD) prevents any events triggering, so it's a step in the right direction. I'm not actually checking for events in the handler code, I'm just printing out each time it runs:

static void iface_evt_handler(struct net_mgmt_event_callback *cb,
u32_t mgmt_event, struct net_if *iface)


Hi Jamie,

note that in your callback, you need to check the exact value of the
event, so

if (mgmt_event == NET_EVENT_IPV6_ADDR_ADD) {}

instead of

if (mgmt_event & NET_EVENT_IPV6_ADDR_ADD) {}

I also noticed some issues with multiple events mask last week. My fix
proposal can be found in, see commit
"net: mgmt: Fix the layer and layer code matching" in that PR. Please
try and report if it works for you or not.


On Tue, 2019-06-18 at 14:53 +0000, lairdjm wrote:
Also I see on
that net_mgmt_init_event_callback() specifies it takes a bitmask of
events for combining them into a single event but I am unable to get
this working, NET_EVENT_IPV4_ADDR_ADD works and I get the callback
but (NET_EVENT_IF_UP | NET_EVENT_IPV4_ADDR_ADD) doesn’t seem to give
me a callback at all.

Join to automatically receive all group messages.