diff options
author | Lukasz Nowak <lnowak@tycoint.com> | 2016-12-13 16:19:28 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-16 10:23:22 +0000 |
commit | b010c327c7759cb55490128b92c3cd0bf1fc8fdf (patch) | |
tree | 61eb364704ee3e04e4688e5c1104fb3e3ef8d0af /meta | |
parent | d535aba974d47802c80ea1f9c678c0e8351523bb (diff) | |
download | poky-b010c327c7759cb55490128b92c3cd0bf1fc8fdf.tar.gz |
busybox: allow libiproute to handle table ids larger than 255
These changes are required for compatibility with ConnMan, which by default
uses table ids greater than 255.
(From OE-Core rev: e9114bdd8a83b88f59526780910c49e3092fdd57)
Signed-off-by: Lukasz Nowak <lnowak@tycoint.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/busybox/busybox/0001-libiproute-handle-table-ids-larger-than-255.patch | 134 | ||||
-rw-r--r-- | meta/recipes-core/busybox/busybox_1.24.1.bb | 1 |
2 files changed, 135 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/0001-libiproute-handle-table-ids-larger-than-255.patch b/meta/recipes-core/busybox/busybox/0001-libiproute-handle-table-ids-larger-than-255.patch new file mode 100644 index 0000000000..aac5b4029b --- /dev/null +++ b/meta/recipes-core/busybox/busybox/0001-libiproute-handle-table-ids-larger-than-255.patch | |||
@@ -0,0 +1,134 @@ | |||
1 | From b5a9234272e6084557224c73ab7737ed47f09848 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lukasz Nowak <lnowak@tycoint.com> | ||
3 | Date: Wed, 23 Nov 2016 12:48:21 +0000 | ||
4 | Subject: [PATCH v2] libiproute: handle table ids larger than 255 | ||
5 | |||
6 | Linux kernel, starting from 2.6.19 allows ip table ids to have 32-bit values. | ||
7 | In order to preserve compatibility, the old 8-bit field: rtm_table is still | ||
8 | in use when table id is lower than 256. | ||
9 | |||
10 | Add support for the 32-bit table id (RTA_TABLE attribute) in: | ||
11 | - ip route print | ||
12 | - ip route modify | ||
13 | - ip rule print | ||
14 | - ip rule modify | ||
15 | |||
16 | Add printing of table ids to ip route. | ||
17 | |||
18 | Changes are compatible with the mainline iproute2 utilities. | ||
19 | |||
20 | These changes are required for compatibility with ConnMan, which by default | ||
21 | uses table ids greater than 255. | ||
22 | |||
23 | Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2016-December/084989.html] | ||
24 | |||
25 | Signed-off-by: Lukasz Nowak <lnowak@tycoint.com> | ||
26 | --- | ||
27 | networking/libiproute/iproute.c | 24 ++++++++++++++++++++---- | ||
28 | networking/libiproute/iprule.c | 11 +++++++++-- | ||
29 | 2 files changed, 29 insertions(+), 6 deletions(-) | ||
30 | |||
31 | diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c | ||
32 | index 6ecd5f7..d5af498 100644 | ||
33 | --- a/networking/libiproute/iproute.c | ||
34 | +++ b/networking/libiproute/iproute.c | ||
35 | @@ -87,6 +87,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | ||
36 | inet_prefix dst; | ||
37 | inet_prefix src; | ||
38 | int host_len = -1; | ||
39 | + uint32_t tid; | ||
40 | |||
41 | if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) { | ||
42 | fprintf(stderr, "Not a route: %08x %08x %08x\n", | ||
43 | @@ -99,6 +100,14 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | ||
44 | if (len < 0) | ||
45 | bb_error_msg_and_die("wrong nlmsg len %d", len); | ||
46 | |||
47 | + memset(tb, 0, sizeof(tb)); | ||
48 | + parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); | ||
49 | + | ||
50 | + if (tb[RTA_TABLE]) | ||
51 | + tid = *(uint32_t *)RTA_DATA(tb[RTA_TABLE]); | ||
52 | + else | ||
53 | + tid = r->rtm_table; | ||
54 | + | ||
55 | if (r->rtm_family == AF_INET6) | ||
56 | host_len = 128; | ||
57 | else if (r->rtm_family == AF_INET) | ||
58 | @@ -128,7 +137,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | ||
59 | } | ||
60 | } | ||
61 | } else { | ||
62 | - if (G_filter.tb > 0 && G_filter.tb != r->rtm_table) { | ||
63 | + if (G_filter.tb > 0 && G_filter.tb != tid) { | ||
64 | return 0; | ||
65 | } | ||
66 | } | ||
67 | @@ -157,10 +166,8 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | - memset(tb, 0, sizeof(tb)); | ||
72 | memset(&src, 0, sizeof(src)); | ||
73 | memset(&dst, 0, sizeof(dst)); | ||
74 | - parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); | ||
75 | |||
76 | if (tb[RTA_SRC]) { | ||
77 | src.bitlen = r->rtm_src_len; | ||
78 | @@ -283,6 +290,10 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | ||
79 | if (tb[RTA_OIF]) { | ||
80 | printf("dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); | ||
81 | } | ||
82 | +#if ENABLE_FEATURE_IP_RULE | ||
83 | + if (tid && tid != RT_TABLE_MAIN && !G_filter.tb) | ||
84 | + printf("table %s ", rtnl_rttable_n2a(tid)); | ||
85 | +#endif | ||
86 | |||
87 | /* Todo: parse & show "proto kernel", "scope link" here */ | ||
88 | |||
89 | @@ -434,7 +445,12 @@ IF_FEATURE_IP_RULE(ARG_table,) | ||
90 | NEXT_ARG(); | ||
91 | if (rtnl_rttable_a2n(&tid, *argv)) | ||
92 | invarg(*argv, "table"); | ||
93 | - req.r.rtm_table = tid; | ||
94 | + if (tid < 256) | ||
95 | + req.r.rtm_table = tid; | ||
96 | + else { | ||
97 | + req.r.rtm_table = RT_TABLE_UNSPEC; | ||
98 | + addattr32(&req.n, sizeof(req), RTA_TABLE, tid); | ||
99 | + } | ||
100 | #endif | ||
101 | } else if (arg == ARG_dev || arg == ARG_oif) { | ||
102 | NEXT_ARG(); | ||
103 | diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c | ||
104 | index 774a3e2..3fac7c5 100644 | ||
105 | --- a/networking/libiproute/iprule.c | ||
106 | +++ b/networking/libiproute/iprule.c | ||
107 | @@ -119,7 +119,9 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, | ||
108 | printf("iif %s ", (char*)RTA_DATA(tb[RTA_IIF])); | ||
109 | } | ||
110 | |||
111 | - if (r->rtm_table) | ||
112 | + if (tb[RTA_TABLE]) | ||
113 | + printf("lookup %s ", rtnl_rttable_n2a(*(uint32_t*)RTA_DATA(tb[RTA_TABLE]))); | ||
114 | + else if (r->rtm_table) | ||
115 | printf("lookup %s ", rtnl_rttable_n2a(r->rtm_table)); | ||
116 | |||
117 | if (tb[RTA_FLOW]) { | ||
118 | @@ -259,7 +261,12 @@ static int iprule_modify(int cmd, char **argv) | ||
119 | NEXT_ARG(); | ||
120 | if (rtnl_rttable_a2n(&tid, *argv)) | ||
121 | invarg(*argv, "table ID"); | ||
122 | - req.r.rtm_table = tid; | ||
123 | + if (tid < 256) | ||
124 | + req.r.rtm_table = tid; | ||
125 | + else { | ||
126 | + req.r.rtm_table = RT_TABLE_UNSPEC; | ||
127 | + addattr32(&req.n, sizeof(req), RTA_TABLE, tid); | ||
128 | + } | ||
129 | table_ok = 1; | ||
130 | } else if (key == ARG_dev || | ||
131 | key == ARG_iif | ||
132 | -- | ||
133 | 2.7.4 | ||
134 | |||
diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb index df0e131266..c35cba3222 100644 --- a/meta/recipes-core/busybox/busybox_1.24.1.bb +++ b/meta/recipes-core/busybox/busybox_1.24.1.bb | |||
@@ -53,6 +53,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ | |||
53 | file://busybox-kbuild-race-fix-commit-d8e61bb.patch \ | 53 | file://busybox-kbuild-race-fix-commit-d8e61bb.patch \ |
54 | file://commit-applet_tables-fix-commit-0dddbc1.patch \ | 54 | file://commit-applet_tables-fix-commit-0dddbc1.patch \ |
55 | file://makefile-libbb-race.patch \ | 55 | file://makefile-libbb-race.patch \ |
56 | file://0001-libiproute-handle-table-ids-larger-than-255.patch \ | ||
56 | " | 57 | " |
57 | SRC_URI_append_libc-musl = " file://musl.cfg " | 58 | SRC_URI_append_libc-musl = " file://musl.cfg " |
58 | 59 | ||