Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upwireguard: add protocol dependency for endpoints #3680
Conversation
zx2c4
suggested changes
Dec 20, 2016
|
The idea of adding the dependencies at the end using IPs directly from |
| @@ -161,6 +140,13 @@ proto_wireguard_setup() { | |||
| exit 1 | |||
| fi | |||
|
|
|||
| # endpoint dependency | |||
| for wg_endpoint in $(wg show ${config} endpoints | grep -v '(none)'); do | |||
| ip=$(echo ${wg_endpoint} | sed 's/.*\t\[\?\([0-9a-f\.:]\+\)\]\?:[0-9]\{1,5\}/\1/') | |||
This comment has been minimized.
This comment has been minimized.
zx2c4
Dec 20, 2016
Contributor
There's a cleaner way to do this without the regex:
wg show "${config}" endpoints | while IFS=$'\t:' read -r key ip port; do
[ -n "${port}" ] || continue
proto_add_host_dependency "${config}" "${ip}"
done(No need to declare key, ip, and port as local since that loop actually is in a subshell.)
This comment has been minimized.
This comment has been minimized.
|
Integrated @zx2c4's changes. Tested, it works of course. Thanks! (Squashed commits) |
zx2c4
reviewed
Dec 20, 2016
| @@ -161,6 +140,13 @@ proto_wireguard_setup() { | |||
| exit 1 | |||
| fi | |||
|
|
|||
| # endpoint dependency | |||
| wg show ${config} endpoints | while IFS=$'\t:' read -r key ip port; do | |||
This comment has been minimized.
This comment has been minimized.
zx2c4
Dec 20, 2016
Contributor
Elsewhere in the script you quote ${config}, but not here. I have no idea if quoting of that variable is required, but I did notice the inconsistency. Probably doesn't matter, but FYI.
This comment has been minimized.
This comment has been minimized.
|
Please wait with the merge. I'd like to fix the inconsistency, it bothers me. Good catch! |
This comment has been minimized.
This comment has been minimized.
|
Sorry, another nit: This script no longer requires |
This comment has been minimized.
This comment has been minimized.
|
Right. Since @zorun asked me to co-maintain the package we might touch the Makefile anyway to reflect the organizational change. Commit coming as soon as I am back at development machine. Thanks for the patience! |
This comment has been minimized.
This comment has been minimized.
|
Should be ready now, shouldn't it? |
This comment has been minimized.
This comment has been minimized.
|
Perfect! Ship it! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@hnyman, I have to admit that I don't know what the right format is. I searched for examples and looked at other Makefiles. Adding the name and email and the end of the line? Or maybe 'MAINTAINER0:='? What dies the build system and other LEDE bots and software prefer? |
This comment has been minimized.
This comment has been minimized.
|
The format is comma-separated list. (Like there would be two mail addresses in a recipient list) Examples:
https://github.com/openwrt/packages/blob/master/net/aria2/Makefile#L18
https://github.com/openwrt/packages/blob/master/net/sqm-scripts-extra/Makefile#L23
|
This comment has been minimized.
This comment has been minimized.
|
Done! |
This comment has been minimized.
This comment has been minimized.
|
Can we get this merged? |
yousong
merged commit 7d34e8e
into
openwrt:master
Dec 24, 2016
danrl
deleted the
danrl:wireguard-proto-dep
branch
Dec 24, 2016
This comment has been minimized.
This comment has been minimized.
zorun
commented
Dec 25, 2016
|
A bit late, but ACK for both the change (thanks Dan!) and the shared maintainership with Dan (which would have been better in a separate commit/PR). |
danrl commentedDec 20, 2016
Endpoint dependency implemented. The actual endpoint is used exclusively. Using
this approach we are dual-stack safe (not errors on missing protocol) and create
only the dependency that are really necessary.
Signed-off-by: Dan Luedtke mail@danrl.com
Maintainer: @zorun
Compile tested: x86_64
Run tested: x86_64
@zx2c4 @zorun: requesting comments and review. Like to improve the regex, e.g. for public key matching. Maybe no really necessary? What do you think?