Skip to content

[feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229#694

Open
UltraBot05 wants to merge 4 commits into
openwisp:masterfrom
UltraBot05:fix-allowed-hosts-cidr
Open

[feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229#694
UltraBot05 wants to merge 4 commits into
openwisp:masterfrom
UltraBot05:fix-allowed-hosts-cidr

Conversation

@UltraBot05

@UltraBot05 UltraBot05 commented Mar 16, 2026

Copy link
Copy Markdown

Added strict=False to ipaddress.ip_network parsing and strip() to string inputs to allow networks with host bits and spaces to be correctly parsed and authenticated.

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #229.

Description of Changes

This PR enables CIDR and subnet support for FREERADIUS_ALLOWED_HOSTS by adding strict=False to ipaddress.ip_network() parsing in base/models.py and api/freeradius_views.py.

This change prevents ValueError crashes when host bits are set and allows authentication for any client IP within a defined network range. Additionally, .strip() was added to handle accidental whitespace in input strings. New test cases in test_freeradius_api.py verify correct range-based authentication and resilient string parsing.

@coderabbitai

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes add CIDR and whitespace-tolerant parsing for FreeRADIUS allowed hosts. Model parsing and validation now trim comma-separated entries, drop empties, and validate with ip_network(..., strict=False). The API membership check now parses stripped allowlist entries with non-strict network handling before comparing client IPs. Tests cover allowed and rejected CIDR cases, mixed host/CIDR entries, and cached normalization, and the settings docs note whitespace and host-bit handling.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant FreeradiusApiAuthentication
    participant AbstractOrganizationRadiusSettings
    participant ipaddress

    Client->>FreeradiusApiAuthentication: request from client IP
    FreeradiusApiAuthentication->>AbstractOrganizationRadiusSettings: freeradius_allowed_hosts_list
    AbstractOrganizationRadiusSettings-->>FreeradiusApiAuthentication: trimmed allowlist entries
    FreeradiusApiAuthentication->>ipaddress: ip_network((ip or '').strip(), strict=False)
    ipaddress-->>FreeradiusApiAuthentication: network object
    FreeradiusApiAuthentication->>FreeradiusApiAuthentication: compare client IP to allowed network
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is descriptive, matches the CIDR/subnet support change, and references the linked issue.
Linked Issues check ✅ Passed The PR implements IP range/CIDR support for FREERADIUS_ALLOWED_HOSTS and verifies authorization within the configured network range.
Out of Scope Changes check ✅ Passed The docs, tests, and validation-message updates are all directly related to CIDR and whitespace handling for allowed hosts.
Bug Fixes ✅ Passed Root cause is fixed in parsing/validation, and the new mocked client-IP test covers CIDR, whitespace, cache normalization, and auth acceptance/rejection deterministically.
Description check ✅ Passed The PR description matches the required template and includes the checklist, issue reference, and change summary.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@openwisp_radius/base/models.py`:
- Around line 1388-1390: The loop over allowed_hosts_set redundantly calls
str(...).strip() before validating with ipaddress.ip_network; since
allowed_hosts_set is built from freeradius_allowed_hosts_list which already
strips and yields strings, replace ipaddress.ip_network(str(ip_address).strip(),
strict=False) with ipaddress.ip_network(ip_address, strict=False) in the
validation loop (keep strict=False).

In `@openwisp_radius/tests/test_api/test_freeradius_api.py`:
- Around line 2388-2447: Add parallel CIDR-related tests to the TestClientIpApi
class mirroring the new tests in TestTransactionClientIpApi: create tests named
like test_ip_from_radsetting_cidr_range_valid,
test_ip_from_radsetting_spaces_and_host_bits_valid, and
test_ip_outside_cidr_range_rejected that manipulate
OrganizationRadiusSettings.freeradius_allowed_hosts, patch
openwisp_radius.api.freeradius_views.get_client_ip, and assert the same
responses as in the Transaction tests; also add edge-case tests in
TestClientIpApi for IPv6 CIDR ranges (e.g., ::1/128 and 2001:db8::/32) and a
regression test for a single IP without CIDR to ensure existing behavior from
test_ip_from_radsetting_invalid is preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3ea97a6c-6e92-4dc2-8af3-995aba4b7baa

📥 Commits

Reviewing files that changed from the base of the PR and between eef0edf and e2ee205.

📒 Files selected for processing (3)
  • openwisp_radius/api/freeradius_views.py
  • openwisp_radius/base/models.py
  • openwisp_radius/tests/test_api/test_freeradius_api.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Python==3.13 | django~=5.2.0
  • GitHub Check: Python==3.10 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=4.2.0
  • GitHub Check: Python==3.12 | django~=4.2.0
  • GitHub Check: Python==3.10 | django~=4.2.0
  • GitHub Check: Python==3.13 | django~=5.1.0
  • GitHub Check: Python==3.12 | django~=5.2.0
  • GitHub Check: Python==3.11 | django~=5.2.0
  • GitHub Check: Python==3.10 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=5.1.0
🔇 Additional comments (5)
openwisp_radius/base/models.py (1)

1342-1346: LGTM!

The list comprehension correctly strips whitespace from each entry and filters out empty strings, ensuring robust parsing of comma-separated IP addresses with accidental spaces.

openwisp_radius/api/freeradius_views.py (1)

106-118: LGTM! Correct implementation of CIDR range matching.

The logic correctly:

  1. Uses ip_network(str(ip).strip(), strict=False) to parse allowed hosts as networks, supporting both single IPs and CIDR ranges.
  2. Checks if the client IP falls within any allowed network using the in operator with ip_address() and ip_network().
  3. Preserves the existing error handling for invalid IP configurations.

The str(ip).strip() is slightly redundant (values should already be stripped strings), but serves as defensive coding and doesn't impact functionality.

openwisp_radius/tests/test_api/test_freeradius_api.py (3)

2388-2403: LGTM! Good test coverage for CIDR range matching.

This test correctly validates that an IP address within a CIDR range (172.18.0.10 in 172.18.0.0/16) is accepted for authorization.


2405-2425: LGTM! Comprehensive test for whitespace and host bits handling.

This test effectively validates:

  1. Whitespace trimming in allowed hosts parsing (space after comma).
  2. Host bits in CIDR notation (172.18.0.5/16 instead of canonical 172.18.0.0/16) working with strict=False.
  3. Cache correctness after save.
  4. Client IP within the range is accepted.

2427-2447: LGTM! Good negative test case for CIDR rejection.

This test correctly validates that an IP address outside the allowed CIDR range (10.0.0.5 not in 172.18.0.0/16) is rejected with the appropriate 403 status and error message.

Comment thread openwisp_radius/base/models.py Outdated
Comment thread openwisp_radius/tests/test_api/test_freeradius_api.py
@coveralls

coveralls commented Mar 16, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 98.091%. remained the same — UltraBot05:fix-allowed-hosts-cidr into openwisp:master

…isp#229

Closes openwisp#229

Added strict=False to ipaddress.ip_network parsing and strip() to string
inputs to allow networks with host bits and spaces to be correctly
parsed and authenticated.
@UltraBot05
UltraBot05 force-pushed the fix-allowed-hosts-cidr branch from e2ee205 to f31bb3a Compare March 16, 2026 09:37
coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 16, 2026
@UltraBot05 UltraBot05 changed the title [fix] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229 [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229 Mar 16, 2026
@UltraBot05

UltraBot05 commented Mar 16, 2026

Copy link
Copy Markdown
Author

Hi, some information on this:

On CodeRabbitAI's input:
I used the (value or "").strip() pattern to sanitize the host strings, which prevents the server from crashing on null values or messy whitespace. I've added new test cases in test_freeradius_api.py to cover these scenarios.

CIs have passed, please check.

@nemesifier nemesifier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @UltraBot05, this is a clean and well-tested feature for #229. Passing strict=False to ip_network so entries with host bits are accepted, and stripping whitespace from comma-separated entries, is exactly right, and you applied it consistently in the runtime check, the property, and the validation. The tests cover the CIDR-range and spaces/host-bits cases.

Minor points:

  1. In freeradius_allowed_hosts_list, the leading addresses = [] is now dead (immediately reassigned by the comprehension). Drop it.
  2. Docs are unchecked. Please document that FREERADIUS_ALLOWED_HOSTS now accepts CIDR ranges (and tolerates spaces), since that is a user-facing behavior change.
  3. Worth a test asserting that a client IP outside the configured CIDR is correctly rejected, to complement the accept cases.

Good, small, and correct. Add the docs note and the negative test and it is ready.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
openwisp_radius/base/models.py (1)

1404-1406: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Normalize the global allowlist before these set checks.

allowed_hosts_set now uses stripped/non-empty tokens, but settings_allowed_hosts_set still uses the raw app_settings.FREERADIUS_ALLOWED_HOSTS. With a setting like [" "], Line 1406 treats the global fallback as configured here, then _check_client_ip_and_return() strips it to "" and rejects every request later. Apply the same trim-and-drop-empty normalization on the settings side before the emptiness/equality checks.

Suggested fix
-        settings_allowed_hosts_set = set(app_settings.FREERADIUS_ALLOWED_HOSTS)
+        settings_allowed_hosts_set = {
+            (ip or "").strip()
+            for ip in (app_settings.FREERADIUS_ALLOWED_HOSTS or [])
+            if (ip or "").strip()
+        }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openwisp_radius/base/models.py` around lines 1404 - 1406, Normalize the
global allowlist in the same way as the instance allowlist before the
emptiness/equality checks in the logic around self.freeradius_allowed_hosts_list
and app_settings.FREERADIUS_ALLOWED_HOSTS. The issue is that allowed_hosts_set
is already stripped and filtered, but settings_allowed_hosts_set still uses raw
values, so whitespace-only entries can be treated as configured and later fail
in _check_client_ip_and_return(). Apply the same trim-and-drop-empty
normalization to the settings side before the set checks so both sources are
compared consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@openwisp_radius/base/models.py`:
- Around line 1421-1425: The allowed-hosts validation in the model no longer
rejects surrounding whitespace, so the existing “no spaces” hint is stale and
misleading. Update the validation path in the allowed-hosts parsing/validation
logic around the ipaddress.ip_network check to remove that hint from the error
message, keeping the message aligned with the actual behavior while preserving
the current trimming and network validation.

---

Outside diff comments:
In `@openwisp_radius/base/models.py`:
- Around line 1404-1406: Normalize the global allowlist in the same way as the
instance allowlist before the emptiness/equality checks in the logic around
self.freeradius_allowed_hosts_list and app_settings.FREERADIUS_ALLOWED_HOSTS.
The issue is that allowed_hosts_set is already stripped and filtered, but
settings_allowed_hosts_set still uses raw values, so whitespace-only entries can
be treated as configured and later fail in _check_client_ip_and_return(). Apply
the same trim-and-drop-empty normalization to the settings side before the set
checks so both sources are compared consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c4229bfe-7a32-41b8-95e1-1acc2bcb5cf1

📥 Commits

Reviewing files that changed from the base of the PR and between 9ad22ec and f4c1390.

📒 Files selected for processing (4)
  • docs/user/settings.rst
  • openwisp_radius/api/freeradius_views.py
  • openwisp_radius/base/models.py
  • openwisp_radius/tests/test_api/test_freeradius_api.py
📜 Review details
⏰ Context from checks skipped due to timeout. (11)
  • GitHub Check: Python==3.11 | django~=5.1.0
  • GitHub Check: Python==3.12 | django~=4.2.0
  • GitHub Check: Python==3.13 | django~=5.1.0
  • GitHub Check: Python==3.13 | django~=5.2.0
  • GitHub Check: Python==3.11 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=4.2.0
  • GitHub Check: Python==3.12 | django~=5.2.0
  • GitHub Check: Python==3.10 | django~=5.2.0
  • GitHub Check: Python==3.10 | django~=4.2.0
  • GitHub Check: Python==3.10 | django~=5.1.0
🧰 Additional context used
📓 Path-based instructions (2)
**/{docs,documentation}/**/*.{md,rst,adoc,html}

📄 CodeRabbit inference engine (Custom checks)

**/{docs,documentation}/**/*.{md,rst,adoc,html}: Documentation must be updated if a change affects behavior that is already documented
Feature documentation must mention the new feature. If the feature is heavily UI-related, a new section or page is appropriate

Files:

  • docs/user/settings.rst
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Place imports at the top of the file. Only defer imports when necessary (e.g., Django model imports inside functions or methods where the app registry is not yet ready).
Avoid unnecessary blank lines inside function and method bodies.
Mark user-facing strings for translation with Django i18n helpers in Django code.
Write comments and docstrings only when they explain why code is shaped a certain way. Put comments before the relevant code block instead of scattering them inside it.

Files:

  • openwisp_radius/base/models.py
  • openwisp_radius/api/freeradius_views.py
  • openwisp_radius/tests/test_api/test_freeradius_api.py
🔇 Additional comments (4)
openwisp_radius/base/models.py (1)

1375-1379: LGTM!

openwisp_radius/api/freeradius_views.py (1)

109-111: LGTM!

openwisp_radius/tests/test_api/test_freeradius_api.py (1)

2483-2523: LGTM!

Also applies to: 2563-2622

docs/user/settings.rst (1)

193-195: LGTM!

Comment thread openwisp_radius/base/models.py
@UltraBot05
UltraBot05 force-pushed the fix-allowed-hosts-cidr branch from f4c1390 to a34671e Compare June 29, 2026 07:20
@UltraBot05

Copy link
Copy Markdown
Author

Hi @nemesifier,
Good to know my feature addition was half-decent 😄

I've addressed all of your points:

  • Dropped the dead addresses = [] from freeradius_allowed_hosts_list. Also removed the stale (no spaces) hint from the validation error message since whitespace is now accepted.
  • Added a note to the OPENWISP_RADIUS_FREERADIUS_ALLOWED_HOSTS docs about host bits and whitespace tolerance.
    (this means i have updated the pr description and checked "I've updated the Documentation" checklist item.)
  • Regarding the negative test ->
    • test_ip_outside_cidr_range_rejected in TestTransactionClientIpApi already covers the rejection case. I've also added mirrored CIDR accept and reject tests to TestClientIpApi (non-transaction) as suggested in the earlier CodeRabbit review.

All checks passing, and the tests too.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
openwisp_radius/base/models.py (1)

1421-1425: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Compare normalized networks before collapsing to the global default.

With strict=False, 172.18.0.5/16 and 172.18.0.0/16 now authorize the same range, but the allowed_hosts_set == settings_allowed_hosts_set check still compares raw strings. If the default uses one form and an organization saves the other, freeradius_allowed_hosts is persisted instead of reset to None, so that org stops inheriting later changes to OPENWISP_RADIUS_FREERADIUS_ALLOWED_HOSTS.

Suggested fix
         allowed_hosts_set = set(self.freeradius_allowed_hosts_list)
-        settings_allowed_hosts_set = set(app_settings.FREERADIUS_ALLOWED_HOSTS)
+        settings_allowed_hosts_set = {
+            (ip or "").strip()
+            for ip in app_settings.FREERADIUS_ALLOWED_HOSTS
+            if (ip or "").strip()
+        }
+        normalized_allowed_hosts_set = {
+            str(ipaddress.ip_network(ip_address, strict=False))
+            for ip_address in allowed_hosts_set
+        }
+        normalized_settings_allowed_hosts_set = {
+            str(ipaddress.ip_network(ip_address, strict=False))
+            for ip_address in settings_allowed_hosts_set
+        }
@@
-            if allowed_hosts_set == settings_allowed_hosts_set:
+            if normalized_allowed_hosts_set == normalized_settings_allowed_hosts_set:
                 self.freeradius_allowed_hosts = None
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openwisp_radius/base/models.py` around lines 1421 - 1425, The allowed-hosts
reset logic is comparing raw strings, so equivalent CIDR forms like
172.18.0.5/16 and 172.18.0.0/16 are treated as different in the
`freeradius_allowed_hosts` handling. Update the comparison in the
`allowed_hosts_set`/`settings_allowed_hosts_set` flow to normalize each entry
with `ipaddress.ip_network(..., strict=False)` before checking equality, so
organizations that match the global default by range are reset to `None` and
keep inheriting future `OPENWISP_RADIUS_FREERADIUS_ALLOWED_HOSTS` changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@openwisp_radius/base/models.py`:
- Around line 1421-1425: The allowed-hosts reset logic is comparing raw strings,
so equivalent CIDR forms like 172.18.0.5/16 and 172.18.0.0/16 are treated as
different in the `freeradius_allowed_hosts` handling. Update the comparison in
the `allowed_hosts_set`/`settings_allowed_hosts_set` flow to normalize each
entry with `ipaddress.ip_network(..., strict=False)` before checking equality,
so organizations that match the global default by range are reset to `None` and
keep inheriting future `OPENWISP_RADIUS_FREERADIUS_ALLOWED_HOSTS` changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 37e4d228-c2db-4099-8800-8497da984be7

📥 Commits

Reviewing files that changed from the base of the PR and between f4c1390 and a34671e.

📒 Files selected for processing (3)
  • docs/user/settings.rst
  • openwisp_radius/base/models.py
  • openwisp_radius/tests/test_api/test_freeradius_api.py
📜 Review details
⏰ Context from checks skipped due to timeout. (11)
  • GitHub Check: Python==3.13 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=4.2.0
  • GitHub Check: Python==3.12 | django~=4.2.0
  • GitHub Check: Python==3.13 | django~=5.1.0
  • GitHub Check: Python==3.10 | django~=5.2.0
  • GitHub Check: Python==3.12 | django~=5.2.0
  • GitHub Check: Python==3.11 | django~=5.1.0
  • GitHub Check: Python==3.10 | django~=4.2.0
  • GitHub Check: Python==3.10 | django~=5.1.0
  • GitHub Check: Python==3.11 | django~=5.2.0
🧰 Additional context used
📓 Path-based instructions (2)
**/{docs,documentation}/**/*.{md,rst,adoc,html}

📄 CodeRabbit inference engine (Custom checks)

**/{docs,documentation}/**/*.{md,rst,adoc,html}: Documentation must be updated if a change affects behavior that is already documented
Feature documentation must mention the new feature. If the feature is heavily UI-related, a new section or page is appropriate

Files:

  • docs/user/settings.rst
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Place imports at the top of the file. Only defer imports when necessary (e.g., Django model imports inside functions or methods where the app registry is not yet ready).
Avoid unnecessary blank lines inside function and method bodies.
Mark user-facing strings for translation with Django i18n helpers in Django code.
Write comments and docstrings only when they explain why code is shaped a certain way. Put comments before the relevant code block instead of scattering them inside it.

Files:

  • openwisp_radius/base/models.py
  • openwisp_radius/tests/test_api/test_freeradius_api.py
🔇 Additional comments (3)
openwisp_radius/base/models.py (1)

1375-1379: LGTM!

openwisp_radius/tests/test_api/test_freeradius_api.py (1)

2483-2523: LGTM!

Also applies to: 2563-2622

docs/user/settings.rst (1)

193-195: LGTM!

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 29, 2026
@openwisp-companion

Copy link
Copy Markdown

Test Failure: Invalid IP List

Hello @UltraBot05,
(Analysis for commit a34671e)

The test test_organization_radsettings_freeradius_allowed_hosts failed because it expected a specific error message "Invalid input. Please enter valid ip addresses or subnets separated by comma. (no spaces)" but received a different response.

Fix:
The test is likely failing due to an incorrect or outdated error message. Please update the expected error message in the test assertion to match the actual error message returned by the application, or correct the input data in the test to be a valid IP list.

…penwisp#229

freeradius_allowed_hosts_list had a dead `addresses = []` immediately overwritten by the comprehension; removed it. Also removed the stale "(no spaces)" hint from the validation error message since whitespace is now accepted.

Updated OPENWISP_RADIUS_FREERADIUS_ALLOWED_HOSTS documentation to note that entries with host bits set and extra whitespace are handled gracefully.

Added CIDR accept and reject tests to TestClientIpApi mirroring the existing tests in TestTransactionClientIpApi.

Fixes openwisp#229
@UltraBot05

Copy link
Copy Markdown
Author

my bad, have recitified it and now CI passes

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

@UltraBot05 Thanks for the update — I’ll review the latest changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
openwisp_radius/tests/test_admin.py (1)

503-588: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an admin round-trip for the newly accepted inputs.

This method only updates the rejection text. Please add a positive subtest that posts something like 127.0.0.1, 172.18.0.5/16 through the organization form and asserts the save succeeds, so the admin path is covered end-to-end for the new whitespace/host-bit behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openwisp_radius/tests/test_admin.py` around lines 503 - 588, The admin test
for OrganizationRadiusSettings only covers rejection cases and the single-host
save path, so add a positive subtest in
test_organization_radsettings_freeradius_allowed_hosts that posts a
comma-separated value like 127.0.0.1, 172.18.0.5/16 through the organization
admin form and asserts the response is a redirect and the saved
freeradius_allowed_hosts matches the accepted normalized value. Use the existing
form_data, self.client.post, and radsetting.refresh_from_db() flow so the new
whitespace/host-bit behavior is covered end-to-end.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@openwisp_radius/tests/test_admin.py`:
- Around line 503-588: The admin test for OrganizationRadiusSettings only covers
rejection cases and the single-host save path, so add a positive subtest in
test_organization_radsettings_freeradius_allowed_hosts that posts a
comma-separated value like 127.0.0.1, 172.18.0.5/16 through the organization
admin form and asserts the response is a redirect and the saved
freeradius_allowed_hosts matches the accepted normalized value. Use the existing
form_data, self.client.post, and radsetting.refresh_from_db() flow so the new
whitespace/host-bit behavior is covered end-to-end.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e5cdcc4f-1297-4700-931a-d144a93318e7

📥 Commits

Reviewing files that changed from the base of the PR and between f4c1390 and 0734295.

📒 Files selected for processing (4)
  • docs/user/settings.rst
  • openwisp_radius/base/models.py
  • openwisp_radius/tests/test_admin.py
  • openwisp_radius/tests/test_api/test_freeradius_api.py
📜 Review details
⚠️ CI failures not shown inline (22)

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.10 django~=5.2.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.12 django~=4.2.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.11 django~=5.1.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.10 django~=5.1.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.13 django~=5.2.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.11 django~=4.2.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.10 django~=4.2.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.12 django~=5.1.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.13 django~=5.1.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.12 django~=5.2.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / 3_Python==3.12 django~=5.1.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

ds/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: billiard<5.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.2.4)
 Requirement already satisfied: kombu>=5.6.0 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.2)
 Requirement already satisfied: vine<6.0,>=5.1.0 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.1.0)
 Requirement already satisfied: click<9.0,>=8.1.2 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (8.4.2)
 Requirement already satisfied: click-didyoumean>=0.3.0 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-pac...

GitHub Actions: OpenWISP RADIUS CI Build / Python==3.11 django~=5.2.0: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

Post job cleanup.
 [command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/openwisp-radius/openwisp-radius --files-from manifest.txt --use-compress-program zstdmt
 /usr/bin/tar: ../../../../../var/cache/apt/archives/partial: Cannot open: Permission denied
 /usr/bin/tar: ../../../../../var/cache/apt/archives/lock: Cannot open: Permission denied
 /usr/bin/tar: Exiting with failure status due to previous errors
 ##[warning]Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2

GitHub Actions: OpenWISP RADIUS CI Build / 4_Python==3.11 django~=5.1.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

: channels~=4.3.0 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from channels[daphne]~=4.3.0; extra == "channels"->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.2)
 Requirement already satisfied: channels_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: billiard<5.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.2.4)
 Requirement already satisfied: kombu>=5.6.0 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.2)
 Requirement already satisfied: vine<6.0,>=5.1.0 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from celery~=5.6.1->openwisp-utils @ https://github...

GitHub Actions: OpenWISP RADIUS CI Build / 2_Python==3.10 django~=5.2.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

te-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (2.7.0)
 Requirement already satisfied: distro~=1.9.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (1.9.0)
 Requirement already satisfied: channels~=4.3.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from channels[daphne]~=4.3.0; extra == "channels"->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.2)
 Requirement already satisfied: channels_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: djangorestframework~=3.17.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (3.17.1)
 Requirement already satisfied: django-filter<26.0,>=25.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://githu...

GitHub Actions: OpenWISP RADIUS CI Build / 8_Python==3.10 django~=4.2.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

isp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (2.7.0)
 Requirement already satisfied: distro~=1.9.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (1.9.0)
 Requirement already satisfied: channels~=4.3.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from channels[daphne]~=4.3.0; extra == "channels"->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.2)
 Requirement already satisfied: channels_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: djangorestframework~=3.17.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archiv...

GitHub Actions: OpenWISP RADIUS CI Build / 6_Python==3.11 django~=4.2.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

hub.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (25.2)
 Requirement already satisfied: drf-yasg<1.22.0,>=1.21.14 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (1.21.15)
 Requirement already satisfied: channels~=4.3.0 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from channels[daphne]~=4.3.0; extra == "channels"->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.2)
 Requirement already satisfied: channels_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: billiard<5.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.2.4)
 Requirement already satisfied: kombu>=5.6.0 in /...

GitHub Actions: OpenWISP RADIUS CI Build / 5_Python==3.13 django~=5.2.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (3.17.1)
 Requirement already satisfied: django-filter<26.0,>=25.1 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (25.2)
 Requirement already satisfied: drf-yasg<1.22.0,>=1.21.14 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (1.21.15)
 Requirement already satisfied: channels~=4.3.0 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from channels[daphne]~=4.3.0; extra == "channels"->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.2)
 Requirement already satisfied: channels_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: billiard<5.0,>=...

GitHub Actions: OpenWISP RADIUS CI Build / 1_Python==3.12 django~=4.2.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

ges (from channels[daphne]~=4.3.0; extra == "channels"->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.2)
 Requirement already satisfied: channels_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: billiard<5.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.2.4)
 Requirement already satisfied: kombu>=5.6.0 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.2)
 Requirement already satisfied: vine<6.0,>=5.1.0 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest...

GitHub Actions: OpenWISP RADIUS CI Build / 7_Python==3.10 django~=5.1.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

atisfied: urllib3<3.0.0,>=2.0.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (2.7.0)
 Requirement already satisfied: distro~=1.9.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (1.9.0)
 Requirement already satisfied: channels~=4.3.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from channels[daphne]~=4.3.0; extra == "channels"->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.2)
 Requirement already satisfied: channels_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: djangorestframework~=3.17.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-u...

GitHub Actions: OpenWISP RADIUS CI Build / 9_Python==3.13 django~=5.1.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

edtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: billiard<5.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.2.4)
 Requirement already satisfied: kombu>=5.6.0 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.2)
 Requirement already satisfied: vine<6.0,>=5.1.0 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.1.0)
 Requirement already satisfied: click<9.0,>=8.1.2 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (8.4.2)
 Requirement already satisfied: click-didyoumean>=0.3.0 in /opt/hostedtoolcache/Python/3.13.14/x64/lib/python3.13/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads...

GitHub Actions: OpenWISP RADIUS CI Build / 11_Python==3.11 django~=5.2.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

nwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (25.2)
 Requirement already satisfied: drf-yasg<1.22.0,>=1.21.14 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (1.21.15)
 Requirement already satisfied: channels~=4.3.0 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from channels[daphne]~=4.3.0; extra == "channels"->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.2)
 Requirement already satisfied: channels_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: billiard<5.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.2.4)
 Requirement already satisfied: kombu>=5.6.0 in /opt/hostedtoolcache/...

GitHub Actions: OpenWISP RADIUS CI Build / 10_Python==3.12 django~=5.2.0.txt: [feature] Added CIDR and subnet support to FREERADIUS_ALLOWED_HOSTS #229

Conclusion: failure

View job details

els_redis<4.4.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.3.0)
 Requirement already satisfied: celery~=5.6.1 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.3)
 Requirement already satisfied: billiard<5.0,>=4.2.1 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (4.2.4)
 Requirement already satisfied: kombu>=5.6.0 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.6.2)
 Requirement already satisfied: vine<6.0,>=5.1.0 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-utils[celery,rest] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz->openwisp-radius==1.3a0) (5.1.0)
 Requirement already satisfied: click<9.0,>=8.1.2 in /opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages (from celery~=5.6.1->openwisp-utils @ https://github.com/openwisp/openwisp-utils/archive...
🧰 Additional context used
📓 Path-based instructions (2)
**/{docs,documentation}/**/*.{md,rst,adoc,html}

📄 CodeRabbit inference engine (Custom checks)

**/{docs,documentation}/**/*.{md,rst,adoc,html}: Documentation must be updated if a change affects behavior that is already documented
Feature documentation must mention the new feature. If the feature is heavily UI-related, a new section or page is appropriate

Files:

  • docs/user/settings.rst
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Place imports at the top of the file. Only defer imports when necessary (e.g., Django model imports inside functions or methods where the app registry is not yet ready).
Avoid unnecessary blank lines inside function and method bodies.
Mark user-facing strings for translation with Django i18n helpers in Django code.
Write comments and docstrings only when they explain why code is shaped a certain way. Put comments before the relevant code block instead of scattering them inside it.

Files:

  • openwisp_radius/tests/test_admin.py
  • openwisp_radius/base/models.py
  • openwisp_radius/tests/test_api/test_freeradius_api.py
🔇 Additional comments (3)
openwisp_radius/base/models.py (1)

1375-1379: LGTM!

Also applies to: 1421-1431

openwisp_radius/tests/test_api/test_freeradius_api.py (1)

2483-2522: LGTM!

Also applies to: 2580-2622

docs/user/settings.rst (1)

193-195: LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Allow IP range to for allowed freeradius hosts

3 participants