Skip to contentSkip to conversation

IPROUTE: tc correct error message

PATCH In review Marcela Maslanova 2 participants 2 messages Sep 22, 2008 – Oct 13, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IPROUTE: tc correct error message

This warning message was removed in change 083a5f00a15f6506815b0da2be82e7be761c5cbc In this patch is checked, whether warning should be printed. Output
of "tc filter <type> help" isn't spoiled after my change.

Signature · 2 lines
Marcela Mašláňová
BaseOS team Brno
Quoted 1 line

From e007577ef506671896857808634f3326d69b5072 Mon Sep 17 00:00:00 2001

From: =?utf-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= <[email protected]>
Date: Mon, 22 Sep 2008 15:41:04 +0200
Subject: [PATCH] tc error message: protocol is needed.
This message was removed in change 083a5f00a15f6506815b0da2be82e7be761c5cbc but now it's checked, whether it should be print and don't spoil help messages.

---
 tc/tc_filter.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
tc/tc_filter.c +7 -1
index 177446e..ce30dd9 100644
@@ -120,7 +120,9 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 			if (parse_estimator(&argc, &argv, &est) < 0)
 				return -1;
 		} else if (matches(*argv, "help") == 0) {
+			protocol_set = 1;
 			usage();
+			return 0;
 		} else {
 			strncpy(k, *argv, sizeof(k)-1);
 
@@ -128,7 +130,6 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 			argc--; argv++;
 			break;
 		}
-
 		argc--; argv++;
 	}
 
@@ -153,6 +154,11 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 			return -1;
 		}
 	}
+	if (!protocol_set) {
+		fprintf(stderr, "\"protocol\" is required.\n");
+		return -1;
+	}
+
 	if (est.ewma_log)
 		addattr_l(&req.n, sizeof(req), TCA_RATE, &est, sizeof(est));
 
Signature · 1 line
1.5.5.2
#1 lore raw

This warning message was removed in change 083a5f00a15f6506815b0da2be82e7be761c5cbc
In this patch is checked, whether warning should be printed. Output of "tc filter <type> help" isn't spoiled after my change.

Signature · 2 lines
Actually, protocol is not required. It defaults to all.
But I did go ahead and make help just return.