libreswan: fix default subnet matching#29781
Conversation
pprindeville
left a comment
There was a problem hiding this comment.
Not sure I understand why a loop is used for a single argument...
| has_default_subnet() { | ||
| local subnet | ||
|
|
||
| for subnet in $1; do |
There was a problem hiding this comment.
Why a for loop if it's only $1 and not $@? Also there's no shift... Have a look at what net/strongswan/files/swanctl.init does with the same argument...
Ah yes. I was treating the value from Would you prefer that I change this so the helper iterates over That would make the intent clearer, and there would be no |
|
@dhrm1k: Since it's a |
|
The left and right subnets are lists and I am not completely sure of the value searching for 0.0.0.0{/0}. |
I could live with that. |
69bdf97 to
faa7df0
Compare
|
I changed this and pushed it again. It now uses I kept the actual behavior change small. |
|
LGTM, will see what will be pushed first #29806 |
sure. thanks for looking into it! |
Match only explicit default-route subnet tokens when normalizing leftsubnets and rightsubnets. The previous regex treated dots as wildcards. Values such as 10.250.0.0/16 and 10.0.0.0/8 were rewritten to 0.0.0.0/0. Fixes: openwrt/openwrt#23795 Signed-off-by: Dharmik Parmar <dharmikparmar2004@yahoo.com>
faa7df0 to
eb4da11
Compare
Match only explicit default-route subnet tokens when normalizing
leftsubnetsand
rightsubnets.The previous regex treated dots as wildcards, so values such as
10.250.0.0/16and10.0.0.0/8could be rewritten to0.0.0.0/0.Fixes: openwrt/openwrt#23795
📦 Package Details
Maintainer: Lucian Cristian lucian.cristian@gmail.com (@lucize)
Description:
Fix the libreswan UCI init script so it only normalizes an explicit default
route subnet token,
0.0.0.0or0.0.0.0/0, instead of matching unrelatedprivate subnets that happen to contain
0.0.0.0in the string.🧪 Run Testing Details
Reproduced the issue on the VM with a temporary
/etc/config/libreswantunnelcontaining:
Before this change,
/etc/init.d/ipsec startgenerated:Also tested the new subnet matching helper in the VM shell:
Local checks:
✅ Formalities
If your PR contains a patch: