system/5051: ifstated cannot reload configuration upon failed reload

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

system/5051: ifstated cannot reload configuration upon failed reload

Michael Knudsen-3
>Number:         5051
>Category:       system
>Synopsis:       ifstated cannot reload configuration upon failed reload
>Confidential:   yes
>Severity:       serious
>Priority:       low
>Responsible:    bugs
>State:          open
>Quarter:        
>Keywords:      
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 12 12:10:02 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Michael Knudsen
>Release:        3.9-current
>Organization:
net
>Environment:
       
        System      : OpenBSD 3.9
        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
        ifstated cannot reload the configuration file if it was
        previously attempted to reload a broken configuration. This is
        because the error path in parse_config() doesn't reset the
        `errors' counter.
>How-To-Repeat:
1. break the config and SIGHUP ifstated
2. fix the config and SIGHUP ifstated

beta# cat g.conf
if_up = "de0.link.up"

state auto {
        set-state led-off
}

state led-on {
        init {
                run "gpioctl 20 1"
        }
        if ! $if_up
                set-state led-off
}

state led-off {
        init {
                run "gpioctl 20 0"
        }
        if $if_up
                set-state led-on
}
beta# ./obj/ifstated -vdf g.conf  
if_up = "de0.link.up"
ifstated: initial state: auto
ifstated: changing state to auto
ifstated: changing state to led-off
ifstated: running gpioctl 20 0
ifstated: started
^Z[1] + Suspended            ./obj/ifstated -vdf g.conf
beta# cat g.conf
if_up = "de0.link.up"

state auto {
        set-state led-off
        syntax error
}

state led-on {
        init {
                run "gpioctl 20 1"
        }
        if ! $if_up
                set-state led-off
}

state led-off {
        init {
                run "gpioctl 20 0"
        }
        if $if_up
                set-state led-on
}
beta# fg
./obj/ifstated -vdf g.conf

ifstated: reloading config
if_up = "de0.link.up"
g.conf:26: syntax error
ifstated: unable to reload config
^Z[1] + Suspended            ./obj/ifstated -vdf g.conf
beta# cat g.conf
if_up = "de0.link.up"

state auto {
        set-state led-off
}

state led-on {
        init {
                run "gpioctl 20 1"
        }
        if ! $if_up
                set-state led-off
}

state led-off {
        init {
                run "gpioctl 20 0"
        }
        if $if_up
                set-state led-on
}
beta# fg
./obj/ifstated -vdf g.conf
ifstated: reloading config
if_up = "de0.link.up"
ifstated: unable to reload config
>Fix:
Reset the `errors' counter in the error path:

Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/ifstated/parse.y,v
retrieving revision 1.11
diff -u -r1.11 parse.y
--- parse.y 20 Jan 2006 00:01:20 -0000 1.11
+++ parse.y 12 Mar 2006 11:42:22 -0000
@@ -675,6 +675,7 @@
 
  if (errors) {
  clear_config(conf);
+ errors = 0;
  return (NULL);
  }


>Release-Note:
>Audit-Trail:
>Unformatted: