The following reply was made to PR user/6509; it has been noted by GNATS.

From: Stuart Henderson <s...@spacehopper.org>
To: gn...@openbsd.org
Cc: Jonathan Gray <j...@goblin.cx>, Reyk Floeter <r...@openbsd.org>
Subject: Re: user/6509: relayctl show sessions make relayd crash
Date: Wed, 18 May 2011 15:30:58 +0100

 jsg@ wrote on 2010-11-18:
 > The problem is we have multiple handlers and get
 > IMSG_STATISTICS when in the secondary handler.
 > 
 > Try the following diff from reyk:
 
 This still occurs with up-to-date relayd; here is an updated
 version of this diff (applies on top of the current reload diff)a
 which fixes the problem for me.
 
 Index: relay.c
 ===================================================================
 RCS file: /cvs/src/usr.sbin/relayd/relay.c,v
 retrieving revision 1.136
 diff -u -p -r1.136 relay.c
 --- relay.c    9 May 2011 12:08:47 -0000       1.136
 +++ relay.c    18 May 2011 14:26:45 -0000
 @@ -450,10 +450,12 @@ relay_statistics(int fd, short events, v
                if (resetday)
                        cur->last_day = 0;
  
 -              crs.id = rlay->rl_conf.id;
 -              crs.proc = proc_id;
 -              proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_STATISTICS, -1,
 -                  &crs, sizeof(crs));
 +              if (!env->sc_statstop) {
 +                      crs.id = rlay->rl_conf.id;
 +                      crs.proc = proc_id;
 +                      proc_compose_imsg(env->sc_ps, PROC_PFE, -1,
 +                          IMSG_STATISTICS, -1, &crs, sizeof(crs));
 +              }
  
                for (con = SPLAY_ROOT(&rlay->rl_sessions);
                    con != NULL; con = next_con) {
 @@ -2489,6 +2491,7 @@ relay_dispatch_pfe(int fd, struct privse
                evtimer_add(&con->se_ev, &tv);
                break;
        case IMSG_CTL_SESSION:
 +              env->sc_statstop = 1;
                TAILQ_FOREACH(rlay, env->sc_relays, rl_entry) {
                        SPLAY_FOREACH(con, session_tree,
                            &rlay->rl_sessions) {
 @@ -2499,6 +2502,7 @@ relay_dispatch_pfe(int fd, struct privse
                }
                proc_compose_imsg(env->sc_ps, p->p_id, -1, IMSG_CTL_END,
                    -1, NULL, 0);
 +              env->sc_statstop = 0;
                break;
        default:
                return (-1);
 Index: relayd.h
 ===================================================================
 RCS file: /cvs/src/usr.sbin/relayd/relayd.h,v
 retrieving revision 1.146
 diff -u -p -r1.146 relayd.h
 --- relayd.h   9 May 2011 12:08:47 -0000       1.146
 +++ relayd.h   18 May 2011 14:26:45 -0000
 @@ -829,6 +829,7 @@ struct relayd {
  
        struct event             sc_statev;
        struct timeval           sc_statinterval;
 +      int                      sc_statstop;
  
        int                      sc_snmp;
        struct event             sc_snmpto;

Reply via email to