summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-03-04 14:38:24 +0100
committerJiří Klimeš <jklimes@redhat.com>2015-03-04 14:56:41 +0100
commitcddb7cb7b1cde92bd7f21a77dee61b0b3eb471eb (patch)
treef5598cc46ac6de55ea619de559085c418e9db391
parentf22b86f4d1bc2b1c6dd0b384db2aa5d57c530518 (diff)
downloadnetwork-manager-applet-cddb7cb7b1cde92bd7f21a77dee61b0b3eb471eb.tar.gz
editor: don't allow zero prefix for IP routes
-rw-r--r--src/connection-editor/ip4-routes-dialog.c2
-rw-r--r--src/connection-editor/ip6-routes-dialog.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/connection-editor/ip4-routes-dialog.c b/src/connection-editor/ip4-routes-dialog.c
index e93c3c9d..92654462 100644
--- a/src/connection-editor/ip4-routes-dialog.c
+++ b/src/connection-editor/ip4-routes-dialog.c
@@ -426,7 +426,7 @@ cell_changed_cb (GtkEditable *editable,
/* Is it a prefix? */
if (!strchr (cell_text, '.')) {
tmp_prefix = strtol (cell_text, NULL, 10);
- if (*cell_text && !errno && tmp_prefix <= 32)
+ if (*cell_text && !errno && tmp_prefix > 0 && tmp_prefix <= 32)
value_valid = TRUE;
} else {
struct in_addr tmp_addr;
diff --git a/src/connection-editor/ip6-routes-dialog.c b/src/connection-editor/ip6-routes-dialog.c
index 9bad6933..29108c7c 100644
--- a/src/connection-editor/ip6-routes-dialog.c
+++ b/src/connection-editor/ip6-routes-dialog.c
@@ -138,7 +138,8 @@ validate (GtkWidget *dialog)
g_free (dest);
/* Prefix */
- if (!get_one_int (model, &tree_iter, COL_PREFIX, 128, TRUE, &prefix))
+ if ( !get_one_int (model, &tree_iter, COL_PREFIX, 128, TRUE, &prefix)
+ || prefix == 0)
goto done;
/* Next hop (optional) */
@@ -379,7 +380,7 @@ cell_changed_cb (GtkEditable *editable,
errno = 0;
tmp_int = strtol (cell_text, NULL, 10);
- if (!*cell_text || errno || tmp_int < 0 || tmp_int > 128)
+ if (!*cell_text || errno || tmp_int < 1 || tmp_int > 128)
value_valid = FALSE;
else
value_valid = TRUE;
@@ -788,7 +789,8 @@ ip6_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIPConfig *s_ip6)
}
/* Prefix */
- if (!get_one_int (model, &tree_iter, COL_PREFIX, 128, TRUE, &prefix)) {
+ if ( !get_one_int (model, &tree_iter, COL_PREFIX, 128, TRUE, &prefix)
+ || prefix == 0) {
g_warning ("%s: IPv6 prefix missing or invalid!", __func__);
g_free (dest);
goto next;