blob: 8f3f86286466f7165080997fdbf86fb5b6820abe [file] [log] [blame]
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +00001/* vi: set sw=4 ts=4: */
2/*
Denys Vlasenkofb132e42010-10-29 11:46:52 +02003 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; either version
6 * 2 of the License, or (at your option) any later version.
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +00007 *
Denys Vlasenkofb132e42010-10-29 11:46:52 +02008 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +00009 *
10 * Changes:
11 *
Denys Vlasenkofb132e42010-10-29 11:46:52 +020012 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
Bernhard Reutner-Fischer6c4dade2008-09-25 12:13:34 +000013 * initially integrated into busybox by Bernhard Reutner-Fischer
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000014 */
15
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000016#include <netinet/in.h>
17#include <netinet/ip.h>
18#include <arpa/inet.h>
19
Denis Vlasenko9a7d38f2007-05-31 22:42:12 +000020#include "ip_common.h" /* #include "libbb.h" is inside */
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000021#include "rt_names.h"
22#include "utils.h"
Denis Vlasenko9a7d38f2007-05-31 22:42:12 +000023
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000024/*
25static void usage(void) __attribute__((noreturn));
26
27static void usage(void)
28{
29 fprintf(stderr, "Usage: ip rule [ list | add | del ] SELECTOR ACTION\n");
30 fprintf(stderr, "SELECTOR := [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK ]\n");
31 fprintf(stderr, " [ dev STRING ] [ pref NUMBER ]\n");
32 fprintf(stderr, "ACTION := [ table TABLE_ID ] [ nat ADDRESS ]\n");
33 fprintf(stderr, " [ prohibit | reject | unreachable ]\n");
34 fprintf(stderr, " [ realms [SRCREALM/]DSTREALM ]\n");
35 fprintf(stderr, "TABLE_ID := [ local | main | default | NUMBER ]\n");
36 exit(-1);
37}
38*/
Denis Vlasenko9a7d38f2007-05-31 22:42:12 +000039
Denys Vlasenkod5f1b1b2009-06-05 12:06:05 +020040static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM,
Denis Vlasenkoa60f84e2008-07-05 09:18:54 +000041 struct nlmsghdr *n, void *arg UNUSED_PARAM)
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000042{
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000043 struct rtmsg *r = NLMSG_DATA(n);
44 int len = n->nlmsg_len;
45 int host_len = -1;
46 struct rtattr * tb[RTA_MAX+1];
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000047
48 if (n->nlmsg_type != RTM_NEWRULE)
49 return 0;
50
51 len -= NLMSG_LENGTH(sizeof(*r));
52 if (len < 0)
53 return -1;
54
55 memset(tb, 0, sizeof(tb));
56 parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len);
57
58 if (r->rtm_family == AF_INET)
59 host_len = 32;
60 else if (r->rtm_family == AF_INET6)
61 host_len = 128;
62/* else if (r->rtm_family == AF_DECnet)
63 host_len = 16;
64 else if (r->rtm_family == AF_IPX)
65 host_len = 80;
66*/
Bernhard Reutner-Fischer1b354982010-05-25 17:22:17 +020067 printf("%u:\t", tb[RTA_PRIORITY] ?
68 *(unsigned*)RTA_DATA(tb[RTA_PRIORITY])
69 : 0);
Denis Vlasenkobedfabd2008-06-05 05:00:24 +000070 printf("from ");
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000071 if (tb[RTA_SRC]) {
72 if (r->rtm_src_len != host_len) {
Denys Vlasenko926d8012015-10-14 13:56:42 +020073 printf("%s/%u",
74 rt_addr_n2a(r->rtm_family, RTA_DATA(tb[RTA_SRC])),
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000075 r->rtm_src_len
Denys Vlasenko60cb48c2013-01-14 15:57:44 +010076 );
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000077 } else {
Denis Vlasenko605b20e2007-09-30 16:22:36 +000078 fputs(format_host(r->rtm_family,
Denys Vlasenko60cb48c2013-01-14 15:57:44 +010079 RTA_PAYLOAD(tb[RTA_SRC]),
Denys Vlasenko926d8012015-10-14 13:56:42 +020080 RTA_DATA(tb[RTA_SRC])),
Denys Vlasenko60cb48c2013-01-14 15:57:44 +010081 stdout
82 );
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000083 }
84 } else if (r->rtm_src_len) {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +000085 printf("0/%d", r->rtm_src_len);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000086 } else {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +000087 printf("all");
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000088 }
Denis Vlasenkobedfabd2008-06-05 05:00:24 +000089 bb_putchar(' ');
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000090
91 if (tb[RTA_DST]) {
92 if (r->rtm_dst_len != host_len) {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +000093 printf("to %s/%u ", rt_addr_n2a(r->rtm_family,
Denys Vlasenko926d8012015-10-14 13:56:42 +020094 RTA_DATA(tb[RTA_DST])),
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000095 r->rtm_dst_len
96 );
97 } else {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +000098 printf("to %s ", format_host(r->rtm_family,
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +000099 RTA_PAYLOAD(tb[RTA_DST]),
Denys Vlasenko926d8012015-10-14 13:56:42 +0200100 RTA_DATA(tb[RTA_DST])));
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000101 }
102 } else if (r->rtm_dst_len) {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000103 printf("to 0/%d ", r->rtm_dst_len);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000104 }
105
106 if (r->rtm_tos) {
Denys Vlasenko3d8d5e82015-10-08 13:02:28 +0200107 printf("tos %s ", rtnl_dsfield_n2a(r->rtm_tos));
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000108 }
109 if (tb[RTA_PROTOINFO]) {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000110 printf("fwmark %#x ", *(uint32_t*)RTA_DATA(tb[RTA_PROTOINFO]));
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000111 }
112
113 if (tb[RTA_IIF]) {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000114 printf("iif %s ", (char*)RTA_DATA(tb[RTA_IIF]));
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000115 }
116
Lukasz Nowakb42107f2016-12-13 12:58:31 +0000117 if (tb[RTA_TABLE])
118 printf("lookup %s ", rtnl_rttable_n2a(*(uint32_t*)RTA_DATA(tb[RTA_TABLE])));
119 else if (r->rtm_table)
Denys Vlasenko3d8d5e82015-10-08 13:02:28 +0200120 printf("lookup %s ", rtnl_rttable_n2a(r->rtm_table));
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000121
122 if (tb[RTA_FLOW]) {
Denis Vlasenko98ee06d2006-12-31 18:57:37 +0000123 uint32_t to = *(uint32_t*)RTA_DATA(tb[RTA_FLOW]);
124 uint32_t from = to>>16;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000125 to &= 0xFFFF;
126 if (from) {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000127 printf("realms %s/",
Denys Vlasenko3d8d5e82015-10-08 13:02:28 +0200128 rtnl_rtrealm_n2a(from));
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000129 }
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000130 printf("%s ",
Denys Vlasenko3d8d5e82015-10-08 13:02:28 +0200131 rtnl_rtrealm_n2a(to));
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000132 }
133
134 if (r->rtm_type == RTN_NAT) {
135 if (tb[RTA_GATEWAY]) {
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000136 printf("map-to %s ",
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000137 format_host(r->rtm_family,
138 RTA_PAYLOAD(tb[RTA_GATEWAY]),
Denys Vlasenko926d8012015-10-14 13:56:42 +0200139 RTA_DATA(tb[RTA_GATEWAY]))
140 );
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000141 } else
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000142 printf("masquerade");
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000143 } else if (r->rtm_type != RTN_UNICAST)
Denys Vlasenko3d8d5e82015-10-08 13:02:28 +0200144 fputs(rtnl_rtntype_n2a(r->rtm_type), stdout);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000145
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000146 bb_putchar('\n');
Denys Vlasenko8131eea2009-11-02 14:19:51 +0100147 /*fflush_all();*/
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000148 return 0;
149}
150
Denis Vlasenko540a2a12007-04-07 01:14:45 +0000151/* Return value becomes exitcode. It's okay to not return at all */
Denis Vlasenkoed6a49c2007-11-18 22:56:25 +0000152static int iprule_list(char **argv)
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000153{
154 struct rtnl_handle rth;
155 int af = preferred_family;
156
157 if (af == AF_UNSPEC)
158 af = AF_INET;
159
Denis Vlasenkoed6a49c2007-11-18 22:56:25 +0000160 if (*argv) {
Bernhard Reutner-Fischer4d9a3582007-01-28 00:20:46 +0000161 //bb_error_msg("\"rule show\" needs no arguments");
Denys Vlasenkoa355da02010-01-04 13:16:08 +0100162 bb_warn_ignoring_args(*argv);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000163 return -1;
164 }
165
Bernhard Reutner-Fischerb2908892007-04-12 11:34:39 +0000166 xrtnl_open(&rth);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000167
Bernhard Reutner-Fischerb2908892007-04-12 11:34:39 +0000168 xrtnl_wilddump_request(&rth, af, RTM_GETRULE);
Denis Vlasenkobedfabd2008-06-05 05:00:24 +0000169 xrtnl_dump_filter(&rth, print_rule, NULL);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000170
171 return 0;
172}
173
Denis Vlasenko540a2a12007-04-07 01:14:45 +0000174/* Return value becomes exitcode. It's okay to not return at all */
Denis Vlasenkoed6a49c2007-11-18 22:56:25 +0000175static int iprule_modify(int cmd, char **argv)
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000176{
Denis Vlasenko6ca409e2007-08-12 20:58:27 +0000177 static const char keywords[] ALIGN1 =
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000178 "from\0""to\0""preference\0""order\0""priority\0"
179 "tos\0""fwmark\0""realms\0""table\0""lookup\0""dev\0"
180 "iif\0""nat\0""map-to\0""type\0""help\0";
181 enum {
182 ARG_from = 1, ARG_to, ARG_preference, ARG_order, ARG_priority,
183 ARG_tos, ARG_fwmark, ARG_realms, ARG_table, ARG_lookup, ARG_dev,
184 ARG_iif, ARG_nat, ARG_map_to, ARG_type, ARG_help
185 };
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000186 bool table_ok = 0;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000187 struct rtnl_handle rth;
188 struct {
Denys Vlasenkofb132e42010-10-29 11:46:52 +0200189 struct nlmsghdr n;
190 struct rtmsg r;
191 char buf[1024];
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000192 } req;
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000193 smalluint key;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000194
195 memset(&req, 0, sizeof(req));
196
197 req.n.nlmsg_type = cmd;
198 req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
199 req.n.nlmsg_flags = NLM_F_REQUEST;
200 req.r.rtm_family = preferred_family;
201 req.r.rtm_protocol = RTPROT_BOOT;
Denys Vlasenko45482932016-08-14 02:08:56 +0200202 if (RT_SCOPE_UNIVERSE != 0)
203 req.r.rtm_scope = RT_SCOPE_UNIVERSE;
204 /*req.r.rtm_table = 0; - already is */
205 if (RTN_UNSPEC != 0)
206 req.r.rtm_type = RTN_UNSPEC;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000207
208 if (cmd == RTM_NEWRULE) {
209 req.n.nlmsg_flags |= NLM_F_CREATE|NLM_F_EXCL;
210 req.r.rtm_type = RTN_UNICAST;
211 }
212
Denis Vlasenkoed6a49c2007-11-18 22:56:25 +0000213 while (*argv) {
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000214 key = index_in_substrings(keywords, *argv) + 1;
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000215 if (key == 0) /* no match found in keywords array, bail out. */
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200216 invarg_1_to_2(*argv, applet_name);
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000217 if (key == ARG_from) {
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000218 inet_prefix dst;
219 NEXT_ARG();
220 get_prefix(&dst, *argv, req.r.rtm_family);
221 req.r.rtm_src_len = dst.bitlen;
222 addattr_l(&req.n, sizeof(req), RTA_SRC, &dst.data, dst.bytelen);
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000223 } else if (key == ARG_to) {
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000224 inet_prefix dst;
225 NEXT_ARG();
226 get_prefix(&dst, *argv, req.r.rtm_family);
227 req.r.rtm_dst_len = dst.bitlen;
228 addattr_l(&req.n, sizeof(req), RTA_DST, &dst.data, dst.bytelen);
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000229 } else if (key == ARG_preference ||
230 key == ARG_order ||
Denys Vlasenko6b9f1632010-01-28 02:24:24 +0100231 key == ARG_priority
232 ) {
Denis Vlasenko98ee06d2006-12-31 18:57:37 +0000233 uint32_t pref;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000234 NEXT_ARG();
Denis Vlasenko76140a72009-03-05 09:21:57 +0000235 pref = get_u32(*argv, "preference");
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000236 addattr32(&req.n, sizeof(req), RTA_PRIORITY, pref);
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000237 } else if (key == ARG_tos) {
Denis Vlasenko98ee06d2006-12-31 18:57:37 +0000238 uint32_t tos;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000239 NEXT_ARG();
240 if (rtnl_dsfield_a2n(&tos, *argv))
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200241 invarg_1_to_2(*argv, "TOS");
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000242 req.r.rtm_tos = tos;
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000243 } else if (key == ARG_fwmark) {
Denis Vlasenko98ee06d2006-12-31 18:57:37 +0000244 uint32_t fwmark;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000245 NEXT_ARG();
Denis Vlasenko76140a72009-03-05 09:21:57 +0000246 fwmark = get_u32(*argv, "fwmark");
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000247 addattr32(&req.n, sizeof(req), RTA_PROTOINFO, fwmark);
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000248 } else if (key == ARG_realms) {
Denis Vlasenko98ee06d2006-12-31 18:57:37 +0000249 uint32_t realm;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000250 NEXT_ARG();
251 if (get_rt_realms(&realm, *argv))
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200252 invarg_1_to_2(*argv, "realms");
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000253 addattr32(&req.n, sizeof(req), RTA_FLOW, realm);
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000254 } else if (key == ARG_table ||
Denys Vlasenko6b9f1632010-01-28 02:24:24 +0100255 key == ARG_lookup
256 ) {
Bernhard Reutner-Fischer4d9a3582007-01-28 00:20:46 +0000257 uint32_t tid;
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000258 NEXT_ARG();
259 if (rtnl_rttable_a2n(&tid, *argv))
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200260 invarg_1_to_2(*argv, "table ID");
Lukasz Nowakb42107f2016-12-13 12:58:31 +0000261 if (tid < 256)
262 req.r.rtm_table = tid;
263 else {
264 req.r.rtm_table = RT_TABLE_UNSPEC;
265 addattr32(&req.n, sizeof(req), RTA_TABLE, tid);
266 }
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000267 table_ok = 1;
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000268 } else if (key == ARG_dev ||
Denys Vlasenko6b9f1632010-01-28 02:24:24 +0100269 key == ARG_iif
270 ) {
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000271 NEXT_ARG();
272 addattr_l(&req.n, sizeof(req), RTA_IIF, *argv, strlen(*argv)+1);
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000273 } else if (key == ARG_nat ||
Denys Vlasenko6b9f1632010-01-28 02:24:24 +0100274 key == ARG_map_to
275 ) {
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000276 NEXT_ARG();
277 addattr32(&req.n, sizeof(req), RTA_GATEWAY, get_addr32(*argv));
278 req.r.rtm_type = RTN_NAT;
279 } else {
280 int type;
281
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000282 if (key == ARG_type) {
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000283 NEXT_ARG();
284 }
Bernhard Reutner-Fischercd0e80c2007-06-20 14:53:49 +0000285 if (key == ARG_help)
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000286 bb_show_usage();
287 if (rtnl_rtntype_a2n(&type, *argv))
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200288 invarg_1_to_2(*argv, "type");
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000289 req.r.rtm_type = type;
290 }
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000291 argv++;
292 }
293
294 if (req.r.rtm_family == AF_UNSPEC)
295 req.r.rtm_family = AF_INET;
296
297 if (!table_ok && cmd == RTM_NEWRULE)
298 req.r.rtm_table = RT_TABLE_MAIN;
299
Bernhard Reutner-Fischerb2908892007-04-12 11:34:39 +0000300 xrtnl_open(&rth);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000301
302 if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0)
303 return 2;
304
305 return 0;
306}
307
Denis Vlasenko540a2a12007-04-07 01:14:45 +0000308/* Return value becomes exitcode. It's okay to not return at all */
Denys Vlasenko2e9b5512010-07-24 23:27:38 +0200309int FAST_FUNC do_iprule(char **argv)
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000310{
Denis Vlasenko6ca409e2007-08-12 20:58:27 +0000311 static const char ip_rule_commands[] ALIGN1 =
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000312 "add\0""delete\0""list\0""show\0";
Bernhard Reutner-Fischer1b354982010-05-25 17:22:17 +0200313 if (*argv) {
Denys Vlasenko9b58fe92013-07-15 05:15:46 +0200314 int cmd = index_in_substrings(ip_rule_commands, *argv);
315 if (cmd < 0)
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200316 invarg_1_to_2(*argv, applet_name);
Bernhard Reutner-Fischer1b354982010-05-25 17:22:17 +0200317 argv++;
318 if (cmd < 2)
319 return iprule_modify((cmd == 0) ? RTM_NEWRULE : RTM_DELRULE, argv);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000320 }
Bernhard Reutner-Fischer1b354982010-05-25 17:22:17 +0200321 return iprule_list(argv);
Bernhard Reutner-Fischer921f5df2006-11-21 15:36:08 +0000322}