From: Krzysztof Piotr Oledzki Date: Fri, 5 Feb 2010 19:58:27 +0000 (+0100) Subject: [BUG] pxid/puid/luid: don't shift IDs when some of them are forced X-Git-Tag: v1.4.0~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df5cb9f764e2972264e6f46053f984e7b675aabb;p=thirdparty%2Fhaproxy.git [BUG] pxid/puid/luid: don't shift IDs when some of them are forced [WT: it was not a bug, I did it on purpose to leave no hole between IDs, though it's not very practical when admins want to force some entries after they have been used, because they'd rather leave a hole than renumber everything ] Forcing some of IDs should not shift others. Regression introduced in 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5 ---cut here--- global stats socket /home/ole/haproxy.stat user ole group ole mode 660 frontend F1 bind 127.0.0.1:9999 mode http backend B1 mode http backend B2 mode http id 9999 backend B3 mode http backend B4 mode http ---cut here--- Before 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5: $ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28 iid 1 2 9999 4 5 After 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5: $ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28 iid 1 2 9999 3 4 With this patch: $ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28 iid 1 2 9999 4 5 --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 2980ae10de..9bdfb3e3d5 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -4493,8 +4493,9 @@ int check_config_validity() next_pxid = get_next_id(&used_proxy_id, next_pxid); curproxy->conf.id.key = curproxy->uuid = next_pxid; eb32_insert(&used_proxy_id, &curproxy->conf.id); - next_pxid++; } + next_pxid++; + if (curproxy->state == PR_STSTOPPED) { /* ensure we don't keep listeners uselessly bound */ @@ -4914,8 +4915,8 @@ out_uri_auth_compat: next_id = get_next_id(&curproxy->conf.used_server_id, next_id); newsrv->conf.id.key = newsrv->puid = next_id; eb32_insert(&curproxy->conf.used_server_id, &newsrv->conf.id); - next_id++; } + next_id++; if ((curproxy->mode != PR_MODE_HTTP) && (newsrv->rdr_len || newsrv->cklen)) { Alert("config : %s '%s' : server cannot have cookie or redirect prefix in non-HTTP mode.\n", @@ -5067,8 +5068,8 @@ out_uri_auth_compat: next_id = get_next_id(&curproxy->conf.used_listener_id, next_id); listener->conf.id.key = listener->luid = next_id; eb32_insert(&curproxy->conf.used_listener_id, &listener->conf.id); - next_id++; } + next_id++; /* enable separate counters */ if (curproxy->options2 & PR_O2_SOCKSTAT) {