blob: 7ac602cc8c85a6f1d7a43fe4fbde1d6afea0fe25 [file] [log] [blame]
Thomas Graf14c0b972006-08-04 03:38:38 -07001/*
2 * net/core/fib_rules.c Generic Routing Rules
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation, version 2.
7 *
8 * Authors: Thomas Graf <tgraf@suug.ch>
9 */
10
Thomas Graf14c0b972006-08-04 03:38:38 -070011#include <linux/types.h>
12#include <linux/kernel.h>
13#include <linux/list.h>
14#include <net/fib_rules.h>
15
16static LIST_HEAD(rules_ops);
17static DEFINE_SPINLOCK(rules_mod_lock);
18
19static void notify_rule_change(int event, struct fib_rule *rule,
Thomas Grafc17084d2006-08-15 00:32:48 -070020 struct fib_rules_ops *ops, struct nlmsghdr *nlh,
21 u32 pid);
Thomas Graf14c0b972006-08-04 03:38:38 -070022
23static struct fib_rules_ops *lookup_rules_ops(int family)
24{
25 struct fib_rules_ops *ops;
26
27 rcu_read_lock();
28 list_for_each_entry_rcu(ops, &rules_ops, list) {
29 if (ops->family == family) {
30 if (!try_module_get(ops->owner))
31 ops = NULL;
32 rcu_read_unlock();
33 return ops;
34 }
35 }
36 rcu_read_unlock();
37
38 return NULL;
39}
40
41static void rules_ops_put(struct fib_rules_ops *ops)
42{
43 if (ops)
44 module_put(ops->owner);
45}
46
47int fib_rules_register(struct fib_rules_ops *ops)
48{
49 int err = -EEXIST;
50 struct fib_rules_ops *o;
51
52 if (ops->rule_size < sizeof(struct fib_rule))
53 return -EINVAL;
54
55 if (ops->match == NULL || ops->configure == NULL ||
56 ops->compare == NULL || ops->fill == NULL ||
57 ops->action == NULL)
58 return -EINVAL;
59
60 spin_lock(&rules_mod_lock);
61 list_for_each_entry(o, &rules_ops, list)
62 if (ops->family == o->family)
63 goto errout;
64
65 list_add_tail_rcu(&ops->list, &rules_ops);
66 err = 0;
67errout:
68 spin_unlock(&rules_mod_lock);
69
70 return err;
71}
72
73EXPORT_SYMBOL_GPL(fib_rules_register);
74
75static void cleanup_ops(struct fib_rules_ops *ops)
76{
77 struct fib_rule *rule, *tmp;
78
79 list_for_each_entry_safe(rule, tmp, ops->rules_list, list) {
80 list_del_rcu(&rule->list);
81 fib_rule_put(rule);
82 }
83}
84
85int fib_rules_unregister(struct fib_rules_ops *ops)
86{
87 int err = 0;
88 struct fib_rules_ops *o;
89
90 spin_lock(&rules_mod_lock);
91 list_for_each_entry(o, &rules_ops, list) {
92 if (o == ops) {
93 list_del_rcu(&o->list);
94 cleanup_ops(ops);
95 goto out;
96 }
97 }
98
99 err = -ENOENT;
100out:
101 spin_unlock(&rules_mod_lock);
102
103 synchronize_rcu();
104
105 return err;
106}
107
108EXPORT_SYMBOL_GPL(fib_rules_unregister);
109
Thomas Graf3dfbcc42006-11-09 15:23:20 -0800110static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
111 struct flowi *fl, int flags)
112{
113 int ret = 0;
114
115 if (rule->ifindex && (rule->ifindex != fl->iif))
116 goto out;
117
118 if ((rule->mark ^ fl->mark) & rule->mark_mask)
119 goto out;
120
121 ret = ops->match(rule, fl, flags);
122out:
123 return (rule->flags & FIB_RULE_INVERT) ? !ret : ret;
124}
125
Thomas Graf14c0b972006-08-04 03:38:38 -0700126int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
127 int flags, struct fib_lookup_arg *arg)
128{
129 struct fib_rule *rule;
130 int err;
131
132 rcu_read_lock();
133
134 list_for_each_entry_rcu(rule, ops->rules_list, list) {
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700135jumped:
Thomas Graf3dfbcc42006-11-09 15:23:20 -0800136 if (!fib_rule_match(rule, ops, fl, flags))
Thomas Graf14c0b972006-08-04 03:38:38 -0700137 continue;
138
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700139 if (rule->action == FR_ACT_GOTO) {
140 struct fib_rule *target;
141
142 target = rcu_dereference(rule->ctarget);
143 if (target == NULL) {
144 continue;
145 } else {
146 rule = target;
147 goto jumped;
148 }
149 } else
150 err = ops->action(rule, fl, flags, arg);
151
Thomas Graf14c0b972006-08-04 03:38:38 -0700152 if (err != -EAGAIN) {
153 fib_rule_get(rule);
154 arg->rule = rule;
155 goto out;
156 }
157 }
158
Steven Whitehouse83886b62007-03-30 13:34:27 -0700159 err = -ESRCH;
Thomas Graf14c0b972006-08-04 03:38:38 -0700160out:
161 rcu_read_unlock();
162
163 return err;
164}
165
166EXPORT_SYMBOL_GPL(fib_rules_lookup);
167
Thomas Grafe1701c62007-03-24 12:46:02 -0700168static int validate_rulemsg(struct fib_rule_hdr *frh, struct nlattr **tb,
169 struct fib_rules_ops *ops)
170{
171 int err = -EINVAL;
172
173 if (frh->src_len)
174 if (tb[FRA_SRC] == NULL ||
175 frh->src_len > (ops->addr_size * 8) ||
176 nla_len(tb[FRA_SRC]) != ops->addr_size)
177 goto errout;
178
179 if (frh->dst_len)
180 if (tb[FRA_DST] == NULL ||
181 frh->dst_len > (ops->addr_size * 8) ||
182 nla_len(tb[FRA_DST]) != ops->addr_size)
183 goto errout;
184
185 err = 0;
186errout:
187 return err;
188}
189
Thomas Graf9d9e6a52007-03-25 23:20:05 -0700190static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
Thomas Graf14c0b972006-08-04 03:38:38 -0700191{
192 struct fib_rule_hdr *frh = nlmsg_data(nlh);
193 struct fib_rules_ops *ops = NULL;
194 struct fib_rule *rule, *r, *last = NULL;
195 struct nlattr *tb[FRA_MAX+1];
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700196 int err = -EINVAL, unresolved = 0;
Thomas Graf14c0b972006-08-04 03:38:38 -0700197
198 if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*frh)))
199 goto errout;
200
201 ops = lookup_rules_ops(frh->family);
202 if (ops == NULL) {
203 err = EAFNOSUPPORT;
204 goto errout;
205 }
206
207 err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy);
208 if (err < 0)
209 goto errout;
210
Thomas Grafe1701c62007-03-24 12:46:02 -0700211 err = validate_rulemsg(frh, tb, ops);
212 if (err < 0)
213 goto errout;
214
Thomas Graf14c0b972006-08-04 03:38:38 -0700215 rule = kzalloc(ops->rule_size, GFP_KERNEL);
216 if (rule == NULL) {
217 err = -ENOMEM;
218 goto errout;
219 }
220
221 if (tb[FRA_PRIORITY])
222 rule->pref = nla_get_u32(tb[FRA_PRIORITY]);
223
224 if (tb[FRA_IFNAME]) {
225 struct net_device *dev;
226
227 rule->ifindex = -1;
Thomas Graf5176f912006-08-26 20:13:18 -0700228 nla_strlcpy(rule->ifname, tb[FRA_IFNAME], IFNAMSIZ);
Thomas Graf14c0b972006-08-04 03:38:38 -0700229 dev = __dev_get_by_name(rule->ifname);
230 if (dev)
231 rule->ifindex = dev->ifindex;
232 }
233
Thomas Grafb8964ed2006-11-09 15:22:18 -0800234 if (tb[FRA_FWMARK]) {
235 rule->mark = nla_get_u32(tb[FRA_FWMARK]);
236 if (rule->mark)
237 /* compatibility: if the mark value is non-zero all bits
238 * are compared unless a mask is explicitly specified.
239 */
240 rule->mark_mask = 0xFFFFFFFF;
241 }
242
243 if (tb[FRA_FWMASK])
244 rule->mark_mask = nla_get_u32(tb[FRA_FWMASK]);
245
Thomas Graf14c0b972006-08-04 03:38:38 -0700246 rule->action = frh->action;
247 rule->flags = frh->flags;
Patrick McHardy9e762a42006-08-10 23:09:48 -0700248 rule->table = frh_get_table(frh, tb);
Thomas Graf14c0b972006-08-04 03:38:38 -0700249
250 if (!rule->pref && ops->default_pref)
251 rule->pref = ops->default_pref();
252
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700253 err = -EINVAL;
254 if (tb[FRA_GOTO]) {
255 if (rule->action != FR_ACT_GOTO)
256 goto errout_free;
257
258 rule->target = nla_get_u32(tb[FRA_GOTO]);
259 /* Backward jumps are prohibited to avoid endless loops */
260 if (rule->target <= rule->pref)
261 goto errout_free;
262
263 list_for_each_entry(r, ops->rules_list, list) {
264 if (r->pref == rule->target) {
265 rule->ctarget = r;
266 break;
267 }
268 }
269
270 if (rule->ctarget == NULL)
271 unresolved = 1;
272 } else if (rule->action == FR_ACT_GOTO)
273 goto errout_free;
274
Thomas Graf14c0b972006-08-04 03:38:38 -0700275 err = ops->configure(rule, skb, nlh, frh, tb);
276 if (err < 0)
277 goto errout_free;
278
279 list_for_each_entry(r, ops->rules_list, list) {
280 if (r->pref > rule->pref)
281 break;
282 last = r;
283 }
284
285 fib_rule_get(rule);
286
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700287 if (ops->unresolved_rules) {
288 /*
289 * There are unresolved goto rules in the list, check if
290 * any of them are pointing to this new rule.
291 */
292 list_for_each_entry(r, ops->rules_list, list) {
293 if (r->action == FR_ACT_GOTO &&
294 r->target == rule->pref) {
295 BUG_ON(r->ctarget != NULL);
296 rcu_assign_pointer(r->ctarget, rule);
297 if (--ops->unresolved_rules == 0)
298 break;
299 }
300 }
301 }
302
303 if (rule->action == FR_ACT_GOTO)
304 ops->nr_goto_rules++;
305
306 if (unresolved)
307 ops->unresolved_rules++;
308
Thomas Graf14c0b972006-08-04 03:38:38 -0700309 if (last)
310 list_add_rcu(&rule->list, &last->list);
311 else
312 list_add_rcu(&rule->list, ops->rules_list);
313
Thomas Grafc17084d2006-08-15 00:32:48 -0700314 notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).pid);
Thomas Graf14c0b972006-08-04 03:38:38 -0700315 rules_ops_put(ops);
316 return 0;
317
318errout_free:
319 kfree(rule);
320errout:
321 rules_ops_put(ops);
322 return err;
323}
324
Thomas Graf9d9e6a52007-03-25 23:20:05 -0700325static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
Thomas Graf14c0b972006-08-04 03:38:38 -0700326{
327 struct fib_rule_hdr *frh = nlmsg_data(nlh);
328 struct fib_rules_ops *ops = NULL;
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700329 struct fib_rule *rule, *tmp;
Thomas Graf14c0b972006-08-04 03:38:38 -0700330 struct nlattr *tb[FRA_MAX+1];
331 int err = -EINVAL;
332
333 if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*frh)))
334 goto errout;
335
336 ops = lookup_rules_ops(frh->family);
337 if (ops == NULL) {
338 err = EAFNOSUPPORT;
339 goto errout;
340 }
341
342 err = nlmsg_parse(nlh, sizeof(*frh), tb, FRA_MAX, ops->policy);
343 if (err < 0)
344 goto errout;
345
Thomas Grafe1701c62007-03-24 12:46:02 -0700346 err = validate_rulemsg(frh, tb, ops);
347 if (err < 0)
348 goto errout;
349
Thomas Graf14c0b972006-08-04 03:38:38 -0700350 list_for_each_entry(rule, ops->rules_list, list) {
351 if (frh->action && (frh->action != rule->action))
352 continue;
353
Patrick McHardy9e762a42006-08-10 23:09:48 -0700354 if (frh->table && (frh_get_table(frh, tb) != rule->table))
Thomas Graf14c0b972006-08-04 03:38:38 -0700355 continue;
356
357 if (tb[FRA_PRIORITY] &&
358 (rule->pref != nla_get_u32(tb[FRA_PRIORITY])))
359 continue;
360
361 if (tb[FRA_IFNAME] &&
362 nla_strcmp(tb[FRA_IFNAME], rule->ifname))
363 continue;
364
Thomas Grafb8964ed2006-11-09 15:22:18 -0800365 if (tb[FRA_FWMARK] &&
366 (rule->mark != nla_get_u32(tb[FRA_FWMARK])))
367 continue;
368
369 if (tb[FRA_FWMASK] &&
370 (rule->mark_mask != nla_get_u32(tb[FRA_FWMASK])))
371 continue;
372
Thomas Graf14c0b972006-08-04 03:38:38 -0700373 if (!ops->compare(rule, frh, tb))
374 continue;
375
376 if (rule->flags & FIB_RULE_PERMANENT) {
377 err = -EPERM;
378 goto errout;
379 }
380
381 list_del_rcu(&rule->list);
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700382
383 if (rule->action == FR_ACT_GOTO)
384 ops->nr_goto_rules--;
385
386 /*
387 * Check if this rule is a target to any of them. If so,
388 * disable them. As this operation is eventually very
389 * expensive, it is only performed if goto rules have
390 * actually been added.
391 */
392 if (ops->nr_goto_rules > 0) {
393 list_for_each_entry(tmp, ops->rules_list, list) {
394 if (tmp->ctarget == rule) {
395 rcu_assign_pointer(tmp->ctarget, NULL);
396 ops->unresolved_rules++;
397 }
398 }
399 }
400
Thomas Graf14c0b972006-08-04 03:38:38 -0700401 synchronize_rcu();
Thomas Grafc17084d2006-08-15 00:32:48 -0700402 notify_rule_change(RTM_DELRULE, rule, ops, nlh,
403 NETLINK_CB(skb).pid);
Thomas Graf14c0b972006-08-04 03:38:38 -0700404 fib_rule_put(rule);
405 rules_ops_put(ops);
406 return 0;
407 }
408
409 err = -ENOENT;
410errout:
411 rules_ops_put(ops);
412 return err;
413}
414
Thomas Graf339bf982006-11-10 14:10:15 -0800415static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops,
416 struct fib_rule *rule)
417{
418 size_t payload = NLMSG_ALIGN(sizeof(struct fib_rule_hdr))
419 + nla_total_size(IFNAMSIZ) /* FRA_IFNAME */
420 + nla_total_size(4) /* FRA_PRIORITY */
421 + nla_total_size(4) /* FRA_TABLE */
422 + nla_total_size(4) /* FRA_FWMARK */
423 + nla_total_size(4); /* FRA_FWMASK */
424
425 if (ops->nlmsg_payload)
426 payload += ops->nlmsg_payload(rule);
427
428 return payload;
429}
430
Thomas Graf14c0b972006-08-04 03:38:38 -0700431static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
432 u32 pid, u32 seq, int type, int flags,
433 struct fib_rules_ops *ops)
434{
435 struct nlmsghdr *nlh;
436 struct fib_rule_hdr *frh;
437
438 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*frh), flags);
439 if (nlh == NULL)
Patrick McHardy26932562007-01-31 23:16:40 -0800440 return -EMSGSIZE;
Thomas Graf14c0b972006-08-04 03:38:38 -0700441
442 frh = nlmsg_data(nlh);
443 frh->table = rule->table;
Patrick McHardy9e762a42006-08-10 23:09:48 -0700444 NLA_PUT_U32(skb, FRA_TABLE, rule->table);
Thomas Graf14c0b972006-08-04 03:38:38 -0700445 frh->res1 = 0;
446 frh->res2 = 0;
447 frh->action = rule->action;
448 frh->flags = rule->flags;
449
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700450 if (rule->action == FR_ACT_GOTO && rule->ctarget == NULL)
451 frh->flags |= FIB_RULE_UNRESOLVED;
452
Thomas Graf2b443682007-03-26 17:37:59 -0700453 if (rule->ifname[0]) {
Thomas Graf14c0b972006-08-04 03:38:38 -0700454 NLA_PUT_STRING(skb, FRA_IFNAME, rule->ifname);
455
Thomas Graf2b443682007-03-26 17:37:59 -0700456 if (rule->ifindex == -1)
457 frh->flags |= FIB_RULE_DEV_DETACHED;
458 }
459
Thomas Graf14c0b972006-08-04 03:38:38 -0700460 if (rule->pref)
461 NLA_PUT_U32(skb, FRA_PRIORITY, rule->pref);
462
Thomas Grafb8964ed2006-11-09 15:22:18 -0800463 if (rule->mark)
464 NLA_PUT_U32(skb, FRA_FWMARK, rule->mark);
465
466 if (rule->mark_mask || rule->mark)
467 NLA_PUT_U32(skb, FRA_FWMASK, rule->mark_mask);
468
Thomas Graf0947c9fe2007-03-26 17:14:15 -0700469 if (rule->target)
470 NLA_PUT_U32(skb, FRA_GOTO, rule->target);
471
Thomas Graf14c0b972006-08-04 03:38:38 -0700472 if (ops->fill(rule, skb, nlh, frh) < 0)
473 goto nla_put_failure;
474
475 return nlmsg_end(skb, nlh);
476
477nla_put_failure:
Patrick McHardy26932562007-01-31 23:16:40 -0800478 nlmsg_cancel(skb, nlh);
479 return -EMSGSIZE;
Thomas Graf14c0b972006-08-04 03:38:38 -0700480}
481
Thomas Grafc4546732007-03-25 23:24:24 -0700482static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb,
483 struct fib_rules_ops *ops)
Thomas Graf14c0b972006-08-04 03:38:38 -0700484{
485 int idx = 0;
486 struct fib_rule *rule;
Thomas Graf14c0b972006-08-04 03:38:38 -0700487
488 rcu_read_lock();
Patrick McHardyec256152007-03-22 12:24:38 -0700489 list_for_each_entry_rcu(rule, ops->rules_list, list) {
Thomas Grafc4546732007-03-25 23:24:24 -0700490 if (idx < cb->args[1])
Thomas Graf14c0b972006-08-04 03:38:38 -0700491 goto skip;
492
493 if (fib_nl_fill_rule(skb, rule, NETLINK_CB(cb->skb).pid,
494 cb->nlh->nlmsg_seq, RTM_NEWRULE,
495 NLM_F_MULTI, ops) < 0)
496 break;
497skip:
498 idx++;
499 }
500 rcu_read_unlock();
Thomas Grafc4546732007-03-25 23:24:24 -0700501 cb->args[1] = idx;
Thomas Graf14c0b972006-08-04 03:38:38 -0700502 rules_ops_put(ops);
503
504 return skb->len;
505}
506
Thomas Grafc4546732007-03-25 23:24:24 -0700507static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb)
508{
509 struct fib_rules_ops *ops;
510 int idx = 0, family;
511
512 family = rtnl_msg_family(cb->nlh);
513 if (family != AF_UNSPEC) {
514 /* Protocol specific dump request */
515 ops = lookup_rules_ops(family);
516 if (ops == NULL)
517 return -EAFNOSUPPORT;
518
519 return dump_rules(skb, cb, ops);
520 }
521
522 rcu_read_lock();
523 list_for_each_entry_rcu(ops, &rules_ops, list) {
524 if (idx < cb->args[0] || !try_module_get(ops->owner))
525 goto skip;
526
527 if (dump_rules(skb, cb, ops) < 0)
528 break;
529
530 cb->args[1] = 0;
531 skip:
532 idx++;
533 }
534 rcu_read_unlock();
535 cb->args[0] = idx;
536
537 return skb->len;
538}
Thomas Graf14c0b972006-08-04 03:38:38 -0700539
540static void notify_rule_change(int event, struct fib_rule *rule,
Thomas Grafc17084d2006-08-15 00:32:48 -0700541 struct fib_rules_ops *ops, struct nlmsghdr *nlh,
542 u32 pid)
Thomas Graf14c0b972006-08-04 03:38:38 -0700543{
Thomas Grafc17084d2006-08-15 00:32:48 -0700544 struct sk_buff *skb;
545 int err = -ENOBUFS;
Thomas Graf14c0b972006-08-04 03:38:38 -0700546
Thomas Graf339bf982006-11-10 14:10:15 -0800547 skb = nlmsg_new(fib_rule_nlmsg_size(ops, rule), GFP_KERNEL);
Thomas Graf14c0b972006-08-04 03:38:38 -0700548 if (skb == NULL)
Thomas Grafc17084d2006-08-15 00:32:48 -0700549 goto errout;
550
551 err = fib_nl_fill_rule(skb, rule, pid, nlh->nlmsg_seq, event, 0, ops);
Patrick McHardy26932562007-01-31 23:16:40 -0800552 if (err < 0) {
553 /* -EMSGSIZE implies BUG in fib_rule_nlmsg_size() */
554 WARN_ON(err == -EMSGSIZE);
555 kfree_skb(skb);
556 goto errout;
557 }
Thomas Grafc17084d2006-08-15 00:32:48 -0700558 err = rtnl_notify(skb, pid, ops->nlgroup, nlh, GFP_KERNEL);
559errout:
560 if (err < 0)
561 rtnl_set_sk_err(ops->nlgroup, err);
Thomas Graf14c0b972006-08-04 03:38:38 -0700562}
563
564static void attach_rules(struct list_head *rules, struct net_device *dev)
565{
566 struct fib_rule *rule;
567
568 list_for_each_entry(rule, rules, list) {
569 if (rule->ifindex == -1 &&
570 strcmp(dev->name, rule->ifname) == 0)
571 rule->ifindex = dev->ifindex;
572 }
573}
574
575static void detach_rules(struct list_head *rules, struct net_device *dev)
576{
577 struct fib_rule *rule;
578
579 list_for_each_entry(rule, rules, list)
580 if (rule->ifindex == dev->ifindex)
581 rule->ifindex = -1;
582}
583
584
585static int fib_rules_event(struct notifier_block *this, unsigned long event,
586 void *ptr)
587{
588 struct net_device *dev = ptr;
589 struct fib_rules_ops *ops;
590
591 ASSERT_RTNL();
592 rcu_read_lock();
593
594 switch (event) {
595 case NETDEV_REGISTER:
596 list_for_each_entry(ops, &rules_ops, list)
597 attach_rules(ops->rules_list, dev);
598 break;
599
600 case NETDEV_UNREGISTER:
601 list_for_each_entry(ops, &rules_ops, list)
602 detach_rules(ops->rules_list, dev);
603 break;
604 }
605
606 rcu_read_unlock();
607
608 return NOTIFY_DONE;
609}
610
611static struct notifier_block fib_rules_notifier = {
612 .notifier_call = fib_rules_event,
613};
614
615static int __init fib_rules_init(void)
616{
Thomas Graf9d9e6a52007-03-25 23:20:05 -0700617 rtnl_register(PF_UNSPEC, RTM_NEWRULE, fib_nl_newrule, NULL);
618 rtnl_register(PF_UNSPEC, RTM_DELRULE, fib_nl_delrule, NULL);
Thomas Grafc4546732007-03-25 23:24:24 -0700619 rtnl_register(PF_UNSPEC, RTM_GETRULE, NULL, fib_nl_dumprule);
Thomas Graf9d9e6a52007-03-25 23:20:05 -0700620
Thomas Graf14c0b972006-08-04 03:38:38 -0700621 return register_netdevice_notifier(&fib_rules_notifier);
622}
623
624subsys_initcall(fib_rules_init);