Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ifconfig Fix parser for carp state.



details:   https://anonhg.NetBSD.org/src/rev/2313b454264d
branches:  trunk
changeset: 374029:2313b454264d
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Mar 26 01:04:16 2023 +0000

description:
Fix parser for carp state.
The state values are uppercase words INIT, BACKUP and MASTER.

diffstat:

 sbin/ifconfig/carp.c     |  16 +++++++++++-----
 sbin/ifconfig/ifconfig.8 |   8 ++++----
 2 files changed, 15 insertions(+), 9 deletions(-)

diffs (61 lines):

diff -r 0a6ef94fe260 -r 2313b454264d sbin/ifconfig/carp.c
--- a/sbin/ifconfig/carp.c      Sat Mar 25 21:51:12 2023 +0000
+++ b/sbin/ifconfig/carp.c      Sun Mar 26 01:04:16 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: carp.c,v 1.14 2020/06/07 06:02:58 thorpej Exp $ */
+/* $NetBSD: carp.c,v 1.15 2023/03/26 01:04:16 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: carp.c,v 1.14 2020/06/07 06:02:58 thorpej Exp $");
+__RCSID("$NetBSD: carp.c,v 1.15 2023/03/26 01:04:16 mlelstv Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -67,10 +67,16 @@ static int setcarpdev(prop_dictionary_t,
 
 static const char *carp_states[] = { CARP_STATES };
 
+/* from if_carp.c */
+enum carpstateval { INIT = 0, BACKUP, MASTER };
+
 struct kwinst carpstatekw[] = {
-         {.k_word = "INIT", .k_nextparser = &command_root.pb_parser}
-       , {.k_word = "BACKUP", .k_nextparser = &command_root.pb_parser}
-       , {.k_word = "MASTER", .k_nextparser = &command_root.pb_parser}
+         {.k_word = "INIT", .k_type = KW_T_INT, .k_int = INIT,
+          .k_nextparser = &command_root.pb_parser}
+       , {.k_word = "BACKUP", .k_type = KW_T_INT, .k_int = BACKUP,
+          .k_nextparser = &command_root.pb_parser}
+       , {.k_word = "MASTER", .k_type = KW_T_INT, .k_int = MASTER,
+          .k_nextparser = &command_root.pb_parser}
 };
 
 struct pinteger parse_advbase = PINTEGER_INITIALIZER1(&parse_advbase, "advbase",
diff -r 0a6ef94fe260 -r 2313b454264d sbin/ifconfig/ifconfig.8
--- a/sbin/ifconfig/ifconfig.8  Sat Mar 25 21:51:12 2023 +0000
+++ b/sbin/ifconfig/ifconfig.8  Sun Mar 26 01:04:16 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ifconfig.8,v 1.124 2022/11/25 08:41:05 knakahara Exp $
+.\"    $NetBSD: ifconfig.8,v 1.125 2023/03/26 01:04:16 mlelstv Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -315,10 +315,10 @@ Explicitly force the
 .Xr carp 4
 pseudo-device to enter this state.
 Valid states are
-.Ar init ,
-.Ar backup ,
+.Ar INIT ,
+.Ar BACKUP ,
 and
-.Ar master .
+.Ar MASTER .
 .It Cm frag Ar threshold
 .Pq IEEE 802.11 devices only
 Configure the fragmentation threshold for IEEE 802.11-based wireless



Home | Main Index | Thread Index | Old Index