LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0018-teamd_link_watch-specify-missed_max-option-default-v.patch of Package libteam (Project home:ods:ppc64)

From 0e7260e98d3c2ed67a0378f28f0eecbf73f468cf Mon Sep 17 00:00:00 2001
From: Jiri Pirko <jiri@resnulli.us>
Date: Fri, 28 Mar 2014 14:47:58 +0100
Subject: [patch libteam 3/4] teamd_link_watch: specify "missed_max" option
 default value

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 man/teamd.conf.5         | 10 ++++++++++
 teamd/teamd_link_watch.c | 15 ++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/man/teamd.conf.5 b/man/teamd.conf.5
index b1dca1a..f694757 100644
--- a/man/teamd.conf.5
+++ b/man/teamd.conf.5
@@ -301,6 +301,11 @@ Default:
 .TP
 .BR "link_watch.missed_max "| " ports.PORTIFNAME.link_watch.missed_max " (int)
 Maximum number of missed ARP replies. If this number is exceeded, link is reported as down.
+.RS 7
+.PP
+Default:
+.BR "3"
+.RE
 .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.
@@ -345,6 +350,11 @@ Value is a positive number in milliseconds. It is the delay between link watch i
 .TP
 .BR "link_watch.missed_max "| " ports.PORTIFNAME.link_watch.missed_max " (int)
 Maximum number of missed NA reply packets. If this number is exceeded, link is reported as down.
+.RS 7
+.PP
+Default:
+.BR "3"
+.RE
 .TP
 .BR "link_watch.target_host "| " ports.PORTIFNAME.link_watch.target_host " (int)
 Hostname to be converted to IPv6 address which will be filled into NS packet as target address.
diff --git a/teamd/teamd_link_watch.c b/teamd/teamd_link_watch.c
index a05058a..fa3703b 100644
--- a/teamd/teamd_link_watch.c
+++ b/teamd/teamd_link_watch.c
@@ -429,6 +429,7 @@ static int lw_psr_callback_socket(struct teamd_context *ctx, int events,
 }
 
 static const struct timespec lw_psr_default_init_wait = { 0, 1 };
+#define LW_PSR_DEFAULT_MISSED_MAX 3
 
 static int lw_psr_load_options(struct teamd_context *ctx,
 			       struct teamd_port *tdport,
@@ -455,13 +456,13 @@ static int lw_psr_load_options(struct teamd_context *ctx,
 	teamd_log_dbg("init_wait \"%d\".", timespec_to_ms(&psr_ppriv->init_wait));
 
 	err = teamd_config_int_get(ctx, &tmp, "@.missed_max", cpcookie);
-	if (err) {
-		teamd_log_err("Failed to get \"missed_max\" link-watch option.");
-		return -EINVAL;
-	}
-	if (tmp < 0) {
-		teamd_log_err("\"missed_max\" must not be negative number.");
-		return -EINVAL;
+	if (!err) {
+		if (tmp < 0) {
+			teamd_log_err("\"missed_max\" must not be negative number.");
+			return -EINVAL;
+		}
+	} else {
+		tmp = LW_PSR_DEFAULT_MISSED_MAX;
 	}
 	teamd_log_dbg("missed_max \"%d\".", tmp);
 	psr_ppriv->missed_max = tmp;
-- 
1.8.5.3