summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Holden2021-01-03 17:35:12 +0000
committerJoe Holden2021-01-03 17:35:12 +0000
commitc63e8b5cd34bc9a4540b8298e2e49404d2913ea7 (patch)
tree504db98a3fb5a455606c9f4a9f80a206f71880ba
parent5fd27f956256f680f8976a3e417bc4a084f779f4 (diff)
downloadaur-c63e8b5cd34bc9a4540b8298e2e49404d2913ea7.tar.gz
add patch to make mtu configurable
-rwxr-xr-x.SRCINFO6
-rwxr-xr-xPKGBUILD8
-rw-r--r--add_mtu_config.patch104
-rw-r--r--dont_chown.patch13
4 files changed, 111 insertions, 20 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e43a34763b8b..19252001a79d 100755
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = vpncloud2
pkgdesc = Peer-to-peer VPN
pkgver = 2.0.1
- pkgrel = 3
+ pkgrel = 4
arch = x86_64
license = GPL
makedepends = rust
@@ -10,11 +10,11 @@ pkgbase = vpncloud2
depends = libsystemd
source = git+https://github.com/dswd/vpncloud.rs.git#tag=v2.0.1
source = sysusers.conf
- source = dont_chown.patch
+ source = add_mtu_config.patch
validpgpkeys = 6B5BBBCA2E3392315CC47434694A43B9C7FE6EA9
sha256sums = SKIP
sha256sums = eb756f1f940838cfe35555ba9e8e07d0e7182a72ace03853256ec5b72b0e8fbf
- sha256sums = 03b8e92bb3c9da005bac851ad531ec38624d4281b5afd57613a0fcd84c6d2ad8
+ sha256sums = b830058582bc276955569add40dd00be0ad2e94de58168494396419c82ed48ce
pkgname = vpncloud2
diff --git a/PKGBUILD b/PKGBUILD
index de1ca93c84de..120aa15f1dcc 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=vpncloud2
pkgver=2.0.1
-pkgrel=3
+pkgrel=4
pkgdesc='Peer-to-peer VPN'
arch=('x86_64')
url=""
@@ -9,16 +9,16 @@ depends=('libsystemd')
makedepends=('rust' 'cargo' 'git')
source=(git+https://github.com/dswd/vpncloud.rs.git#tag=v${pkgver}
sysusers.conf
- dont_chown.patch)
+ add_mtu_config.patch)
noextract=()
sha256sums=('SKIP'
'eb756f1f940838cfe35555ba9e8e07d0e7182a72ace03853256ec5b72b0e8fbf'
- '03b8e92bb3c9da005bac851ad531ec38624d4281b5afd57613a0fcd84c6d2ad8')
+ 'b830058582bc276955569add40dd00be0ad2e94de58168494396419c82ed48ce')
validpgpkeys=('6B5BBBCA2E3392315CC47434694A43B9C7FE6EA9')
prepare() {
cd vpncloud.rs
- patch -p1 < ${srcdir}/dont_chown.patch
+ patch -p1 < ${srcdir}/ff.patch
}
build() {
diff --git a/add_mtu_config.patch b/add_mtu_config.patch
new file mode 100644
index 000000000000..acbe02c5fc3e
--- /dev/null
+++ b/add_mtu_config.patch
@@ -0,0 +1,104 @@
+diff --git a/src/config.rs b/src/config.rs
+index 843bad5..df4117e 100644
+--- a/src/config.rs
++++ b/src/config.rs
+@@ -33,6 +33,7 @@ pub struct Config {
+ pub device_type: Type,
+ pub device_name: String,
+ pub device_path: Option<String>,
++ pub device_mtu: Option<usize>,
+ pub fix_rp_filter: bool,
+
+ pub ip: Option<String>,
+@@ -69,6 +70,7 @@ impl Default for Config {
+ device_type: Type::Tun,
+ device_name: "vpncloud%d".to_string(),
+ device_path: None,
++ device_mtu: None,
+ fix_rp_filter: false,
+ ip: None,
+ ifup: None,
+@@ -111,6 +113,9 @@ impl Config {
+ if let Some(val) = device.path {
+ self.device_path = Some(val);
+ }
++ if let Some(val) = device.mtu {
++ self.device_mtu = Some(val);
++ }
+ if let Some(val) = device.fix_rp_filter {
+ self.fix_rp_filter = val;
+ }
+@@ -210,6 +215,9 @@ impl Config {
+ if let Some(val) = args.device_path {
+ self.device_path = Some(val);
+ }
++ if let Some(val) = args.device_mtu {
++ self.device_mtu = Some(val);
++ }
+ if args.fix_rp_filter {
+ self.fix_rp_filter = true;
+ }
+@@ -316,6 +324,10 @@ pub struct Args {
+ #[structopt(long)]
+ pub device_path: Option<String>,
+
++ /// Set the interface mtu
++ #[structopt(long)]
++ pub device_mtu: Option<usize>,
++
+ /// Fix the rp_filter settings on the host
+ #[structopt(long)]
+ pub fix_rp_filter: bool,
+@@ -468,7 +480,8 @@ pub struct ConfigFileDevice {
+ pub type_: Option<Type>,
+ pub name: Option<String>,
+ pub path: Option<String>,
+- pub fix_rp_filter: Option<bool>
++ pub fix_rp_filter: Option<bool>,
++ pub mtu: Option<usize>
+ }
+
+ #[derive(Serialize, Deserialize, Debug, PartialEq, Default)]
+diff --git a/src/main.rs b/src/main.rs
+index 868c8d1..0699bba 100644
+--- a/src/main.rs
++++ b/src/main.rs
+@@ -140,7 +140,7 @@ fn setup_device(config: &Config) -> TunTapDevice {
+ config.device_name
+ );
+ info!("Opened device {}", device.ifname());
+- if let Err(err) = device.set_mtu(None) {
++ if let Err(err) = device.set_mtu(config.device_mtu) {
+ error!("Error setting optimal MTU on {}: {}", device.ifname(), err);
+ }
+ if let Some(ip) = &config.ip {
+diff --git a/src/oldconfig.rs b/src/oldconfig.rs
+index 0a717a0..c7b66a2 100644
+--- a/src/oldconfig.rs
++++ b/src/oldconfig.rs
+@@ -19,6 +19,8 @@ pub struct OldConfigFile {
+ pub device_name: Option<String>,
+ #[serde(alias = "device-path")]
+ pub device_path: Option<String>,
++ #[serde(alias = "device-mtu")]
++ pub device_mtu: Option<usize>,
+ pub ifup: Option<String>,
+ pub ifdown: Option<String>,
+ pub crypto: Option<OldCryptoMethod>,
+@@ -98,7 +100,8 @@ impl OldConfigFile {
+ fix_rp_filter: None,
+ name: self.device_name,
+ path: self.device_path,
+- type_: self.device_type
++ type_: self.device_type,
++ mtu: self.device_mtu
+ }),
+ group: self.group,
+ ifdown: self.ifdown,
+@@ -120,4 +123,4 @@ impl OldConfigFile {
+ user: self.user
+ }
+ }
+-}
+\ No newline at end of file
++}
diff --git a/dont_chown.patch b/dont_chown.patch
deleted file mode 100644
index f6500f820c1d..000000000000
--- a/dont_chown.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/main.rs b/src/main.rs
-index 868c8d1..4dc05f4 100644
---- a/src/main.rs
-+++ b/src/main.rs
-@@ -198,7 +198,7 @@ fn run<P: Protocol>(config: Config) {
- daemonize = daemonize.group(&group as &str);
- }
- if let Some(pid_file) = config.pid_file {
-- daemonize = daemonize.pid_file(pid_file).chown_pid_file(true);
-+ daemonize = daemonize.pid_file(pid_file).chown_pid_file(false);
- // Give child process some time to write PID file
- daemonize = daemonize.exit_action(|| thread::sleep(std::time::Duration::from_millis(10)));
- }