summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-11-27 11:34:19 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-11-27 11:34:19 +0000
commitf574bf4c59beb364cf0b5cf0dd9ebea09f5b4afe (patch)
tree9fc4649b98a27f2b83038db7f0aacaa6ff3cbb20
parent46b3cdc6bb6bf33b0c4e39472b98f8cb224ebbdc (diff)
Make carp(4) behave more like a ethernet interface by initalizing the
IPv4 interface address similar to arp_ifinit(). The main difference is that we do not send out a gracious arp as the carp(4) is not ready to send at that moment. This will make backup interface show up like the master ones. OK mpf@ earlier version OK henning@ mcbride@
-rw-r--r--sys/netinet/ip_carp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 05e837d3d42..97f5cab752f 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.157 2007/11/26 17:26:25 chl Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.158 2007/11/27 11:34:18 claudio Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -2236,8 +2236,13 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr)
#ifdef INET
case AF_INET:
sc->sc_if.if_flags |= IFF_UP;
- bcopy(ifa->ifa_addr, ifa->ifa_dstaddr,
- sizeof(struct sockaddr));
+ /*
+ * emulate arp_ifinit() without doing a gratious arp
+ * request so that the routes are setup correctly.
+ */
+ ifa->ifa_rtrequest = arp_rtrequest;
+ ifa->ifa_flags |= RTF_CLONING;
+
error = carp_set_addr(sc, satosin(ifa->ifa_addr));
break;
#endif /* INET */