fanctl, fan module: remove

This has been broken nearly all the time due to the patches needed to
iproute2 not being compatible with the newer versions we have been
shipping. As long as Ubuntu does not manage to upstream these changes
so they are maintained with iproute2 and we don't have a maintainer
updating these patches to new iproute2 versions it is not feasible to
have this available.
This commit is contained in:
Robin Gloster 2017-09-23 17:55:33 +02:00
parent 694e7e08d6
commit 08b09fdc5c
No known key found for this signature in database
GPG Key ID: D5C458DF6DD97EDF
9 changed files with 1 additions and 582 deletions

View File

@ -428,7 +428,6 @@
./services/networking/dnscrypt-wrapper.nix
./services/networking/dnsmasq.nix
./services/networking/ejabberd.nix
./services/networking/fan.nix
./services/networking/fakeroute.nix
./services/networking/ferm.nix
./services/networking/firefox/sync-server.nix

View File

@ -1,60 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.networking.fan;
modprobe = "${pkgs.kmod}/bin/modprobe";
in
{
###### interface
options = {
networking.fan = {
enable = mkEnableOption "FAN Networking";
};
};
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.fanctl ];
systemd.services.fan = {
description = "FAN Networking";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
before = [ "docker.service" ];
restartIfChanged = false;
preStart = ''
if [ ! -f /proc/sys/net/fan/version ]; then
${modprobe} ipip
if [ ! -f /proc/sys/net/fan/version ]; then
echo "The Fan Networking patches have not been applied to this kernel!" 1>&2
exit 1
fi
fi
mkdir -p /var/lib/fan-networking
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.fanctl}/bin/fanctl up -a";
ExecStop = "${pkgs.fanctl}/bin/fanctl down -a";
};
};
};
}

View File

@ -1,46 +0,0 @@
{ stdenv, lib, fetchurl, gnugrep, glibc, gawk, coreutils, bridge-utils, iproute
, dnsmasq, iptables, kmod, utillinux, gnused }:
stdenv.mkDerivation rec {
name = "fanctl-${version}";
version = "0.12.0";
src = fetchurl {
url = "https://launchpad.net/ubuntu/+archive/primary/+files/ubuntu-fan_${version}.tar.xz";
sha256 = "0lj7371n06sg5mlbbfgvm0qhzgp464n6v55rgs7kmmx4d37gb5fl";
};
# The Ubuntu package creates a number of state/config directories upon
# installation, and so the fanctl script expects those directories to exist
# before being used. Instead, we patch the fanctl script to gracefully handle
# the fact that the directories might not exist yet.
# Also, when dnsmasq is given --conf-file="", it will still attempt to read
# /etc/dnsmasq.conf; if that file does not exist, dnsmasq subsequently fails,
# so we'll use /dev/null, which actually works as intended.
patches = [ ./robustness.patch ];
postPatch = ''
substituteInPlace fanctl \
--replace '@PATH@' \
'${lib.makeBinPath [
gnugrep gawk coreutils bridge-utils iproute dnsmasq
iptables kmod utillinux gnused
glibc # needed for getent
]}'
'';
installPhase = ''
mkdir -p $out/bin $out/man/man8
cp fanctl.8 $out/man/man8
cp fanctl $out/bin
'';
meta = with lib; {
description = "Ubuntu FAN network support enablement";
homepage = https://launchpad.net/ubuntu/+source/ubuntu-fan;
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ cstrahan ];
};
}

View File

@ -1,85 +0,0 @@
diff --git a/fanctl b/fanctl
index 4338b75..84cf987 100755
--- a/fanctl
+++ b/fanctl
@@ -5,6 +5,8 @@
# fanctl down 15 10.1.0.1
#
+export PATH="@PATH@"
+
usage()
{
echo "Usage: $0 <cmd> [<options>...]" 1>&2
@@ -23,8 +25,8 @@ run()
"$@"
}
-state_dir="/run/ubuntu-fan"
-lconfig_dir="/var/lib/ubuntu-fan/config"
+state_dir="/run/fan-networking"
+lconfig_dir="/var/lib/fan-networking/config"
__ip_split()
{
@@ -931,12 +933,12 @@ dhcp_reconfigure()
--strict-order \
--bind-interfaces \
--pid-file="$state_dir/dnsmasq-$C_bridge_state.pid" \
- --conf-file= \
+ --conf-file=/dev/null \
$dhcp_flags \
--dhcp-no-override \
--except-interface=lo \
--interface="$C_bridge" \
- --dhcp-leasefile=/var/lib/misc/dnsmasq."$C_bridge_state".leases \
+ --dhcp-leasefile=/var/lib/fan-networking/dnsmasq."$C_bridge_state".leases \
--dhcp-authoritative \
|| $fail "$C_bridge: failed to start dnsmasq"
@@ -1559,21 +1561,23 @@ cmd_config()
case "$cmd" in
list|ls)
- ls -1 "$lconfig_dir" | \
- while read config
- do
- case "$config" in
- *.conf) ;;
- *) continue ;;
- esac
+ if [ -d $lconfig_dir ]; then
+ ls -1 "$lconfig_dir" | \
+ while read config
+ do
+ case "$config" in
+ *.conf) ;;
+ *) continue ;;
+ esac
- config=$( echo "$config" | sed \
- -e 's/.conf$//' \
- -e 's/--/ /g' \
- -e 's@-@/@g'
- )
- echo "$config"
- done
+ config=$( echo "$config" | sed \
+ -e 's/.conf$//' \
+ -e 's/--/ /g' \
+ -e 's@-@/@g'
+ )
+ echo "$config"
+ done
+ fi
;;
show)
cmd_decode_init
@@ -1588,6 +1592,7 @@ cmd_config()
[ -f "$uconfig" ] && cat "$uconfig"
;;
set)
+ mkdir -p $lconfig_dir || fail "could not create config directory ($lconfig_dir)"
cmd_decode_init
if ! cmd_decode_config "config set" "$@"; then
fail "invalid config"

View File

@ -1,65 +0,0 @@
Description: POC fan driver support
POC Fan driver support
Author: Jay Vosburgh <jay.vosburgh@canonical.com>
Index: iproute2-4.1.1/include/linux/if_tunnel.h
===================================================================
--- iproute2-4.1.1.orig/include/linux/if_tunnel.h
+++ iproute2-4.1.1/include/linux/if_tunnel.h
@@ -75,6 +75,9 @@ enum {
IFLA_IPTUN_ENCAP_SPORT,
IFLA_IPTUN_ENCAP_DPORT,
IFLA_IPTUN_COLLECT_METADATA,
+
+ IFLA_IPTUN_FAN_UNDERLAY = 32,
+
__IFLA_IPTUN_MAX,
};
#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
Index: iproute2-4.1.1/ip/link_iptnl.c
===================================================================
--- iproute2-4.1.1.orig/ip/link_iptnl.c
+++ iproute2-4.1.1/ip/link_iptnl.c
@@ -66,6 +66,7 @@ static int iptunnel_parse_opt(struct lin
__u32 link = 0;
__u32 laddr = 0;
__u32 raddr = 0;
+ __u32 underlay = 0;
__u8 ttl = 0;
__u8 tos = 0;
__u8 pmtudisc = 1;
@@ -174,6 +175,9 @@ get_failed:
raddr = get_addr32(*argv);
else
raddr = 0;
+ } else if (strcmp(*argv, "underlay") == 0) {
+ NEXT_ARG();
+ underlay = get_addr32(*argv);
} else if (strcmp(*argv, "local") == 0) {
NEXT_ARG();
if (strcmp(*argv, "any"))
@@ -318,6 +322,9 @@ get_failed:
}
}
+ if (underlay)
+ addattr32(n, 1024, IFLA_IPTUN_FAN_UNDERLAY, underlay);
+
return 0;
}
@@ -349,6 +356,14 @@ static void iptunnel_print_opt(struct li
fprintf(f, "local %s ", local);
+ if (tb[IFLA_IPTUN_FAN_UNDERLAY]) {
+ unsigned addr = rta_getattr_u32(tb[IFLA_IPTUN_FAN_UNDERLAY]);
+
+ if (addr)
+ fprintf(f, "underlay %s ",
+ format_host_r(AF_INET, 4, &addr, s1, sizeof(s1)));
+ }
+
if (tb[IFLA_IPTUN_LINK] && rta_getattr_u32(tb[IFLA_IPTUN_LINK])) {
unsigned link = rta_getattr_u32(tb[IFLA_IPTUN_LINK]);
const char *n = if_indextoname(link, s2);

View File

@ -1,133 +0,0 @@
Description: Fan driver support v3
Fan driver support v3
Author: Jay Vosburgh <jay.vosburgh@canonical.com>
Index: iproute2-4.1.1/include/linux/if_tunnel.h
===================================================================
--- iproute2-4.1.1.orig/include/linux/if_tunnel.h
+++ iproute2-4.1.1/include/linux/if_tunnel.h
@@ -59,6 +59,7 @@ enum {
IFLA_IPTUN_ENCAP_DPORT,
IFLA_IPTUN_FAN_UNDERLAY = 32,
+ IFLA_IPTUN_FAN_MAP = 33,
__IFLA_IPTUN_MAX,
};
@@ -134,4 +135,20 @@ enum {
};
#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
+
+enum {
+ IFLA_FAN_UNSPEC,
+ IFLA_FAN_MAPPING,
+ __IFLA_FAN_MAX,
+};
+
+#define IFLA_FAN_MAX (__IFLA_FAN_MAX - 1)
+
+struct ip_tunnel_fan_map {
+ __be32 underlay;
+ __be32 overlay;
+ __u16 underlay_prefix;
+ __u16 overlay_prefix;
+};
+
#endif /* _IF_TUNNEL_H_ */
Index: iproute2-4.1.1/ip/link_iptnl.c
===================================================================
--- iproute2-4.1.1.orig/ip/link_iptnl.c
+++ iproute2-4.1.1/ip/link_iptnl.c
@@ -49,6 +49,42 @@ static void usage(int sit)
print_usage(stderr, sit);
exit(-1);
}
+static int fan_parse_map(int *argcp, char ***argvp, struct nlmsghdr *n)
+{
+ inet_prefix underlay, overlay;
+ struct ip_tunnel_fan_map map;
+ struct rtattr *nest;
+ char **argv = *argvp;
+ int argc = *argcp;
+
+ nest = addattr_nest(n, 1024, IFLA_IPTUN_FAN_MAP);
+ while (argc > 0) {
+ char *colon = strchr(*argv, ':');
+
+ if (!colon)
+ break;
+ *colon = '\0';
+
+ if (get_prefix(&overlay, *argv, AF_INET))
+ invarg("invalid fan-map overlay", *argv);
+ if (get_prefix(&underlay, colon + 1, AF_INET))
+ invarg("invalid fan-map underlay", colon + 1);
+
+ memcpy(&map.underlay, underlay.data, 4);
+ map.underlay_prefix = underlay.bitlen;
+ memcpy(&map.overlay, overlay.data, 4);
+ map.overlay_prefix = overlay.bitlen;
+
+ argc--, argv++;
+
+ addattr_l(n, 1024, IFLA_FAN_MAPPING, &map, sizeof(map));
+ }
+ addattr_nest_end(n, nest);
+
+ *argcp = argc;
+ *argvp = argv;
+ return 0;
+}
static int iptunnel_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
@@ -178,6 +214,10 @@ get_failed:
} else if (strcmp(*argv, "underlay") == 0) {
NEXT_ARG();
underlay = get_addr32(*argv);
+ } else if (strcmp(*argv, "fan-map") == 0) {
+ NEXT_ARG();
+ if (fan_parse_map(&argc, &argv, n))
+ invarg("invalid fan-map", *argv);
} else if (strcmp(*argv, "local") == 0) {
NEXT_ARG();
if (strcmp(*argv, "any"))
@@ -328,6 +368,28 @@ get_failed:
return 0;
}
+static void fan_print_map(FILE *f, struct rtattr *attr)
+{
+ char b1[INET_ADDRSTRLEN], b2[INET_ADDRSTRLEN];
+ struct ip_tunnel_fan_map *m;
+ struct rtattr *i;
+ int rem;
+ int p;
+
+ fprintf(f, "fan-map ");
+
+ rem = RTA_PAYLOAD(attr);
+ for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {
+ p = RTA_PAYLOAD(i);
+ m = RTA_DATA(i);
+ fprintf(f, "%s/%d:%s/%d ",
+ rt_addr_n2a_r(AF_INET, p, &m->overlay, b1, INET_ADDRSTRLEN),
+ m->overlay_prefix,
+ rt_addr_n2a_r(AF_INET, p, &m->underlay, b2, INET_ADDRSTRLEN),
+ m->underlay_prefix);
+ }
+}
+
static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
char s1[1024];
@@ -364,6 +426,9 @@ static void iptunnel_print_opt(struct li
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
}
+ if (tb[IFLA_IPTUN_FAN_MAP])
+ fan_print_map(f, tb[IFLA_IPTUN_FAN_MAP]);
+
if (tb[IFLA_IPTUN_LINK] && rta_getattr_u32(tb[IFLA_IPTUN_LINK])) {
unsigned link = rta_getattr_u32(tb[IFLA_IPTUN_LINK]);
const char *n = if_indextoname(link, s2);

View File

@ -1,177 +0,0 @@
Description: Fan driver support VXLAN (p4)
Fan driver setup support for vxlan interfaces.
Index: iproute2-4.3.0/include/linux/if_link.h
===================================================================
--- iproute2-4.3.0.orig/include/linux/if_link.h
+++ iproute2-4.3.0/include/linux/if_link.h
@@ -392,6 +392,7 @@ enum {
IFLA_VXLAN_COLLECT_METADATA,
IFLA_VXLAN_LABEL,
IFLA_VXLAN_GPE,
+ IFLA_VXLAN_FAN_MAP = 33,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
Index: iproute2-4.3.0/include/linux/if_tunnel.h
===================================================================
--- iproute2-4.3.0.orig/include/linux/if_tunnel.h
+++ iproute2-4.3.0/include/linux/if_tunnel.h
@@ -145,7 +145,7 @@ enum {
#define IFLA_FAN_MAX (__IFLA_FAN_MAX - 1)
-struct ip_tunnel_fan_map {
+struct ifla_fan_map {
__be32 underlay;
__be32 overlay;
__u16 underlay_prefix;
Index: iproute2-4.3.0/ip/iplink_vxlan.c
===================================================================
--- iproute2-4.3.0.orig/ip/iplink_vxlan.c
+++ iproute2-4.3.0/ip/iplink_vxlan.c
@@ -15,7 +15,10 @@
#include <net/if.h>
#include <linux/ip.h>
#include <linux/if_link.h>
+#include <linux/types.h>
#include <arpa/inet.h>
+#include <linux/in6.h>
+#include <linux/if_tunnel.h>
#include "rt_names.h"
#include "utils.h"
@@ -43,6 +46,45 @@ static void explain(void)
print_explain(stderr);
}
+static int fan_parse_map(int *argcp, char ***argvp, struct nlmsghdr *n)
+{
+ inet_prefix underlay, overlay;
+ struct ifla_fan_map map;
+ struct rtattr *nest;
+ char **argv = *argvp;
+ int argc = *argcp;
+
+ nest = addattr_nest(n, 1024, IFLA_VXLAN_FAN_MAP);
+ while (argc > 0) {
+ char *colon = strchr(*argv, ':');
+
+ if (!colon) {
+ PREV_ARG();
+ break;
+ }
+ *colon = '\0';
+
+ if (get_prefix(&overlay, *argv, AF_INET))
+ invarg("invalid fan-map overlay", *argv);
+ if (get_prefix(&underlay, colon + 1, AF_INET))
+ invarg("invalid fan-map underlay", colon + 1);
+
+ memcpy(&map.underlay, underlay.data, 4);
+ map.underlay_prefix = underlay.bitlen;
+ memcpy(&map.overlay, overlay.data, 4);
+ map.overlay_prefix = overlay.bitlen;
+
+ argc--, argv++;
+
+ addattr_l(n, 1024, IFLA_FAN_MAPPING, &map, sizeof(map));
+ }
+ addattr_nest_end(n, nest);
+
+ *argcp = argc;
+ *argvp = argv;
+ return 0;
+}
+
static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
@@ -201,6 +243,10 @@ static int vxlan_parse_opt(struct link_u
gbp = 1;
} else if (!matches(*argv, "gpe")) {
gpe = 1;
+ } else if (!matches(*argv, "fan-map")) {
+ NEXT_ARG();
+ if (fan_parse_map(&argc, &argv, n))
+ invarg("invalid fan-map", *argv);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
@@ -279,6 +325,28 @@ static int vxlan_parse_opt(struct link_u
return 0;
}
+static void fan_print_map(FILE *f, struct rtattr *attr)
+{
+ char b1[INET_ADDRSTRLEN], b2[INET_ADDRSTRLEN];
+ struct ifla_fan_map *m;
+ struct rtattr *i;
+ int rem;
+ int p;
+
+ fprintf(f, "fan-map ");
+
+ rem = RTA_PAYLOAD(attr);
+ for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {
+ p = RTA_PAYLOAD(i);
+ m = RTA_DATA(i);
+ fprintf(f, "%s/%d:%s/%d ",
+ rt_addr_n2a_r(AF_INET, p, &m->overlay, b1, INET_ADDRSTRLEN),
+ m->overlay_prefix,
+ rt_addr_n2a_r(AF_INET, p, &m->underlay, b2, INET_ADDRSTRLEN),
+ m->underlay_prefix);
+ }
+}
+
static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
__u32 vni;
@@ -321,6 +389,9 @@ static void vxlan_print_opt(struct link_
}
}
+ if (tb[IFLA_VXLAN_FAN_MAP])
+ fan_print_map(f, tb[IFLA_VXLAN_FAN_MAP]);
+
if (tb[IFLA_VXLAN_LOCAL]) {
__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_LOCAL]);
if (addr)
Index: iproute2-4.3.0/ip/link_iptnl.c
===================================================================
--- iproute2-4.3.0.orig/ip/link_iptnl.c
+++ iproute2-4.3.0/ip/link_iptnl.c
@@ -49,10 +49,11 @@ static void usage(int sit)
print_usage(stderr, sit);
exit(-1);
}
+
static int fan_parse_map(int *argcp, char ***argvp, struct nlmsghdr *n)
{
inet_prefix underlay, overlay;
- struct ip_tunnel_fan_map map;
+ struct ifla_fan_map map;
struct rtattr *nest;
char **argv = *argvp;
int argc = *argcp;
@@ -61,8 +62,10 @@ static int fan_parse_map(int *argcp, cha
while (argc > 0) {
char *colon = strchr(*argv, ':');
- if (!colon)
+ if (!colon) {
+ PREV_ARG();
break;
+ }
*colon = '\0';
if (get_prefix(&overlay, *argv, AF_INET))
@@ -371,7 +374,7 @@ get_failed:
static void fan_print_map(FILE *f, struct rtattr *attr)
{
char b1[INET_ADDRSTRLEN], b2[INET_ADDRSTRLEN];
- struct ip_tunnel_fan_map *m;
+ struct ifla_fan_map *m;
struct rtattr *i;
int rem;
int p;

View File

@ -1,6 +1,4 @@
{ fetchurl, stdenv, lib, flex, bison, db, iptables, pkgconfig
, enableFan ? false
}:
{ fetchurl, stdenv, lib, flex, bison, db, iptables, pkgconfig }:
stdenv.mkDerivation rec {
name = "iproute2-${version}";
@ -11,14 +9,6 @@ stdenv.mkDerivation rec {
sha256 = "0zdxdsxyaazl85xhwskvsmpyzwf5qp21cvjsi1lw3xnrc914q2if";
};
patches = lib.optionals enableFan [
# These patches were pulled from:
# https://launchpad.net/ubuntu/xenial/+source/iproute2
./1000-ubuntu-poc-fan-driver.patch
./1001-ubuntu-poc-fan-driver-v3.patch
./1002-ubuntu-poc-fan-driver-vxlan.patch
];
preConfigure = ''
patchShebangs ./configure
sed -e '/ARPDDIR/d' -i Makefile

View File

@ -12059,10 +12059,6 @@ with pkgs;
facetimehd-firmware = callPackage ../os-specific/linux/firmware/facetimehd-firmware { };
fanctl = callPackage ../os-specific/linux/fanctl {
iproute = iproute.override { enableFan = true; };
};
fatrace = callPackage ../os-specific/linux/fatrace { };
ffadoFull = callPackage ../os-specific/linux/ffado {