From owner-freebsd-net@freebsd.org Fri Apr 28 07:12:34 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A960D52C24 for ; Fri, 28 Apr 2017 07:12:34 +0000 (UTC) (envelope-from boris.astardzhiev@gmail.com) Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C6CFE1B47 for ; Fri, 28 Apr 2017 07:12:33 +0000 (UTC) (envelope-from boris.astardzhiev@gmail.com) Received: by mail-wm0-x230.google.com with SMTP id u65so34430880wmu.1 for ; Fri, 28 Apr 2017 00:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=8vKvE5kBho6OXz2kXl84dexu0IUR4N1jv1GaCTOJ0xM=; b=C3pwF9MZhlFIdfm4OJoN8JUNt9biDx5UOQTMoVcYf/LB2uhnFhqvGbJAVe4jaFdl7J rLYHhqGeB+ebDMR0EoRbW+dJjE3N53fOIYsykvjes+XnGm1dHX/3l9xIH2D0jddxhLSn RAEbV6osvLLp1ODvzBbP1uQLOLAADugY/WLxhsjcCCp+YdwEwt8TlwCgE+UEhOq7RJMl BCRXECVfKVEFuN3VUh65y9gmvj1oIH1RvoC3QX7Q7Nl5gJBGKkCZbY/aI4EoTbGa6TRa iucXKpF4oV070dNO7aIb+pCSUQq4lCOYqpYBgcZxo0WcQRmzJVI2JbfRz2wc01i/AdTe WP8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=8vKvE5kBho6OXz2kXl84dexu0IUR4N1jv1GaCTOJ0xM=; b=RLaravK+y2I+GHJYPmVWnBoNXWd/hdJ2woNUc2hkfDHVvixpLvjnQIiWH+0IBr9J1n C80UlmKrZoAxN6WAiEk++bSOj9hndg96B5yBRwooL39PRjBmfqAgM83pDWHaYKj5H1Xj EBovr4LsctAQvQTJQEP98KzqD6qLAZrApP3K+l1tf48gFjTRxAMBO+psIGUUhAyxs2M9 WAfk89yWl2aZQtyW5luT9QZItB11nVsDrohu0Vt156QgdkChV2a4ncQf1HR6LbP2g1Lu KWzO0y2ecgNJaBJpeZNr0ACRD+z+jhuwMfMea1e9Wj+7mCDl6ddXc+rppXXN44mUa5Si ignA== X-Gm-Message-State: AN3rC/4bHAiecken3KEOCma2urGELf5yjnFzsKhWFmhep40rJ8Lp0Hq3 svJv13Acq5dC7gv5/Av5KoYM5zQKyv0+ X-Received: by 10.28.95.85 with SMTP id t82mr4866435wmb.3.1493363551128; Fri, 28 Apr 2017 00:12:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.6.195 with HTTP; Fri, 28 Apr 2017 00:12:30 -0700 (PDT) From: Boris Astardzhiev Date: Fri, 28 Apr 2017 10:12:30 +0300 Message-ID: Subject: Missing LLE events for ifnet and inet removals To: FreeBSD Net Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 07:12:34 -0000 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