sgwdynspeed: ignore everything we don't understand when reading the file
authorFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 17 Feb 2014 23:05:40 +0000 (00:05 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 17 Feb 2014 23:15:38 +0000 (00:15 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/sgwdynspeed/src/speedFile.c

index b78865c..e005b1e 100644 (file)
@@ -219,9 +219,9 @@ void readSpeedFile(char * fileName) {
                }
 
                if (!regexMatch(&regexNameValue, line, regexNameValuematchCount, pmatch)) {
-                       sgwDynSpeedError(false, "Gateway speed file \"%s\", line %d uses invalid syntax: %s", fileName, lineNumber,
+                       sgwDynSpeedError(false, "Gateway speed file \"%s\", line %d uses invalid syntax: ignored (%s)", fileName, lineNumber,
                                        line);
-                       goto out;
+                       continue;
                }
 
                stripEols(line);
@@ -234,14 +234,20 @@ void readSpeedFile(char * fileName) {
 
                if (!strncasecmp(SPEED_UPLINK_NAME, name, sizeof(line))) {
                        if (!readUL(SPEED_UPLINK_NAME, value, &uplink)) {
-                               goto out;
+                               sgwDynSpeedError(false, "Gateway speed file \"%s\", line %d: %s value \"%s\" is not a valid number: ignored",
+                                       fileName, lineNumber, SPEED_UPLINK_NAME, value);
+                               reportedErrors = true;
+                       } else {
+                               uplinkSet = true;
                        }
-                       uplinkSet = true;
                } else if (!strncasecmp(SPEED_DOWNLINK_NAME, name, sizeof(line))) {
                        if (!readUL(SPEED_DOWNLINK_NAME, value, &downlink)) {
-                               goto out;
+                               sgwDynSpeedError(false, "Gateway speed file \"%s\", line %d: %s value \"%s\" is not a valid number: ignored",
+                                       fileName, lineNumber, SPEED_DOWNLINK_NAME, value);
+                               reportedErrors = true;
+                       } else {
+                               downlinkSet = true;
                        }
-                       downlinkSet = true;
                } else {
                  if (!reportedErrorsPrevious) {
                    sgwDynSpeedError(false, "Gateway speed file \"%s\", line %d specifies an unknown option \"%s\": ignored",