Skip to content

Add shared_ips support to WireGuard schema and converters#398

Closed
kaueabade-iez wants to merge 1 commit into
openwisp:masterfrom
kaueabade-iez:feature/wireguard-server-allowed-ips-customization
Closed

Add shared_ips support to WireGuard schema and converters#398
kaueabade-iez wants to merge 1 commit into
openwisp:masterfrom
kaueabade-iez:feature/wireguard-server-allowed-ips-customization

Conversation

@kaueabade-iez
Copy link
Copy Markdown

Description of Changes

  • Added shared_ips to the standard WireGuard and OpenWrt WireGuard schemas
  • Updated standard WireGuard converter to append shared_ips to peer's AllowedIPs
  • Updated OpenWrt WireGuard converter to strip shared_ips from client-side config
  • Added test coverage verifying validation, rendering, and OpenWrt stripping

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a548e2ac-a8b6-49ba-a05e-68692a837f5e

📥 Commits

Reviewing files that changed from the base of the PR and between e36a880 and a64726d.

📒 Files selected for processing (6)
  • netjsonconfig/backends/openwrt/converters/wireguard_peers.py
  • netjsonconfig/backends/openwrt/schema.py
  • netjsonconfig/backends/wireguard/converters.py
  • netjsonconfig/backends/wireguard/schema.py
  • tests/openwrt/test_wireguard.py
  • tests/wireguard/test_backend.py

📝 Walkthrough

Walkthrough

This PR adds support for a new optional shared_ips field to WireGuard peer configurations. The field is defined as an array of unique IP/prefix strings in both OpenWrt and Wireguard backend schemas. The OpenWrt converter removes this field during intermediate representation, while the Wireguard converter merges shared_ips values into the allowed_ips field as comma-separated entries. Test expectations are updated across both backends to validate the new rendering behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

✨ 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 and usage tips.

@kaueabade-iez
Copy link
Copy Markdown
Author

Sorry, this was supposed to merge into my own fork for testing purposes

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot Bot commented May 29, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

No inline issues on changed diff lines.

Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
docs/source/backends/wireguard.rst, docs/source/backends/openwrt.rst 120, 2995 Existing peer-field documentation and examples were not updated to include shared_ips, so the documented backend behavior is now stale.

Fix these issues in Kilo Cloud

Files Reviewed (8 files)
  • netjsonconfig/backends/openwrt/converters/wireguard_peers.py
  • netjsonconfig/backends/openwrt/schema.py
  • netjsonconfig/backends/wireguard/converters.py
  • netjsonconfig/backends/wireguard/schema.py
  • tests/openwrt/test_wireguard.py
  • tests/wireguard/test_backend.py
  • docs/source/backends/wireguard.rst
  • docs/source/backends/openwrt.rst

Reviewed by gpt-5.4-20260305 · 415,955 tokens

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 99.145% (+0.002%) from 99.143% — kaueabade-iez:feature/wireguard-server-allowed-ips-customization into openwisp:master

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.

2 participants