~mser/pkg.mser.at

8fceca2e4a200ddf3e6c5a7f0c468b348ca0e025 — cryzed 2 years ago 585cfb3
unshare-net: use /proc/self/mounts directly
2 files changed, 4 insertions(+), 4 deletions(-)

M packages/unshare-net/PKGBUILD
M packages/unshare-net/unshare-net
M packages/unshare-net/PKGBUILD => packages/unshare-net/PKGBUILD +2 -2
@@ 1,6 1,6 @@
# Maintainer: Michael Serajnik <m at mser dot at>
pkgname=unshare-net
pkgver=10
pkgver=11
pkgrel=1
pkgdesc="Selectively whitelist traffic to specified IPs and domains for target applications"
arch=("any")


@@ 8,7 8,7 @@ url="https://git.sr.ht/~mser/pkg.mser.at/tree/master/item/packages/unshare-net"
license=("AGPL3")
depends=("python")
source=("unshare-net")
sha512sums=('0ec67b9a2706dbb386d428d4bf534fc74eb044cc1fb1db3875cb2ba205ec17bbb8824023617eb6c5c56a869c688fa51babc6bd3a62ddc9377d62656e761a43eb')
sha512sums=('482312f83c3c71bf83893a608a4dd54092853c6fbe7758b74ead0ca67645922b8e1b6829c7effbf58633e887f23d0d230ee809b58f9f1e96d8a1ad10d6118922')

package() {
  install -D --mode 755 "${srcdir}/unshare-net" --target-directory "${pkgdir}/usr/bin"

M packages/unshare-net/unshare-net => packages/unshare-net/unshare-net +2 -2
@@ 30,8 30,8 @@ import tempfile
import time
import typing as T

MOUNTS_PATH = pathlib.Path("/proc/self/mounts")
IPTABLES_MAX_CHAIN_NAME_LENGTH = 28
MOUNT_TABLE_PATH = pathlib.Path("/etc/mtab")


class ExitCode(enum.IntEnum):


@@ 114,7 114,7 @@ def umount(path: pathlib.Path) -> subprocess.CompletedProcess:

def find_cgroup_mount_paths() -> list[pathlib.Path]:
    paths = []
    for line in MOUNT_TABLE_PATH.read_text(encoding="utf-8").splitlines():
    for line in MOUNTS_PATH.read_text(encoding="utf-8").splitlines():
        name, path, type_, options, fs_freq, fs_passno = line.split()
        if type_ == "cgroup2":
            paths.append(pathlib.Path(path))