Solved [Solved] How to apply a patch

Hello everyone,

I just hit Bug 185967 (Link Aggregation LAGG: LACP not working in 10.0).
Comment 6 in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=185967 do offer the following patch to correct the problem

Code:
Index: ieee8023ad_lacp.c
===================================================================
--- ieee8023ad_lacp.c	(revision 261432)
+++ ieee8023ad_lacp.c	(working copy)
@@ -192,6 +192,11 @@
 SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN,
     &lacp_debug, 0, "Enable LACP debug logging (1=debug, 2=trace)");
 TUNABLE_INT("net.link.lagg.lacp.debug", &lacp_debug);
+static int lacp_strict = 0;
+SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, lacp_strict_mode,
+    CTLFLAG_RW | CTLFLAG_TUN, &lacp_strict, 0,
+    "Enable LACP strict protocol compliance");
+TUNABLE_INT("net.link.lagg.lacp.lacp_strict_mode", &lacp_strict);

 #define LACP_DPRINTF(a) if (lacp_debug & 0x01) { lacp_dprintf a ; }
 #define LACP_TRACE(a) if (lacp_debug & 0x02) { lacp_dprintf(a,"%s\n",__func__); }
@@ -791,7 +796,7 @@

 	lsc->lsc_hashkey = arc4random();
 	lsc->lsc_active_aggregator = NULL;
-	lsc->lsc_strict_mode = 1;
+	lsc->lsc_strict_mode = lacp_strict;
 	LACP_LOCK_INIT(lsc);
 	TAILQ_INIT(&lsc->lsc_aggregators);
 	LIST_INIT(&lsc->lsc_ports);
But I have no idea on how to apply it.
I guess that I need to copy the text into a file on my FreeBSD server but I don't know what file extension to give it or how to run it.
is
Code:
Index: ieee8023ad_lacp.c
, the file name?

Could someone advise please

Thank you
 
Re: How to apply a patch

Hi @SirDice
Here is what I did so far...
I created a fil called /home/admin/lacp.patch with the following text:
Code:
Index: ieee8023ad_lacp.c
===================================================================
--- ieee8023ad_lacp.c	(revision 261432)
+++ ieee8023ad_lacp.c	(working copy)
@@ -192,6 +192,11 @@
 SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN,
     &lacp_debug, 0, "Enable LACP debug logging (1=debug, 2=trace)");
 TUNABLE_INT("net.link.lagg.lacp.debug", &lacp_debug);
+static int lacp_strict = 0;
+SYSCTL_INT(_net_link_lagg_lacp, OID_AUTO, lacp_strict_mode,
+    CTLFLAG_RW | CTLFLAG_TUN, &lacp_strict, 0,
+    "Enable LACP strict protocol compliance");
+TUNABLE_INT("net.link.lagg.lacp.lacp_strict_mode", &lacp_strict);

 #define LACP_DPRINTF(a) if (lacp_debug & 0x01) { lacp_dprintf a ; }
 #define LACP_TRACE(a) if (lacp_debug & 0x02) { lacp_dprintf(a,"%s\n",__func__); }
@@ -791,7 +796,7 @@

 	lsc->lsc_hashkey = arc4random();
 	lsc->lsc_active_aggregator = NULL;
-	lsc->lsc_strict_mode = 1;
+	lsc->lsc_strict_mode = lacp_strict;
 	LACP_LOCK_INIT(lsc);
 	TAILQ_INIT(&lsc->lsc_aggregators);
 	LIST_INIT(&lsc->lsc_ports);
Then, I did cd /usr/src and patch -C < /home/admin/lacp.patch.
I was then asked for the file to patch:
Code:
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: ieee8023ad_lacp.c
|===================================================================
|--- ieee8023ad_lacp.c  (revision 261432)
|+++ ieee8023ad_lacp.c  (working copy)
--------------------------
File to patch:

What file do I need to patch? Do I type ieee8023ad_lacp.c ?

Sorry to bug you guys. I really appreciate the help here.

Fred
 
Last edited by a moderator:
Re: How to apply a patch

Looks like the patch was made in the directory itself, not the root of the source tree. You need to find the ieee8023ad_lacp.c file in the source tree. Then run patch(1) in the same directory.
 
Re: How to apply a patch

sudo find / -name 'ieee8023ad_lacp.c'
Code:
/usr/src/sys/net/ieee8023ad_lacp.c
cd /usr/src/sys/net/
patch -C < /home/sysadmin/lacp.patch
Code:
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: ieee8023ad_lacp.c
|===================================================================
|--- ieee8023ad_lacp.c  (revision 261432)
|+++ ieee8023ad_lacp.c  (working copy)
--------------------------
Patching file ieee8023ad_lacp.c using Plan A...
Hunk #1 succeeded at 192.
Hunk #2 succeeded at 796.
done

So that mean that I cann now remove the -C flag and good to go?
Do I meed to do make buildworldafter?
 
Re: How to apply a patch

fred974 said:
So that mean that I cann now remove the -C flag and good to go?
Yes, it looks good.

Do I meed to do make buildworldafter?
Probably not but you do need to rebuild the kernel obviously.
 
Back
Top