[Bug 213410] [carp] service netif restart causes hang only when carp is enabled

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 25 16:05:00 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213410

Kristof Provost <kp at freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kp at freebsd.org

--- Comment #1 from Kristof Provost <kp at freebsd.org> ---
I’ve had a very quick look, and at first glance it seems like an overly strict
KASSERT() more than anything else.
Basically, during service netif restart the scripts try to set up carp on an
address that’s already got it configured. That runs into the assert and panics
the box (or actually panics later on if INVARIANTS is not set).

Simply replacing the KASSERT with a check (and returning errors) prevents the
panic.
I don’t have a carp test setup, but this should make things a lot better
already.

Can you check if this works for you?

diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index
7855af2..ea27f0a 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1804,7 +1804,8 @@ carp_attach(struct ifaddr *ifa, int vhid)
        struct carp_softc *sc;
        int index, error;

-       KASSERT(ifa->ifa_carp == NULL, ("%s: ifa %p attached", __func__, ifa));
+       if (ifa->ifa_carp != NULL)
+               return (EBUSY);

        switch (ifa->ifa_addr->sa_family) {
 #ifdef INET

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-net mailing list