The vlan(4) device is not yet officially supported for carp(4). It works for NICs which talks to mii, but cards such as em(4) could get problems.
Thanks to Max Laier, Gleb Smirnoff and Yar Tikhiy which supplied me the following patch. It solved my problem with CARP, VLANs and the em(4) driver.. thanks guys! Index: if_em.c =================================================================== RCS file: /home/ncvs/freebsd/src/sys/dev/em/if_em.c,v retrieving revision 1.1.1.2 retrieving revision 1.3 diff -u -r1.1.1.2 -r1.3 --- if_em.c 20 Mar 2005 13:23:44 -0000 1.1.1.2 +++ if_em.c 21 Mar 2005 12:23:02 -0000 1.3 @@ -1666,9 +1666,15 @@ return; } +#ifdef DEV_CARP /* XXX */ +extern void (*vlan_link_state_p)(struct ifnet *, int); #endif + static void em_print_link_status(struct adapter * adapter) { + struct ifnet *ifp = &adapter->interface_data.ac_if; + if (E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU) { if (adapter->link_active == 0) { em_get_speed_and_duplex(&adapter->hw, @@ -1681,6 +1687,13 @@ "Full Duplex" : "Half Duplex")); adapter->link_active = 1; adapter->smartspeed = 0; + ifp->if_link_state = LINK_STATE_UP; +#ifdef DEV_CARP + if (ifp->if_nvlans != 0) + (*vlan_link_state_p)(ifp, NOTE_LINKUP); /* XXX */ + if (ifp->if_carp) + carp_carpdev_state(ifp->if_carp); +#endif } } else { if (adapter->link_active == 1) { @@ -1688,6 +1701,13 @@ adapter->link_duplex = 0; printf("em%d: Link is Down\n", adapter->unit); adapter->link_active = 0; + ifp->if_link_state = LINK_STATE_DOWN; #ifdef DEV_CARP + if (ifp->if_nvlans != 0) + (*vlan_link_state_p)(ifp, NOTE_LINKDOWN); /* XXX */ + if (ifp->if_carp) + carp_carpdev_state(ifp->if_carp); +#endif } } Index: if_vlan.c =================================================================== RCS file: /home/ncvs/freebsd/src/sys/net/if_vlan.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- if_vlan.c 20 Mar 2005 13:25:00 -0000 1.1.1.2 +++ if_vlan.c 21 Mar 2005 12:23:06 -0000 1.2 @@ -41,6 +41,7 @@ * and ask it to send them. */ +#include "opt_carp.h" #include "opt_inet.h" #include <sys/param.h> @@ -67,6 +68,11 @@ #ifdef INET #include <netinet/in.h> #include <netinet/if_ether.h> + +#ifdef DEV_CARP +#include <netinet/in_var.h> +#include <netinet/ip_carp.h> +#endif #endif #define VLANNAME "vlan" @@ -822,6 +828,10 @@ ifv->ifv_if.if_link_state = ifv->ifv_p->if_link_state; rt_ifmsg(&(ifv->ifv_if)); KNOTE_UNLOCKED(&ifp->if_klist, link); +#ifdef DEV_CARP + if (ifv->ifv_if.if_carp) + carp_carpdev_state(ifv->ifv_if.if_carp); +#endif } } VLAN_UNLOCK(); -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eivind Hestnes Sent: Sunday, April 17, 2005 4:02 PM To: [EMAIL PROTECTED] Subject: Problems with CARP, VLANs and em driver Hi, I recently configured two FreeBSD 5.3 (with XL 3c905C NIC) boxes to act as one logic router (preemption) between multiple VLANs. The router has now been in production for four weeks (under heavy load, too), and I have not run into any problems what-so-ever. Failover is almost transparent, and the robustness is awesome. All in all, i'm very happy with CARP. But to provide more bandwidth to our users, I bought a Intel Pro 1000 MT (PWLA8490MT) to replace the 3Com 905c card in the master. With some hacking, I managed to get the Intel card to talk with the VLANs (had to disable VLAN hardware tagging, as this didn't work with promiscuous mode). The problem however, is that the CARP interfaces on the master does not change mode from INIT to MASTER with the Intel card installed. In other words; the master do not replace the slave. I have tried the 2.0.5 em driver from Intel (instead of the 1.7.35), but with no success. Is there some problems with the em driver and CARP, or must the master and slave have identical NICs? Regards, Eivind Hestnes _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]" _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"