Migrating DHCP configuration from v3 to v4
I am migrating my dhcp setup from freeradius v3 into v4 and have some questions. In v3 there was a dedicated dhcp and dhcp-ippool mods-config/sql setup, where the sql_user_name was set to: sql_user_name = "%{control:DHCP-SQL-Option-Identifier}" and in my processing sections I have set the "control:DHCP-SQL-Option-Identifier" based on some custom logic. In v4 there is no such configuration, but the comments in ippool queries seem to suggest it can now all be done in one config. However when using ippool module in DHCP request processing, the %{User-Name} attribute (configured in sql_user_name) is not known and I have not found an alternative to DHCP-SQL-Option-Identifier attribute. What is the recommended way of migrating such configuration from v3 into v4? Thank you. -- Ludo Mikula
On Jun 29, 2023, at 12:17 PM, Ľudovít Mikula <ludovit.mikula@mikori.sk> wrote:
I am migrating my dhcp setup from freeradius v3 into v4 and have some questions.
Be aware that v4 might work, or might not.
In v3 there was a dedicated dhcp and dhcp-ippool mods-config/sql setup, where the sql_user_name was set to: sql_user_name = "%{control:DHCP-SQL-Option-Identifier}" and in my processing sections I have set the "control:DHCP-SQL-Option-Identifier" based on some custom logic.
That attribute no longer exists.
In v4 there is no such configuration, but the comments in ippool queries seem to suggest it can now all be done in one config.
However when using ippool module in DHCP request processing, the %{User-Name} attribute (configured in sql_user_name) is not known and I have not found an alternative to DHCP-SQL-Option-Identifier attribute.
You don't need to set that. See mods-config/sql/ippool/mysql/queries.conf. The sql_user_name configuration isn't used anywhere.
What is the recommended way of migrating such configuration from v3 into v4?
Don't port the configuration from v3 to v4. Read the v4 configuration, and do things the "new way". Alan DeKok.
Thank you for the insights! On 6/29/23 18:29, Alan DeKok wrote:
On Jun 29, 2023, at 12:17 PM, Ľudovít Mikula <ludovit.mikula@mikori.sk> wrote:
I am migrating my dhcp setup from freeradius v3 into v4 and have some questions.
Be aware that v4 might work, or might not.
Yes I'm aware and of course we'll test a specific commit and stick to it if it works :) I'm trying to wrap my head around the new way and after studying mods-config/sql/ippool/mysql/queries.conf a bit more, would it be something along: 1. create a copy of mods-available/sqlippool (fe. called dhcp_sqlippool) and set: - allocated_address_attr = dhcpv4.Your-IP-Address - owner = "%{Vendor-Specific.ADSL-Forum.Agent-Remote-ID}" - gateway = "%{dhcpv4.Gateway-IP-Address}" 2. in sites-available/dhcp determine pool name and run dhcp_sqlippool to allocate an IP address: &control.IP-Pool.Name := "determine pool name with some custom logic" if (!&control.IP-Pool.Name || &control.IP-Pool.Name == '') { do_not_respond return } dhcp_sqlippool 3. In sites-available/dhcp Request processing section set: if (ok) { &reply.Your-IP-Address := &Your-IP-Address } Ludo Mikula
Ok, I think I've got it working now, however I had to comment the message { } section completely otherwise I was getting this crash no matter whether a variable was used in the message or not): freeradius | Thu Jun 29 18:24:41 2023: Debug : (0) dhcp_sqlippool - Allocated IP 10.56.18.1 freeradius | Thu Jun 29 18:24:41 2023: Debug : (0) dhcp_sqlippool - Released connection (0) freeradius | FATAL ASSERT src/lib/util/pair.c[2975]: false: CONSISTENCY CHECK FAILED src/lib/util/pair.c[2580]: fr_pair_t "Module-Success-Message" char buffer is not parented by fr_pair_t 0x5639b88c1aa0, instead parented by 0x5639b88a9640 (request_t) freeradius | CAUGHT SIGNAL: Aborted freeradius | /opt/freeradius/lib/libfreeradius-util.so(_fr_exit+0x0)[0x7fd5e3402241] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_pair_verify+0x5ca)[0x7fd5e344ec85] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_pair_value_bstrdup_buffer_shallow+0xcb)[0x7fd5e344dcc4] freeradius | /opt/freeradius/lib/rlm_sqlippool.so(+0x33e3)[0x7fd5e0dcb3e3] freeradius | /opt/freeradius/lib/rlm_sqlippool.so(+0x3f72)[0x7fd5e0dcbf72] freeradius | /opt/freeradius/lib/libfreeradius-unlang.so(+0x3da34)[0x7fd5e31baa34] freeradius | /opt/freeradius/lib/libfreeradius-unlang.so(unlang_interpret+0x8f3)[0x7fd5e31af3f8] freeradius | /opt/freeradius/lib/libfreeradius-io.so(fr_worker_post_event+0x11b)[0x7fd5e31668ec] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_event_service+0xb52)[0x7fd5e342da8c] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_event_loop+0x67)[0x7fd5e342db9f] freeradius | /opt/freeradius/lib/libfreeradius-server.so(main_loop_start+0x2e)[0x7fd5e32b47e9] freeradius | /opt/freeradius/sbin/radiusd(main+0x1696)[0x5639b601623b] freeradius | /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7fd5e2f2fd90] freeradius | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7fd5e2f2fe40] freeradius | /opt/freeradius/sbin/radiusd(_start+0x25)[0x5639b6014485] freeradius | No panic action set freeradius | _EXIT(134) CALLED src/lib/util/debug.c[1058] freeradius | ASSERT FAILED src/lib/server/module.c[571]: found == 0: Thread local array has 68 non-null elements remaining on exit. This is a leak freeradius | CAUGHT SIGNAL: Aborted freeradius | Backtrace of last 36 frames: freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_fault+0x10a)[0x7fd5e34012c3] freeradius | /opt/freeradius/lib/libfreeradius-util.so(_fr_assert_fail+0x10a)[0x7fd5e34020d5] freeradius | /opt/freeradius/lib/libfreeradius-server.so(+0x6c499)[0x7fd5e32c6499] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x1ec09)[0x7fd5e33f2c09] freeradius | /lib/x86_64-linux-gnu/libtalloc.so.2(+0x44b8)[0x7fd5e31324b8] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x1eb83)[0x7fd5e33f2b83] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x1f4f8)[0x7fd5e33f34f8] freeradius | /lib/x86_64-linux-gnu/libtalloc.so.2(+0x44b8)[0x7fd5e31324b8] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x1f55e)[0x7fd5e33f355e] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x1ec09)[0x7fd5e33f2c09] freeradius | /lib/x86_64-linux-gnu/libtalloc.so.2(+0x44b8)[0x7fd5e31324b8] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x1eb83)[0x7fd5e33f2b83] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x1ecef)[0x7fd5e33f2cef] freeradius | /lib/x86_64-linux-gnu/libtalloc.so.2(+0x44b8)[0x7fd5e31324b8] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x1ed80)[0x7fd5e33f2d80] freeradius | /lib/x86_64-linux-gnu/libc.so.6(+0x45495)[0x7fd5e2f4b495] freeradius | /lib/x86_64-linux-gnu/libc.so.6(on_exit+0x0)[0x7fd5e2f4b610] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_get_debug_state+0x22e)[0x7fd5e34007fa] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_debug_break+0x33)[0x7fd5e34009b7] freeradius | /opt/freeradius/lib/libfreeradius-util.so(_fr_exit+0xcd)[0x7fd5e340230e] freeradius | /opt/freeradius/lib/libfreeradius-util.so(+0x2d61c)[0x7fd5e340161c] freeradius | /opt/freeradius/lib/libfreeradius-util.so(_fr_exit+0x0)[0x7fd5e3402241] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_pair_verify+0x5ca)[0x7fd5e344ec85] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_pair_value_bstrdup_buffer_shallow+0xcb)[0x7fd5e344dcc4] freeradius | /opt/freeradius/lib/rlm_sqlippool.so(+0x33e3)[0x7fd5e0dcb3e3] freeradius | /opt/freeradius/lib/rlm_sqlippool.so(+0x3f72)[0x7fd5e0dcbf72] freeradius | /opt/freeradius/lib/libfreeradius-unlang.so(+0x3da34)[0x7fd5e31baa34] freeradius | /opt/freeradius/lib/libfreeradius-unlang.so(unlang_interpret+0x8f3)[0x7fd5e31af3f8] freeradius | /opt/freeradius/lib/libfreeradius-io.so(fr_worker_post_event+0x11b)[0x7fd5e31668ec] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_event_service+0xb52)[0x7fd5e342da8c] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_event_loop+0x67)[0x7fd5e342db9f] freeradius | /opt/freeradius/lib/libfreeradius-server.so(main_loop_start+0x2e)[0x7fd5e32b47e9] freeradius | /opt/freeradius/sbin/radiusd(main+0x1696)[0x5639b601623b] freeradius | /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7fd5e2f2fd90] freeradius | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7fd5e2f2fe40] freeradius | /opt/freeradius/sbin/radiusd(_start+0x25)[0x5639b6014485] freeradius | No panic action set freeradius exited with code 0 Ludo Mikula
On Jun 29, 2023, at 2:34 PM, Ľudovít Mikula <ludovit.mikula@mikori.sk> wrote:
Ok, I think I've got it working now, however I had to comment the message { } section completely otherwise I was getting this crash no matter whether a variable was used in the message or not):
freeradius | Thu Jun 29 18:24:41 2023: Debug : (0) dhcp_sqlippool - Allocated IP 10.56.18.1 freeradius | Thu Jun 29 18:24:41 2023: Debug : (0) dhcp_sqlippool - Released connection (0) freeradius | FATAL ASSERT src/lib/util/pair.c[2975]: false: CONSISTENCY CHECK FAILED src/lib/util/pair.c[2580]: fr_pair_t "Module-Success-Message" char buffer is not parented by fr_pair_t 0x5639b88c1aa0, instead parented by 0x5639b88a9640 (request_t) freeradius | CAUGHT SIGNAL: Aborted freeradius | /opt/freeradius/lib/libfreeradius-util.so(_fr_exit+0x0)[0x7fd5e3402241] freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_pair_verify+0x5ca)[0x7fd5e344ec85]
A test case and/or debugging symbols (with function names and line numbers) would help.
freeradius | /opt/freeradius/lib/libfreeradius-util.so(fr_pair_value_bstrdup_buffer_shallow+0xcb)[0x7fd5e344dcc4] freeradius | /opt/freeradius/lib/rlm_sqlippool.so(+0x33e3)[0x7fd5e0dcb3e3] freeradius | /opt/freeradius/lib/rlm_sqlippool.so(+0x3f72)[0x7fd5e0dcbf72]
TBH, the sqlippool module isn't well tested in v4. We've more to the Redis-based IP pool module for most uses. Alan DeKok.
participants (2)
-
Alan DeKok -
Ľudovít Mikula