CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/packages/extras-buildpkgs/swconfig/debian/patches/add-switch-h.patch
Views: 3966
1
diff --git a/Makefile b/Makefile
2
index b142268..a72318a 100644
3
--- a/Makefile
4
+++ b/Makefile
5
@@ -1,6 +1,7 @@
6
ifndef CFLAGS
7
CFLAGS = -O2 -g -I /usr/include/libnl3/
8
endif
9
+CFLAGS += -I ./include/
10
LIBS=-lnl-3 -lnl-genl-3
11
all: swconfig
12
13
diff --git a/include/linux/switch.h b/include/linux/switch.h
14
new file mode 100644
15
index 0000000..a59b239
16
--- /dev/null
17
+++ b/include/linux/switch.h
18
@@ -0,0 +1,103 @@
19
+/*
20
+ * switch.h: Switch configuration API
21
+ *
22
+ * Copyright (C) 2008 Felix Fietkau <[email protected]>
23
+ *
24
+ * This program is free software; you can redistribute it and/or
25
+ * modify it under the terms of the GNU General Public License
26
+ * as published by the Free Software Foundation; either version 2
27
+ * of the License, or (at your option) any later version.
28
+ *
29
+ * This program is distributed in the hope that it will be useful,
30
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
31
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32
+ * GNU General Public License for more details.
33
+ */
34
+
35
+#ifndef _UAPI_LINUX_SWITCH_H
36
+#define _UAPI_LINUX_SWITCH_H
37
+
38
+#include <linux/types.h>
39
+#include <linux/netdevice.h>
40
+#include <linux/netlink.h>
41
+#include <linux/genetlink.h>
42
+#ifndef __KERNEL__
43
+#include <netlink/netlink.h>
44
+#include <netlink/genl/genl.h>
45
+#include <netlink/genl/ctrl.h>
46
+#endif
47
+
48
+/* main attributes */
49
+enum {
50
+ SWITCH_ATTR_UNSPEC,
51
+ /* global */
52
+ SWITCH_ATTR_TYPE,
53
+ /* device */
54
+ SWITCH_ATTR_ID,
55
+ SWITCH_ATTR_DEV_NAME,
56
+ SWITCH_ATTR_ALIAS,
57
+ SWITCH_ATTR_NAME,
58
+ SWITCH_ATTR_VLANS,
59
+ SWITCH_ATTR_PORTS,
60
+ SWITCH_ATTR_PORTMAP,
61
+ SWITCH_ATTR_CPU_PORT,
62
+ /* attributes */
63
+ SWITCH_ATTR_OP_ID,
64
+ SWITCH_ATTR_OP_TYPE,
65
+ SWITCH_ATTR_OP_NAME,
66
+ SWITCH_ATTR_OP_PORT,
67
+ SWITCH_ATTR_OP_VLAN,
68
+ SWITCH_ATTR_OP_VALUE_INT,
69
+ SWITCH_ATTR_OP_VALUE_STR,
70
+ SWITCH_ATTR_OP_VALUE_PORTS,
71
+ SWITCH_ATTR_OP_DESCRIPTION,
72
+ /* port lists */
73
+ SWITCH_ATTR_PORT,
74
+ SWITCH_ATTR_MAX
75
+};
76
+
77
+enum {
78
+ /* port map */
79
+ SWITCH_PORTMAP_PORTS,
80
+ SWITCH_PORTMAP_SEGMENT,
81
+ SWITCH_PORTMAP_VIRT,
82
+ SWITCH_PORTMAP_MAX
83
+};
84
+
85
+/* commands */
86
+enum {
87
+ SWITCH_CMD_UNSPEC,
88
+ SWITCH_CMD_GET_SWITCH,
89
+ SWITCH_CMD_NEW_ATTR,
90
+ SWITCH_CMD_LIST_GLOBAL,
91
+ SWITCH_CMD_GET_GLOBAL,
92
+ SWITCH_CMD_SET_GLOBAL,
93
+ SWITCH_CMD_LIST_PORT,
94
+ SWITCH_CMD_GET_PORT,
95
+ SWITCH_CMD_SET_PORT,
96
+ SWITCH_CMD_LIST_VLAN,
97
+ SWITCH_CMD_GET_VLAN,
98
+ SWITCH_CMD_SET_VLAN
99
+};
100
+
101
+/* data types */
102
+enum switch_val_type {
103
+ SWITCH_TYPE_UNSPEC,
104
+ SWITCH_TYPE_INT,
105
+ SWITCH_TYPE_STRING,
106
+ SWITCH_TYPE_PORTS,
107
+ SWITCH_TYPE_NOVAL,
108
+};
109
+
110
+/* port nested attributes */
111
+enum {
112
+ SWITCH_PORT_UNSPEC,
113
+ SWITCH_PORT_ID,
114
+ SWITCH_PORT_FLAG_TAGGED,
115
+ SWITCH_PORT_ATTR_MAX
116
+};
117
+
118
+#define SWITCH_ATTR_DEFAULTS_OFFSET 0x1000
119
+
120
+
121
+#endif /* _UAPI_LINUX_SWITCH_H */
122
123