View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000272 | AlmaLinux-9 | keepalived | public | 2022-06-27 10:19 | 2022-06-27 10:19 |
Reporter | PhilRandal | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
OS | AlmaLinux | OS Version | 9.0 | ||
Summary | 0000272: keepalived 2.2.4 doesn't correctly handle variable substitution in conditional lines | ||||
Description | man keepalived.conf clearly states " $IF_MAIN=@main $IF_MAIN priority 240 will produce: priority 240 if the config_id is main and nothing if the config_id is not main, although why anyone would want to use this rather than simply the following is not known (but still possible): @main priority 240 " Yet this does not work correctly under all circumstances. | ||||
Steps To Reproduce | set the following in keepalived.conf $PRI=@my-server-id $PRI priority 240 on expansion will produce garbled output Unknown keyword 'priorixxxx' where xxxx is trailing part of host name. Reproducible on both AlmaLinux 8.6 andd 9.0 | ||||
Additional Information | The reason is that after the variable value substitution, the line-length is not recalculated. Fix is to apply the following patch I've recalculated the buffer length at the head of the loop for obvious correctness and resilience in the case of future code changes --- a/lib/parser.c 2022-06-27 08:58:01.163365991 +0100 +++ b/lib/parser.c 2022-06-27 09:05:08.456532867 +0100 @@ -2735,7 +2735,8 @@ do { recheck = false; - if (buf[0] == '@') { + len = strlen(buf); + if (buf[0] == '@') { /* If the line starts '@', check the following word matches the system id. @^ reverses the sense of the match */ if (buf[1] == '^') { | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2022-06-27 10:19 | PhilRandal | New Issue |