-
Notifications
You must be signed in to change notification settings - Fork 18
feat(ovpnrw): connections history from storage if available #1566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
25e5122
feat(ovpn-rw-conn-history): enhance connection history management and…
m-dilorenzi f5359ab
feat(ovpn-rw-conn-history): implement dynamic storage path handling a…
m-dilorenzi df640a8
feat(ovpn-rw-conn-history): streamline storage path retrieval for Ope…
m-dilorenzi d16f1fe
feat(ovpn-rw-conn-history): simplify storage retrieval in init connec…
m-dilorenzi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Copyright (C) 2026 Nethesis S.r.l. | ||
| # SPDX-License-Identifier: GPL-2.0-only | ||
| # | ||
| # Triggered by hotplug when a block device is added. | ||
| # If /mnt/data is mounted, sync OpenVPN connection records from /var to storage. | ||
|
|
||
| [ "$ACTION" = "add" ] || exit 0 | ||
| [ "$DEVTYPE" = "partition" ] || exit 0 | ||
|
|
||
| logger -t openvpn-merge-connections-db "Storage device added: $DEVNAME, checking for OpenVPN connections database merge" | ||
|
|
||
| # Check if a storage target is configured in UCI | ||
| storage_target=$(uci -q get fstab.ns_data.target) | ||
| if [ -z "$storage_target" ]; then | ||
| logger -t openvpn-merge-connections-db "No storage configured in fstab.ns_data, skipping merge" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Wait for the configured storage target to be mounted (up to 10 seconds) | ||
| i=0 | ||
| while [ $i -lt 10 ] && ! awk -v target="${storage_target}" '$2 == target {found=1} END {exit !found}' /proc/mounts; do | ||
| sleep 1 | ||
| i=$((i + 1)) | ||
| done | ||
|
|
||
| # If the storage target is still not mounted, log a warning and exit. Merge will not be performed | ||
| if ! awk -v target="${storage_target}" '$2 == target {found=1} END {exit !found}' /proc/mounts; then | ||
| logger -t openvpn-merge-connections-db "Storage target ${storage_target} not mounted after 30 seconds, skipping merge" | ||
| exit 0 | ||
| fi | ||
|
|
||
| logger -t openvpn-merge-connections-db "Starting merge of OpenVPN connections database from /var to ${storage_target}" | ||
| /usr/libexec/ns-openvpn/openvpn-merge-connections-db | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.