summary refs log tree commit diff
path: root/pkgs/os-specific/linux/iproute/1000-ubuntu-poc-fan-driver.patch
blob: ca91b81600083e74ca4dab031a98b1803f564e40 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
@@ -57,6 +57,9 @@ enum {
 	IFLA_IPTUN_ENCAP_FLAGS,
 	IFLA_IPTUN_ENCAP_SPORT,
 	IFLA_IPTUN_ENCAP_DPORT,
+
+	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(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);