Carp on vlan with em driver

Yar Tikhiy yar at comp.chem.msu.su
Mon Mar 6 10:47:45 PST 2006


On Mon, Mar 06, 2006 at 11:59:08AM -0500, Christopher McGee wrote:
> Yar Tikhiy wrote:
> 
> >On Fri, Mar 03, 2006 at 12:03:45PM -0500, Christopher McGee wrote:
> > 
> >
> >>Carp, vlans, and em is still not supported in 5.4 release, but I have 
> >>read about a patch that works.  Can anyone point me in the right 
> >>direction.
> >>   
> >>
> >
> >http://docs.freebsd.org/cgi/getmsg.cgi?fetch=25292+0+/usr/local/www/db/text/2005/freebsd-net/20050424.freebsd-net+raw
> >
> > 
> >
> I have run this patch and when it asks for the file to be patched, I 
> specify /usr/src/sys/dev/em/if_em.c and I get the following output:
> 
> File to patch: sys/dev/em/if_em.c
> Patching file sys/dev/em/if_em.c using Plan A...
> patch: **** malformed patch at line 23: @@ -1681,6 +1687,13 @@
> 
> Am I doing something wrong?

The patch in the posting seems just broken by some mail software
or whatever.  Here's the diff from my local CVS I used to use in
RELENG_5 almost a year ago.  I have no idea if it will work for you.
Be prepared to apply it by hand, should it fail to apply via patch.
It's rather small though.

-- 
Yar

Index: if_em.c
===================================================================
RCS file: /home/ncvs/freebsd/src/sys/dev/em/if_em.c,v
retrieving revision 1.1.1.3
retrieving revision 1.4
diff -u -r1.1.1.3 -r1.4
--- if_em.c	19 May 2005 14:45:48 -0000	1.1.1.3
+++ if_em.c	19 May 2005 15:39:06 -0000	1.4
@@ -1666,6 +1666,10 @@
 	return;
 }
 
+#ifdef DEV_CARP /* XXX */
+extern  void (*vlan_link_state_p)(struct ifnet *, int);
+#endif
+
 static void
 em_print_link_status(struct adapter * adapter)
 {
@@ -1685,6 +1689,8 @@
 			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
@@ -1697,6 +1703,8 @@
 			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();


More information about the freebsd-net mailing list