LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0016-teamd_link_watch-allow-to-send-ARP-probes-if-no-sour.patch of Package libteam (Project home:ods:ppc64)

From d61e9e1f45cee1d134cc5d67144428f94f87459d Mon Sep 17 00:00:00 2001
From: Jiri Pirko <jiri@resnulli.us>
Date: Fri, 28 Mar 2014 14:08:28 +0100
Subject: [patch libteam 1/4] teamd_link_watch: allow to send ARP probes if no
 source_host is specified

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 man/teamd.conf.5         |  8 +++++---
 teamd/teamd_link_watch.c | 14 ++++++++------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/man/teamd.conf.5 b/man/teamd.conf.5
index 643354e..b1dca1a 100644
--- a/man/teamd.conf.5
+++ b/man/teamd.conf.5
@@ -304,6 +304,11 @@ Maximum number of missed ARP replies. If this number is exceeded, link is report
 .TP
 .BR "link_watch.source_host "| " ports.PORTIFNAME.link_watch.source_host " (int)
 Hostname to be converted to IP address which will be filled into ARP request as source address.
+.RS 7
+.PP
+Default:
+.BR "0.0.0.0"
+.RE
 .TP
 .BR "link_watch.target_host "| " ports.PORTIFNAME.link_watch.target_host " (int)
 Hostname to be converted to IP address which will be filled into ARP request as destination address.
@@ -405,7 +410,6 @@ Similar to the previous one. Only difference is that link changes are not propag
     "name": "arp_ping",
     "interval": 100,
     "missed_max": 30,
-    "source_host": "192.168.23.2",
     "target_host": "192.168.23.1"
   },
   "ports": {
@@ -431,14 +435,12 @@ This configuration uses ARP ping link watch.
     "name": "arp_ping",
     "interval": 100,
     "missed_max": 30,
-    "source_host": "192.168.23.2",
     "target_host": "192.168.23.1"
   },
   {
     "name": "arp_ping",
     "interval": 50,
     "missed_max": 20,
-    "source_host": "192.168.24.2",
     "target_host": "192.168.24.1"
   }
 ],
diff --git a/teamd/teamd_link_watch.c b/teamd/teamd_link_watch.c
index d9332d1..a05058a 100644
--- a/teamd/teamd_link_watch.c
+++ b/teamd/teamd_link_watch.c
@@ -703,13 +703,15 @@ static int lw_ap_load_options(struct teamd_context *ctx,
 	int err;
 
 	err = teamd_config_string_get(ctx, &host, "@.source_host", cpcookie);
-	if (err) {
-		teamd_log_err("Failed to get \"source_host\" link-watch option.");
-		return -EINVAL;
+	if (!err) {
+		err = set_in_addr(&ap_ppriv->src, host);
+		if (err)
+			return err;
 	}
-	err = set_in_addr(&ap_ppriv->src, host);
-	if (err)
-		return err;
+	/*
+	 * If source_host is not provided, just use address 0.0.0.0 according
+	 * to RFC 5227 (IPv4 Address Conflict Detection).
+	 */
 	teamd_log_dbg("source address \"%s\".",
 		      str_in_addr(&ap_ppriv->src));
 
-- 
1.8.5.3