|
24 | 24 |
|
25 | 25 | #include "test_progs.h"
|
26 | 26 | #include "network_helpers.h"
|
27 |
| -#include "netlink_helpers.h" |
28 | 27 | #include "test_tc_neigh_fib.skel.h"
|
29 | 28 | #include "test_tc_neigh.skel.h"
|
30 | 29 | #include "test_tc_peer.skel.h"
|
@@ -113,7 +112,6 @@ static void netns_setup_namespaces_nofail(const char *verb)
|
113 | 112 |
|
114 | 113 | enum dev_mode {
|
115 | 114 | MODE_VETH,
|
116 |
| - MODE_NETKIT, |
117 | 115 | };
|
118 | 116 |
|
119 | 117 | struct netns_setup_result {
|
@@ -144,66 +142,18 @@ static int get_ifaddr(const char *name, char *ifaddr)
|
144 | 142 | return 0;
|
145 | 143 | }
|
146 | 144 |
|
147 |
| -static int create_netkit(int mode, char *prim, char *peer) |
148 |
| -{ |
149 |
| - struct rtattr *linkinfo, *data, *peer_info; |
150 |
| - struct rtnl_handle rth = { .fd = -1 }; |
151 |
| - const char *type = "netkit"; |
152 |
| - struct { |
153 |
| - struct nlmsghdr n; |
154 |
| - struct ifinfomsg i; |
155 |
| - char buf[1024]; |
156 |
| - } req = {}; |
157 |
| - int err; |
158 |
| - |
159 |
| - err = rtnl_open(&rth, 0); |
160 |
| - if (!ASSERT_OK(err, "open_rtnetlink")) |
161 |
| - return err; |
162 |
| - |
163 |
| - memset(&req, 0, sizeof(req)); |
164 |
| - req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); |
165 |
| - req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL; |
166 |
| - req.n.nlmsg_type = RTM_NEWLINK; |
167 |
| - req.i.ifi_family = AF_UNSPEC; |
168 |
| - |
169 |
| - addattr_l(&req.n, sizeof(req), IFLA_IFNAME, prim, strlen(prim)); |
170 |
| - linkinfo = addattr_nest(&req.n, sizeof(req), IFLA_LINKINFO); |
171 |
| - addattr_l(&req.n, sizeof(req), IFLA_INFO_KIND, type, strlen(type)); |
172 |
| - data = addattr_nest(&req.n, sizeof(req), IFLA_INFO_DATA); |
173 |
| - addattr32(&req.n, sizeof(req), IFLA_NETKIT_MODE, mode); |
174 |
| - peer_info = addattr_nest(&req.n, sizeof(req), IFLA_NETKIT_PEER_INFO); |
175 |
| - req.n.nlmsg_len += sizeof(struct ifinfomsg); |
176 |
| - addattr_l(&req.n, sizeof(req), IFLA_IFNAME, peer, strlen(peer)); |
177 |
| - addattr_nest_end(&req.n, peer_info); |
178 |
| - addattr_nest_end(&req.n, data); |
179 |
| - addattr_nest_end(&req.n, linkinfo); |
180 |
| - |
181 |
| - err = rtnl_talk(&rth, &req.n, NULL); |
182 |
| - ASSERT_OK(err, "talk_rtnetlink"); |
183 |
| - rtnl_close(&rth); |
184 |
| - return err; |
185 |
| -} |
186 |
| - |
187 | 145 | static int netns_setup_links_and_routes(struct netns_setup_result *result)
|
188 | 146 | {
|
189 | 147 | struct nstoken *nstoken = NULL;
|
190 | 148 | char src_fwd_addr[IFADDR_STR_LEN+1] = {};
|
191 | 149 | char src_addr[IFADDR_STR_LEN + 1] = {};
|
192 |
| - int err; |
193 | 150 |
|
194 | 151 | if (result->dev_mode == MODE_VETH) {
|
195 | 152 | SYS(fail, "ip link add src type veth peer name src_fwd");
|
196 | 153 | SYS(fail, "ip link add dst type veth peer name dst_fwd");
|
197 | 154 |
|
198 | 155 | SYS(fail, "ip link set dst_fwd address " MAC_DST_FWD);
|
199 | 156 | SYS(fail, "ip link set dst address " MAC_DST);
|
200 |
| - } else if (result->dev_mode == MODE_NETKIT) { |
201 |
| - err = create_netkit(NETKIT_L3, "src", "src_fwd"); |
202 |
| - if (!ASSERT_OK(err, "create_ifindex_src")) |
203 |
| - goto fail; |
204 |
| - err = create_netkit(NETKIT_L3, "dst", "dst_fwd"); |
205 |
| - if (!ASSERT_OK(err, "create_ifindex_dst")) |
206 |
| - goto fail; |
207 | 157 | }
|
208 | 158 |
|
209 | 159 | if (get_ifaddr("src_fwd", src_fwd_addr))
|
@@ -1266,9 +1216,7 @@ static void *test_tc_redirect_run_tests(void *arg)
|
1266 | 1216 | netns_setup_namespaces_nofail("delete");
|
1267 | 1217 |
|
1268 | 1218 | RUN_TEST(tc_redirect_peer, MODE_VETH);
|
1269 |
| - RUN_TEST(tc_redirect_peer, MODE_NETKIT); |
1270 | 1219 | RUN_TEST(tc_redirect_peer_l3, MODE_VETH);
|
1271 |
| - RUN_TEST(tc_redirect_peer_l3, MODE_NETKIT); |
1272 | 1220 | RUN_TEST(tc_redirect_neigh, MODE_VETH);
|
1273 | 1221 | RUN_TEST(tc_redirect_neigh_fib, MODE_VETH);
|
1274 | 1222 | RUN_TEST(tc_redirect_dtime, MODE_VETH);
|
|
0 commit comments