Page MenuHomeFreeBSD

D28639.1779344977.diff
No OneTemporary

Size
795 B
Referenced Files
None
Subscribers
None

D28639.1779344977.diff

diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1857,8 +1857,18 @@
void
ifa_ref(struct ifaddr *ifa)
{
+ u_int old;
- refcount_acquire(&ifa->ifa_refcnt);
+ old = refcount_acquire(&ifa->ifa_refcnt);
+ KASSERT(old > 0, ("%s: ifa %p has 0 refs", __func__, ifa));
+}
+
+int
+ifa_try_ref(struct ifaddr *ifa)
+{
+
+ NET_EPOCH_ASSERT();
+ return (refcount_acquire_if_not_zero(&ifa->ifa_refcnt));
}
static void
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -577,6 +577,7 @@
struct ifaddr * ifa_alloc(size_t size, int flags);
void ifa_free(struct ifaddr *ifa);
void ifa_ref(struct ifaddr *ifa);
+int ifa_try_ref(struct ifaddr *ifa);
/*
* Multicast address structure. This is analogous to the ifaddr

File Metadata

Mime Type
text/plain
Expires
Thu, May 21, 6:29 AM (6 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28756134
Default Alt Text
D28639.1779344977.diff (795 B)

Event Timeline