diff options
author | CyberLeo <cyberleo@cyberleo.net> | 2021-07-22 21:02:46 -0500 |
---|---|---|
committer | CyberLeo <cyberleo@cyberleo.net> | 2021-07-22 21:02:46 -0500 |
commit | 59068642667b2748b2f24d18c58b1d2fdfed7619 (patch) | |
tree | deca4d721637676253ed1270f252f8d389286151 /user/netifrc | |
parent | 4a177049e3d486da3f54d346d63ea80699c08b5b (diff) | |
parent | 50e523c03bbcb6be1298e3dedb0441b7e47ab2eb (diff) | |
download | packages-59068642667b2748b2f24d18c58b1d2fdfed7619.tar.gz packages-59068642667b2748b2f24d18c58b1d2fdfed7619.tar.bz2 packages-59068642667b2748b2f24d18c58b1d2fdfed7619.tar.xz packages-59068642667b2748b2f24d18c58b1d2fdfed7619.zip |
Merge branch 'master' into kpartx
Diffstat (limited to 'user/netifrc')
-rw-r--r-- | user/netifrc/APKBUILD | 11 | ||||
-rw-r--r-- | user/netifrc/switch-l2tp-gawk-to-perl.patch | 92 |
2 files changed, 99 insertions, 4 deletions
diff --git a/user/netifrc/APKBUILD b/user/netifrc/APKBUILD index 6749f98c7..8b6b18cf5 100644 --- a/user/netifrc/APKBUILD +++ b/user/netifrc/APKBUILD @@ -1,17 +1,19 @@ # Contributor: A. Wilcox <awilfox@adelielinux.org> +# Contrinutor: Lee Starnes <lee@canned-death.us> # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=netifrc -pkgver=0.6.1 +pkgver=0.7.1 pkgrel=0 pkgdesc="User-friendly network interface management scripts for OpenRC" url="https://www.gentoo.org/proj/en/base/openrc/" arch="noarch" options="!check" # No test suite. license="BSD-2-Clause" -depends="eudev openrc" +depends="eudev openrc perl" makedepends="eudev-dev pkgconf" subpackages="$pkgname-doc $pkgname-openrc" -source="https://gitweb.gentoo.org/proj/$pkgname.git/snapshot/$pkgname-$pkgver.tar.gz" +source="https://gitweb.gentoo.org/proj/$pkgname.git/snapshot/$pkgname-$pkgver.tar.gz + switch-l2tp-gawk-to-perl.patch" build() { make UDEVDIR=/lib/udev LIBEXECDIR=/lib/$pkgname PF="$pkgname-$pkgver" @@ -24,4 +26,5 @@ package() { done } -sha512sums="798a882f87f153c31b415d77a06a2beca94a958ea982aca20bbc2cf6a7d800aedbd99a577734ea41d6a75807b13d640dd7fa5a51aa5a27055e9c552634ac7bdb netifrc-0.6.1.tar.gz" +sha512sums="407071f8f58b7788703a62193677673ddd18114b69142894674337410473e620cf3895bb014cff133f719ac1a7191ac3bedfd969c9a11bf2f1c4b04d39683057 netifrc-0.7.1.tar.gz +21d5755d911446abaed75e19c86e6f090da4db6cbcac45d8473d01c2ce309da3debdbe84e538b559bda1a8c538c9be6d182c67c9253229f8d12e3d7b8257fb90 switch-l2tp-gawk-to-perl.patch" diff --git a/user/netifrc/switch-l2tp-gawk-to-perl.patch b/user/netifrc/switch-l2tp-gawk-to-perl.patch new file mode 100644 index 000000000..9c8bc7e0c --- /dev/null +++ b/user/netifrc/switch-l2tp-gawk-to-perl.patch @@ -0,0 +1,92 @@ +diff --git a/net/l2tp.sh b/net/l2tp.sh +index 9644e32..24b081c 100644 +--- a/net/l2tp.sh ++++ b/net/l2tp.sh +@@ -37,9 +37,20 @@ _is_l2tp() { + ip l2tp show session &>/dev/null + [ $? -ne 0 ] && return 1 + +- eval "$(ip l2tp show session | \ +- awk "match(\$0, /^Session ([0-9]+) in tunnel ([0-9]+)\$/, ret) {sid=ret[1]; tid=ret[2]} +- match(\$0, /^[ ]*interface name: ${IFACE}\$/) {print \"session_id=\"sid\";tunnel_id=\"tid; exit}")" ++ eval "$(ip l2tp show session | perl -E ' ++my $sid; ++my $tid; ++my $IFACE=$ARGV[0]; ++while (<STDIN>) { ++ if($_ =~ /^Session ([0-9]+) in tunnel ([0-9+])\$/) { ++ $sid = $1; ++ $tid = $2; ++ } ++ if ($_ =~ /^[ ]*interface name: $IFACE$/) { ++ say "session_id=" . $sid . ";" . "tunnel_id=" . $tid; ++ exit; ++ } ++}' $IFACE)" + test -n "$session_id" + } + +@@ -49,33 +60,36 @@ _is_l2tp() { + _l2tp_get_tunnel_info() { + local found + eval "$(ip l2tp show tunnel | \ +- awk -v id=$2 -v prefix=$1 ' +- match($0, /^Tunnel ([0-9]+), encap (IP|UDP)$/, ret) { +- if (found == "1") exit; +- if (ret[1] == id) { +- print "found=1;" +- print prefix "tunnel_id=" ret[1] ";" +- print prefix "encap=" ret[2] ";"; +- found="1" +- } +- } +- match($0, /^[ ]*From ([^ ]+) to ([^ ]+)$/, ret) { +- if (found == "1") { +- print prefix "local=" ret[1] ";"; +- print prefix "remote=" ret[2] ";"; +- } +- } +- match($0, /^[ ]*Peer tunnel ([0-9]+)$/, ret) { +- if (found == "1") { +- print prefix "peer_tunnel_id=" ret[1] ";"; +- } +- } +- match($0, /^[ ]*UDP source \/ dest ports: ([0-9]+)\/([0-9]+)$/, ret) { +- if (found == "1") { +- print prefix "udp_sport=" ret[1] ";"; +- print prefix "udp_dport=" ret[2] ";"; +- } +- }')" ++ perl -E ' ++my ($prefix, $id) = @ARGV; ++my $found = 0; ++while(<STDIN>) { ++ if ($_ =~ /^Tunnel ([0-9]+), encap (IP|UDP)$/) { ++ if ($found) { ++ exit; ++ } ++ elsif ($1 == $id) { ++ say "found=1;"; ++ say $prefix . "tunnel_id=" . $1 . ";"; ++ say $prefix . "encap=" . $2 . ";"; ++ $found = 1; ++ } ++ } ++ elsif ($found) { ++ if ($_ =~ /^[ ]*From ([^ ]+) to ([^ \n]+)$/) { ++ say $prefix . "local=" . $1 . ";"; ++ say $prefix . "remote=" . $2 . ";"; ++ } ++ elsif ($_ =~ /^[ ]*Peer tunnel ([0-9]+)$/) { ++ say $prefix . "peer_tunnel_id=" . $1 . ";"; ++ } ++ elsif ($_ =~ /^[ ]*UDP source \/ dest ports: ([0-9]+)\/([0-9]+)$/) { ++ say $prefix . "udp_sport=" . $1 . ";"; ++ say $prefix . "udp_dport=" . $2 . ";"; ++ } ++ } ++} ++ ' "$1" "$2")" + test -n "$found" + } + |