Including same directory twice is not working

classic Classic list List threaded Threaded
4 messages Options
| Threaded
Open this post in threaded view
|

Including same directory twice is not working

Chinnapaiyan, Nagamani
Hi,

I am using 4.0.x branch(#fed87e6406e291d472c20a5cabbe7324ce7148f2).

dhcp site file:
recv DHCP-Discover {
...
        $INCLUDE ${raddbdir}/dhcp-subconfigs/devstack01/ut/subconfigs_discover/
...
}
recv DHCP-Request {
...
        $INCLUDE ${raddbdir}/dhcp-subconfigs/devstack01/ut/subconfigs_request/
...
}
recv DHCP-Inform {
...
        $INCLUDE ${raddbdir}/dhcp-subconfigs/devstack01/ut/subconfigs/
...
}
recv DHCP-Release {
...
        $INCLUDE ${raddbdir}/dhcp-subconfigs/devstack01/ut/subconfigs/
...
}

All these ${raddbdir}/dhcp-subconfigs/devstack01/ut/subconfigs*/ directories have same files in them.
subconfigs:
1_biz.cfg  2_res.cfg  3_vut.cfg  4_sim.cfg  5_ut.cfg  6_simut.cfg

subconfigs_discover:
1_biz.cfg  2_res.cfg  3_vut.cfg  4_sim.cfg  5_ut.cfg  6_simut.cfg

subconfigs_request:
1_biz.cfg  2_res.cfg  3_vut.cfg  4_sim.cfg  5_ut.cfg  6_simut.cfg

If directory names are different (but same files in them), INCLUDE works without any problem. But if I include same directory twice it segfaults.

radius debug output:
# /usr/sbin/radiusd -X
Info  : FreeRADIUS Version 4.0.0
Info  : Copyright 1999-2019 The FreeRADIUS server project and contributors
Info  : There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
Info  : PARTICULAR PURPOSE
Info  : You may redistribute copies of FreeRADIUS under the terms of the
Info  : GNU General Public License
Info  : For more information about these matters, see the file named COPYRIGHT
Info  : Starting - reading configuration files ...
Debug : Including dictionary file "/etc/raddb/dictionary"
including configuration file /etc/raddb/radiusd.conf
including configuration file /etc/raddb/clients.conf
Including files in directory "/etc/raddb/mods-enabled/"
including configuration file /etc/raddb/mods-enabled/redis
including configuration file /etc/raddb/mods-enabled/redis_ippool
including configuration file /etc/raddb/mods-enabled/ldap
including configuration file /etc/raddb/mods-enabled/linelog_dhcp
including configuration file /etc/raddb/mods-enabled/dhcpv4
including configuration file /etc/raddb/mods-enabled/always
including configuration file /etc/raddb/mods-enabled/expr
Including files in directory "/etc/raddb/policy.d/"
including configuration file /etc/raddb/policy.d/abfab-tr
including configuration file /etc/raddb/policy.d/accounting
including configuration file /etc/raddb/policy.d/canonicalization
including configuration file /etc/raddb/policy.d/control
including configuration file /etc/raddb/policy.d/cui
including configuration file /etc/raddb/policy.d/debug
including configuration file /etc/raddb/policy.d/dhcp
including configuration file /etc/raddb/policy.d/eap
including configuration file /etc/raddb/policy.d/filter
including configuration file /etc/raddb/policy.d/operator-name
including configuration file /etc/raddb/policy.d/time
including configuration file /etc/raddb/policy.d/vendor
Including files in directory "/etc/raddb/sites-enabled/"
including configuration file /etc/raddb/sites-enabled/dhcp
Loaded module "proto_dhcpv4"
Including files in directory "/etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_discover/"
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_discover/1_biz.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_discover/2_res.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_discover/3_vut.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_discover/4_sim.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_discover/5_ut.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_discover/6_simut.cfg
Including files in directory "/etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_request/"
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_request/1_biz.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_request/2_res.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_request/3_vut.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_request/4_sim.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_request/5_ut.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs_request/6_simut.cfg
Including files in directory "/etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs/"
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs/1_biz.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs/2_res.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs/3_vut.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs/4_sim.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs/5_ut.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs/6_simut.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack08/ut/main.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack10/ut/main.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack01/host/main.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack08/host/main.cfg
including configuration file /etc/raddb/dhcp-subconfigs/devstack10/host/main.cfg
including configuration file /etc/raddb/dhcp-subconfigs/vasn-stackids-switch.out
Including files in directory "/etc/raddb/dhcp-subconfigs/devstack01/ut/subconfigs/"
CAUGHT SIGNAL: Segmentation fault
Backtrace of last 8 frames:
/usr/lib64/freeradius/libfreeradius-util.so(fr_fault+0x1ae)[0x7f0136607c2e]
/lib64/libpthread.so.0(+0xf5f0)[0x7f0134e595f0]
/lib64/libc.so.6(fgets+0x1b)[0x7f013467396b]
/usr/lib64/freeradius/libfreeradius-server.so(cf_file_read+0x30e)[0x7f0136ccf9de]
/usr/lib64/freeradius/libfreeradius-server.so(main_config_init+0x223)[0x7f0136ce8573]
/usr/sbin/radiusd(main+0x526)[0x4040d6]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f0134627505]
/usr/sbin/radiusd[0x404d6d]
No panic action set
_EXIT(139) CALLED src/lib/util/debug.c[920].  Last error was: Invalid attribute reference, missing '&' prefix

Regards,
Nagamani Chinnapaiyan

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Including same directory twice is not working

Alan DeKok-2
On Dec 2, 2019, at 7:53 AM, Chinnapaiyan, Nagamani <[hidden email]> wrote:
> If directory names are different (but same files in them), INCLUDE works without any problem. But if I include same directory twice it segfaults.

  I've pushed a fix.

  Alan DeKok.


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

RE: Including same directory twice is not working

Chinnapaiyan, Nagamani
In reply to this post by Chinnapaiyan, Nagamani
Thanks. It works now. However, behavior on order of reading the files in the directory changed.
If I have files in subconfigs/ directory as,
1.cfg
2.cfg
3.cfg

Previously, it included in the name order 1.cfg first and then 2.cfg and then 3.cfg.

Now it is including based on modification time order.

Is this change intentional? Is it is viable to change that ordering back to old one. I want to force certain ordering when including all files in a directory.

Regards,
Nagamani Chinnapaiyan
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Including same directory twice is not working

Alan DeKok-2
On Dec 4, 2019, at 9:25 AM, Chinnapaiyan, Nagamani <[hidden email]> wrote:
>
> Thanks. It works now. However, behavior on order of reading the files in the directory changed.

  The server reads files in the order that they occur in the directory.   Rewriting the files can change the order.

  i.e. the order is a function of the OS, not of FreeRADIUS.

> Is this change intentional? Is it is viable to change that ordering back to old one. I want to force certain ordering when including all files in a directory.

  Then include the files one by one.  That is the *only* way to ensure ordering.

  Alan DeKok.


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html