Skip to content

Commit

Permalink
tinc_pre: avoid infinite loop with EBADFD on network restart
Browse files Browse the repository at this point in the history
(cherry picked from commit 688dc4e)

cc #28789
  • Loading branch information
Volth authored and globin committed Aug 31, 2017
1 parent 768b390 commit c121e43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nixos/modules/services/networking/tinc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ in
serviceConfig = {
Type = "simple";
PIDFile = "/run/tinc.${network}.pid";
Restart = "on-failure";
Restart = "always";
RestartSec = "3";
};
preStart = ''
mkdir -p /etc/tinc/${network}/hosts
Expand Down
10 changes: 9 additions & 1 deletion pkgs/tools/networking/tinc/pre.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchgit, autoreconfHook, texinfo, ncurses, readline, zlib, lzo, openssl }:
{ stdenv, fetchgit, fetchpatch, autoreconfHook, texinfo, ncurses, readline, zlib, lzo, openssl }:

stdenv.mkDerivation rec {
name = "tinc-${version}";
Expand All @@ -19,6 +19,14 @@ stdenv.mkDerivation rec {
substituteInPlace configure.ac --replace UNKNOWN ${version}
'';

patches = [
# Avoid infinite loop with "Error while reading from Linux tun/tap device (tun mode) /dev/net/tun: File descriptor in bad state" on network restart
(fetchpatch {
url = https://github.com/gsliepen/tinc/compare/acefa66...e4544db.patch;
sha256 = "1jz7anqqzk7j96l5ifggc2knp14fmbsjdzfrbncxx0qhb6ihdcvn";
})
];

postInstall = ''
rm $out/bin/tinc-gui
'';
Expand Down

0 comments on commit c121e43

Please sign in to comment.