Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Apr 2017 10:12:30 +0300
From:      Boris Astardzhiev <boris.astardzhiev@gmail.com>
To:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Missing LLE events for ifnet and inet removals
Message-ID:  <CAP=KkTyS58gG3hkh9umHCmjwA=U=54T3ACDprSm=8J6L7AkOVw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello,

I've noticed that there are no lle events on ifnet and inet removals - head,
stable11, releng11. This may confuse consumers and could make their
application out of sync.

diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c
index d286b6e..6807a0a 100644
--- a/sys/net/if_llatbl.c
+++ b/sys/net/if_llatbl.c
@@ -226,8 +226,10 @@ htable_prefix_free(struct lltable *llt, const struct
sockaddr *addr,
        llentries_unlink(llt, &pmd.dchain);
        IF_AFDATA_WUNLOCK(llt->llt_ifp);

-       LIST_FOREACH_SAFE(lle, &pmd.dchain, lle_chain, next)
+       LIST_FOREACH_SAFE(lle, &pmd.dchain, lle_chain, next) {
+               EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED);
                lltable_free_entry(llt, lle);
+       }
 }

This seems to fix the issue for me.

There's one minor contemplation here with this fix however.
Delete events are triggered for lle entries that were incomplete.
And since those entries had already been removed the LLE_VALID flag a few
lines upper:
        llentries_unlink(llt, &pmd.dchain);
in the consumer application entries can't be easily distinguished (valid vs
incomplete). In short - with the current fix resolve events are not
triggered
for incomplete entries but are triggered for deleted incomplete ones.
So let's go further - I could have marked the lle->la_flags with something
new
like LLE_WASVALID in the unlink function so that I could use it in the
consumer
part but I prefer to settle it into a discussion here first since there may
be
more approaches.

Best regards,
Boris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAP=KkTyS58gG3hkh9umHCmjwA=U=54T3ACDprSm=8J6L7AkOVw>