| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Linux INET6 implementation |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Authors: |
|---|
| 5 | 6 | * Pedro Roque <roque@di.fc.ul.pt> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License |
|---|
| 9 | | - * as published by the Free Software Foundation; either version |
|---|
| 10 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | |
|---|
| 13 | 9 | #ifndef _IP6_FIB_H |
|---|
| .. | .. |
|---|
| 17 | 13 | #include <linux/rtnetlink.h> |
|---|
| 18 | 14 | #include <linux/spinlock.h> |
|---|
| 19 | 15 | #include <linux/notifier.h> |
|---|
| 16 | +#include <linux/android_kabi.h> |
|---|
| 20 | 17 | #include <net/dst.h> |
|---|
| 21 | 18 | #include <net/flow.h> |
|---|
| 19 | +#include <net/ip_fib.h> |
|---|
| 22 | 20 | #include <net/netlink.h> |
|---|
| 23 | 21 | #include <net/inetpeer.h> |
|---|
| 24 | 22 | #include <net/fib_notifier.h> |
|---|
| 23 | +#include <linux/indirect_call_wrapper.h> |
|---|
| 25 | 24 | |
|---|
| 26 | 25 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
|---|
| 27 | 26 | #define FIB6_TABLE_HASHSZ 256 |
|---|
| .. | .. |
|---|
| 50 | 49 | u32 fc_protocol; |
|---|
| 51 | 50 | u16 fc_type; /* only 8 bits are used */ |
|---|
| 52 | 51 | u16 fc_delete_all_nh : 1, |
|---|
| 53 | | - __unused : 15; |
|---|
| 52 | + fc_ignore_dev_down:1, |
|---|
| 53 | + __unused : 14; |
|---|
| 54 | + u32 fc_nh_id; |
|---|
| 54 | 55 | |
|---|
| 55 | 56 | struct in6_addr fc_dst; |
|---|
| 56 | 57 | struct in6_addr fc_src; |
|---|
| .. | .. |
|---|
| 66 | 67 | struct nl_info fc_nlinfo; |
|---|
| 67 | 68 | struct nlattr *fc_encap; |
|---|
| 68 | 69 | u16 fc_encap_type; |
|---|
| 70 | + bool fc_is_fdb; |
|---|
| 71 | + |
|---|
| 72 | + ANDROID_KABI_RESERVE(1); |
|---|
| 69 | 73 | }; |
|---|
| 70 | 74 | |
|---|
| 71 | 75 | struct fib6_node { |
|---|
| .. | .. |
|---|
| 82 | 86 | int fn_sernum; |
|---|
| 83 | 87 | struct fib6_info __rcu *rr_ptr; |
|---|
| 84 | 88 | struct rcu_head rcu; |
|---|
| 89 | + |
|---|
| 90 | + ANDROID_KABI_RESERVE(1); |
|---|
| 85 | 91 | }; |
|---|
| 86 | 92 | |
|---|
| 87 | 93 | struct fib6_gc_args { |
|---|
| .. | .. |
|---|
| 91 | 97 | |
|---|
| 92 | 98 | #ifndef CONFIG_IPV6_SUBTREES |
|---|
| 93 | 99 | #define FIB6_SUBTREE(fn) NULL |
|---|
| 100 | + |
|---|
| 101 | +static inline bool fib6_routes_require_src(const struct net *net) |
|---|
| 102 | +{ |
|---|
| 103 | + return false; |
|---|
| 104 | +} |
|---|
| 105 | + |
|---|
| 106 | +static inline void fib6_routes_require_src_inc(struct net *net) {} |
|---|
| 107 | +static inline void fib6_routes_require_src_dec(struct net *net) {} |
|---|
| 108 | + |
|---|
| 94 | 109 | #else |
|---|
| 110 | + |
|---|
| 111 | +static inline bool fib6_routes_require_src(const struct net *net) |
|---|
| 112 | +{ |
|---|
| 113 | + return net->ipv6.fib6_routes_require_src > 0; |
|---|
| 114 | +} |
|---|
| 115 | + |
|---|
| 116 | +static inline void fib6_routes_require_src_inc(struct net *net) |
|---|
| 117 | +{ |
|---|
| 118 | + net->ipv6.fib6_routes_require_src++; |
|---|
| 119 | +} |
|---|
| 120 | + |
|---|
| 121 | +static inline void fib6_routes_require_src_dec(struct net *net) |
|---|
| 122 | +{ |
|---|
| 123 | + net->ipv6.fib6_routes_require_src--; |
|---|
| 124 | +} |
|---|
| 125 | + |
|---|
| 95 | 126 | #define FIB6_SUBTREE(fn) (rcu_dereference_protected((fn)->subtree, 1)) |
|---|
| 96 | 127 | #endif |
|---|
| 97 | 128 | |
|---|
| .. | .. |
|---|
| 124 | 155 | #define FIB6_MAX_DEPTH 5 |
|---|
| 125 | 156 | |
|---|
| 126 | 157 | struct fib6_nh { |
|---|
| 127 | | - struct in6_addr nh_gw; |
|---|
| 128 | | - struct net_device *nh_dev; |
|---|
| 129 | | - struct lwtunnel_state *nh_lwtstate; |
|---|
| 158 | + struct fib_nh_common nh_common; |
|---|
| 130 | 159 | |
|---|
| 131 | | - unsigned int nh_flags; |
|---|
| 132 | | - atomic_t nh_upper_bound; |
|---|
| 133 | | - int nh_weight; |
|---|
| 160 | +#ifdef CONFIG_IPV6_ROUTER_PREF |
|---|
| 161 | + unsigned long last_probe; |
|---|
| 162 | +#endif |
|---|
| 163 | + |
|---|
| 164 | + struct rt6_info * __percpu *rt6i_pcpu; |
|---|
| 165 | + struct rt6_exception_bucket __rcu *rt6i_exception_bucket; |
|---|
| 134 | 166 | }; |
|---|
| 135 | 167 | |
|---|
| 136 | 168 | struct fib6_info { |
|---|
| .. | .. |
|---|
| 139 | 171 | struct fib6_node __rcu *fib6_node; |
|---|
| 140 | 172 | |
|---|
| 141 | 173 | /* Multipath routes: |
|---|
| 142 | | - * siblings is a list of fib6_info that have the the same metric/weight, |
|---|
| 174 | + * siblings is a list of fib6_info that have the same metric/weight, |
|---|
| 143 | 175 | * destination, but not the same gateway. nsiblings is just a cache |
|---|
| 144 | 176 | * to speed up lookup. |
|---|
| 145 | 177 | */ |
|---|
| 146 | | - struct list_head fib6_siblings; |
|---|
| 178 | + union { |
|---|
| 179 | + struct list_head fib6_siblings; |
|---|
| 180 | + struct list_head nh_list; |
|---|
| 181 | + }; |
|---|
| 147 | 182 | unsigned int fib6_nsiblings; |
|---|
| 148 | 183 | |
|---|
| 149 | | - atomic_t fib6_ref; |
|---|
| 184 | + refcount_t fib6_ref; |
|---|
| 150 | 185 | unsigned long expires; |
|---|
| 151 | 186 | struct dst_metrics *fib6_metrics; |
|---|
| 152 | 187 | #define fib6_pmtu fib6_metrics->metrics[RTAX_MTU-1] |
|---|
| .. | .. |
|---|
| 156 | 191 | struct rt6key fib6_src; |
|---|
| 157 | 192 | struct rt6key fib6_prefsrc; |
|---|
| 158 | 193 | |
|---|
| 159 | | - struct rt6_info * __percpu *rt6i_pcpu; |
|---|
| 160 | | - struct rt6_exception_bucket __rcu *rt6i_exception_bucket; |
|---|
| 161 | | - |
|---|
| 162 | | -#ifdef CONFIG_IPV6_ROUTER_PREF |
|---|
| 163 | | - unsigned long last_probe; |
|---|
| 164 | | -#endif |
|---|
| 165 | | - |
|---|
| 166 | 194 | u32 fib6_metric; |
|---|
| 167 | 195 | u8 fib6_protocol; |
|---|
| 168 | 196 | u8 fib6_type; |
|---|
| 169 | | - u8 exception_bucket_flushed:1, |
|---|
| 170 | | - should_flush:1, |
|---|
| 197 | + u8 should_flush:1, |
|---|
| 171 | 198 | dst_nocount:1, |
|---|
| 172 | 199 | dst_nopolicy:1, |
|---|
| 173 | | - dst_host:1, |
|---|
| 174 | 200 | fib6_destroying:1, |
|---|
| 201 | + offload:1, |
|---|
| 202 | + trap:1, |
|---|
| 175 | 203 | unused:2; |
|---|
| 176 | 204 | |
|---|
| 177 | | - struct fib6_nh fib6_nh; |
|---|
| 178 | 205 | struct rcu_head rcu; |
|---|
| 206 | + struct nexthop *nh; |
|---|
| 207 | + |
|---|
| 208 | + ANDROID_KABI_RESERVE(1); |
|---|
| 209 | + |
|---|
| 210 | + struct fib6_nh fib6_nh[]; |
|---|
| 179 | 211 | }; |
|---|
| 180 | 212 | |
|---|
| 181 | 213 | struct rt6_info { |
|---|
| 182 | 214 | struct dst_entry dst; |
|---|
| 183 | 215 | struct fib6_info __rcu *from; |
|---|
| 216 | + int sernum; |
|---|
| 184 | 217 | |
|---|
| 185 | 218 | struct rt6key rt6i_dst; |
|---|
| 186 | 219 | struct rt6key rt6i_src; |
|---|
| 187 | 220 | struct in6_addr rt6i_gateway; |
|---|
| 188 | 221 | struct inet6_dev *rt6i_idev; |
|---|
| 189 | 222 | u32 rt6i_flags; |
|---|
| 190 | | - struct rt6key rt6i_prefsrc; |
|---|
| 191 | 223 | |
|---|
| 192 | 224 | struct list_head rt6i_uncached; |
|---|
| 193 | 225 | struct uncached_list *rt6i_uncached_list; |
|---|
| 194 | 226 | |
|---|
| 195 | 227 | /* more non-fragment space at head required */ |
|---|
| 196 | 228 | unsigned short rt6i_nfheader_len; |
|---|
| 229 | + |
|---|
| 230 | + ANDROID_KABI_RESERVE(1); |
|---|
| 231 | +}; |
|---|
| 232 | + |
|---|
| 233 | +struct fib6_result { |
|---|
| 234 | + struct fib6_nh *nh; |
|---|
| 235 | + struct fib6_info *f6i; |
|---|
| 236 | + u32 fib6_flags; |
|---|
| 237 | + u8 fib6_type; |
|---|
| 238 | + struct rt6_info *rt6; |
|---|
| 197 | 239 | }; |
|---|
| 198 | 240 | |
|---|
| 199 | 241 | #define for_each_fib6_node_rt_rcu(fn) \ |
|---|
| .. | .. |
|---|
| 207 | 249 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) |
|---|
| 208 | 250 | { |
|---|
| 209 | 251 | return ((struct rt6_info *)dst)->rt6i_idev; |
|---|
| 252 | +} |
|---|
| 253 | + |
|---|
| 254 | +static inline bool fib6_requires_src(const struct fib6_info *rt) |
|---|
| 255 | +{ |
|---|
| 256 | + return rt->fib6_src.plen > 0; |
|---|
| 210 | 257 | } |
|---|
| 211 | 258 | |
|---|
| 212 | 259 | static inline void fib6_clean_expires(struct fib6_info *f6i) |
|---|
| .. | .. |
|---|
| 257 | 304 | struct fib6_info *from; |
|---|
| 258 | 305 | u32 cookie = 0; |
|---|
| 259 | 306 | |
|---|
| 307 | + if (rt->sernum) |
|---|
| 308 | + return rt->sernum; |
|---|
| 309 | + |
|---|
| 260 | 310 | rcu_read_lock(); |
|---|
| 261 | 311 | |
|---|
| 262 | 312 | from = rcu_dereference(rt->from); |
|---|
| .. | .. |
|---|
| 277 | 327 | dst_release(&rt->dst); |
|---|
| 278 | 328 | } |
|---|
| 279 | 329 | |
|---|
| 280 | | -struct fib6_info *fib6_info_alloc(gfp_t gfp_flags); |
|---|
| 330 | +struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh); |
|---|
| 281 | 331 | void fib6_info_destroy_rcu(struct rcu_head *head); |
|---|
| 282 | 332 | |
|---|
| 283 | 333 | static inline void fib6_info_hold(struct fib6_info *f6i) |
|---|
| 284 | 334 | { |
|---|
| 285 | | - atomic_inc(&f6i->fib6_ref); |
|---|
| 335 | + refcount_inc(&f6i->fib6_ref); |
|---|
| 286 | 336 | } |
|---|
| 287 | 337 | |
|---|
| 288 | 338 | static inline bool fib6_info_hold_safe(struct fib6_info *f6i) |
|---|
| 289 | 339 | { |
|---|
| 290 | | - return atomic_inc_not_zero(&f6i->fib6_ref); |
|---|
| 340 | + return refcount_inc_not_zero(&f6i->fib6_ref); |
|---|
| 291 | 341 | } |
|---|
| 292 | 342 | |
|---|
| 293 | 343 | static inline void fib6_info_release(struct fib6_info *f6i) |
|---|
| 294 | 344 | { |
|---|
| 295 | | - if (f6i && atomic_dec_and_test(&f6i->fib6_ref)) |
|---|
| 345 | + if (f6i && refcount_dec_and_test(&f6i->fib6_ref)) |
|---|
| 296 | 346 | call_rcu(&f6i->rcu, fib6_info_destroy_rcu); |
|---|
| 347 | +} |
|---|
| 348 | + |
|---|
| 349 | +static inline void fib6_info_hw_flags_set(struct fib6_info *f6i, bool offload, |
|---|
| 350 | + bool trap) |
|---|
| 351 | +{ |
|---|
| 352 | + f6i->offload = offload; |
|---|
| 353 | + f6i->trap = trap; |
|---|
| 297 | 354 | } |
|---|
| 298 | 355 | |
|---|
| 299 | 356 | enum fib6_walk_state { |
|---|
| .. | .. |
|---|
| 313 | 370 | enum fib6_walk_state state; |
|---|
| 314 | 371 | unsigned int skip; |
|---|
| 315 | 372 | unsigned int count; |
|---|
| 373 | + unsigned int skip_in_node; |
|---|
| 316 | 374 | int (*func)(struct fib6_walker *); |
|---|
| 317 | 375 | void *args; |
|---|
| 318 | 376 | }; |
|---|
| .. | .. |
|---|
| 374 | 432 | struct fib6_entry_notifier_info { |
|---|
| 375 | 433 | struct fib_notifier_info info; /* must be first */ |
|---|
| 376 | 434 | struct fib6_info *rt; |
|---|
| 435 | + unsigned int nsiblings; |
|---|
| 377 | 436 | }; |
|---|
| 378 | 437 | |
|---|
| 379 | 438 | /* |
|---|
| .. | .. |
|---|
| 389 | 448 | /* called with rcu lock held; can return error pointer |
|---|
| 390 | 449 | * caller needs to select path |
|---|
| 391 | 450 | */ |
|---|
| 392 | | -struct fib6_info *fib6_lookup(struct net *net, int oif, struct flowi6 *fl6, |
|---|
| 393 | | - int flags); |
|---|
| 451 | +int fib6_lookup(struct net *net, int oif, struct flowi6 *fl6, |
|---|
| 452 | + struct fib6_result *res, int flags); |
|---|
| 394 | 453 | |
|---|
| 395 | 454 | /* called with rcu lock held; caller needs to select path */ |
|---|
| 396 | | -struct fib6_info *fib6_table_lookup(struct net *net, struct fib6_table *table, |
|---|
| 397 | | - int oif, struct flowi6 *fl6, int strict); |
|---|
| 455 | +int fib6_table_lookup(struct net *net, struct fib6_table *table, |
|---|
| 456 | + int oif, struct flowi6 *fl6, struct fib6_result *res, |
|---|
| 457 | + int strict); |
|---|
| 398 | 458 | |
|---|
| 399 | | -struct fib6_info *fib6_multipath_select(const struct net *net, |
|---|
| 400 | | - struct fib6_info *match, |
|---|
| 401 | | - struct flowi6 *fl6, int oif, |
|---|
| 402 | | - const struct sk_buff *skb, int strict); |
|---|
| 403 | | - |
|---|
| 459 | +void fib6_select_path(const struct net *net, struct fib6_result *res, |
|---|
| 460 | + struct flowi6 *fl6, int oif, bool have_oif_match, |
|---|
| 461 | + const struct sk_buff *skb, int strict); |
|---|
| 404 | 462 | struct fib6_node *fib6_node_lookup(struct fib6_node *root, |
|---|
| 405 | 463 | const struct in6_addr *daddr, |
|---|
| 406 | 464 | const struct in6_addr *saddr); |
|---|
| .. | .. |
|---|
| 412 | 470 | |
|---|
| 413 | 471 | void fib6_clean_all(struct net *net, int (*func)(struct fib6_info *, void *arg), |
|---|
| 414 | 472 | void *arg); |
|---|
| 473 | +void fib6_clean_all_skip_notify(struct net *net, |
|---|
| 474 | + int (*func)(struct fib6_info *, void *arg), |
|---|
| 475 | + void *arg); |
|---|
| 415 | 476 | |
|---|
| 416 | 477 | int fib6_add(struct fib6_node *root, struct fib6_info *rt, |
|---|
| 417 | 478 | struct nl_info *info, struct netlink_ext_ack *extack); |
|---|
| 418 | 479 | int fib6_del(struct fib6_info *rt, struct nl_info *info); |
|---|
| 419 | 480 | |
|---|
| 420 | | -static inline struct net_device *fib6_info_nh_dev(const struct fib6_info *f6i) |
|---|
| 421 | | -{ |
|---|
| 422 | | - return f6i->fib6_nh.nh_dev; |
|---|
| 423 | | -} |
|---|
| 424 | | - |
|---|
| 425 | 481 | static inline |
|---|
| 426 | | -struct lwtunnel_state *fib6_info_nh_lwt(const struct fib6_info *f6i) |
|---|
| 482 | +void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr) |
|---|
| 427 | 483 | { |
|---|
| 428 | | - return f6i->fib6_nh.nh_lwtstate; |
|---|
| 484 | + const struct fib6_info *from; |
|---|
| 485 | + |
|---|
| 486 | + rcu_read_lock(); |
|---|
| 487 | + |
|---|
| 488 | + from = rcu_dereference(rt->from); |
|---|
| 489 | + if (from) { |
|---|
| 490 | + *addr = from->fib6_prefsrc.addr; |
|---|
| 491 | + } else { |
|---|
| 492 | + struct in6_addr in6_zero = {}; |
|---|
| 493 | + |
|---|
| 494 | + *addr = in6_zero; |
|---|
| 495 | + } |
|---|
| 496 | + |
|---|
| 497 | + rcu_read_unlock(); |
|---|
| 429 | 498 | } |
|---|
| 430 | 499 | |
|---|
| 500 | +int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, |
|---|
| 501 | + struct fib6_config *cfg, gfp_t gfp_flags, |
|---|
| 502 | + struct netlink_ext_ack *extack); |
|---|
| 503 | +void fib6_nh_release(struct fib6_nh *fib6_nh); |
|---|
| 504 | + |
|---|
| 505 | +int call_fib6_entry_notifiers(struct net *net, |
|---|
| 506 | + enum fib_event_type event_type, |
|---|
| 507 | + struct fib6_info *rt, |
|---|
| 508 | + struct netlink_ext_ack *extack); |
|---|
| 509 | +int call_fib6_multipath_entry_notifiers(struct net *net, |
|---|
| 510 | + enum fib_event_type event_type, |
|---|
| 511 | + struct fib6_info *rt, |
|---|
| 512 | + unsigned int nsiblings, |
|---|
| 513 | + struct netlink_ext_ack *extack); |
|---|
| 514 | +int call_fib6_entry_notifiers_replace(struct net *net, struct fib6_info *rt); |
|---|
| 515 | +void fib6_rt_update(struct net *net, struct fib6_info *rt, |
|---|
| 516 | + struct nl_info *info); |
|---|
| 431 | 517 | void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info, |
|---|
| 432 | 518 | unsigned int flags); |
|---|
| 433 | 519 | |
|---|
| .. | .. |
|---|
| 447 | 533 | |
|---|
| 448 | 534 | extern const struct seq_operations ipv6_route_seq_ops; |
|---|
| 449 | 535 | |
|---|
| 450 | | -int call_fib6_notifier(struct notifier_block *nb, struct net *net, |
|---|
| 536 | +int call_fib6_notifier(struct notifier_block *nb, |
|---|
| 451 | 537 | enum fib_event_type event_type, |
|---|
| 452 | 538 | struct fib_notifier_info *info); |
|---|
| 453 | 539 | int call_fib6_notifiers(struct net *net, enum fib_event_type event_type, |
|---|
| .. | .. |
|---|
| 457 | 543 | void __net_exit fib6_notifier_exit(struct net *net); |
|---|
| 458 | 544 | |
|---|
| 459 | 545 | unsigned int fib6_tables_seq_read(struct net *net); |
|---|
| 460 | | -int fib6_tables_dump(struct net *net, struct notifier_block *nb); |
|---|
| 546 | +int fib6_tables_dump(struct net *net, struct notifier_block *nb, |
|---|
| 547 | + struct netlink_ext_ack *extack); |
|---|
| 461 | 548 | |
|---|
| 462 | 549 | void fib6_update_sernum(struct net *net, struct fib6_info *rt); |
|---|
| 463 | 550 | void fib6_update_sernum_upto_root(struct net *net, struct fib6_info *rt); |
|---|
| 551 | +void fib6_update_sernum_stub(struct net *net, struct fib6_info *f6i); |
|---|
| 464 | 552 | |
|---|
| 465 | 553 | void fib6_metric_set(struct fib6_info *f6i, int metric, u32 val); |
|---|
| 466 | 554 | static inline bool fib6_metric_locked(struct fib6_info *f6i, int metric) |
|---|
| .. | .. |
|---|
| 468 | 556 | return !!(f6i->fib6_metrics->metrics[RTAX_LOCK - 1] & (1 << metric)); |
|---|
| 469 | 557 | } |
|---|
| 470 | 558 | |
|---|
| 559 | +#if IS_BUILTIN(CONFIG_IPV6) && defined(CONFIG_BPF_SYSCALL) |
|---|
| 560 | +struct bpf_iter__ipv6_route { |
|---|
| 561 | + __bpf_md_ptr(struct bpf_iter_meta *, meta); |
|---|
| 562 | + __bpf_md_ptr(struct fib6_info *, rt); |
|---|
| 563 | +}; |
|---|
| 564 | +#endif |
|---|
| 565 | + |
|---|
| 566 | +INDIRECT_CALLABLE_DECLARE(struct rt6_info *ip6_pol_route_output(struct net *net, |
|---|
| 567 | + struct fib6_table *table, |
|---|
| 568 | + struct flowi6 *fl6, |
|---|
| 569 | + const struct sk_buff *skb, |
|---|
| 570 | + int flags)); |
|---|
| 571 | +INDIRECT_CALLABLE_DECLARE(struct rt6_info *ip6_pol_route_input(struct net *net, |
|---|
| 572 | + struct fib6_table *table, |
|---|
| 573 | + struct flowi6 *fl6, |
|---|
| 574 | + const struct sk_buff *skb, |
|---|
| 575 | + int flags)); |
|---|
| 576 | +INDIRECT_CALLABLE_DECLARE(struct rt6_info *__ip6_route_redirect(struct net *net, |
|---|
| 577 | + struct fib6_table *table, |
|---|
| 578 | + struct flowi6 *fl6, |
|---|
| 579 | + const struct sk_buff *skb, |
|---|
| 580 | + int flags)); |
|---|
| 581 | +INDIRECT_CALLABLE_DECLARE(struct rt6_info *ip6_pol_route_lookup(struct net *net, |
|---|
| 582 | + struct fib6_table *table, |
|---|
| 583 | + struct flowi6 *fl6, |
|---|
| 584 | + const struct sk_buff *skb, |
|---|
| 585 | + int flags)); |
|---|
| 586 | +static inline struct rt6_info *pol_lookup_func(pol_lookup_t lookup, |
|---|
| 587 | + struct net *net, |
|---|
| 588 | + struct fib6_table *table, |
|---|
| 589 | + struct flowi6 *fl6, |
|---|
| 590 | + const struct sk_buff *skb, |
|---|
| 591 | + int flags) |
|---|
| 592 | +{ |
|---|
| 593 | + return INDIRECT_CALL_4(lookup, |
|---|
| 594 | + ip6_pol_route_output, |
|---|
| 595 | + ip6_pol_route_input, |
|---|
| 596 | + ip6_pol_route_lookup, |
|---|
| 597 | + __ip6_route_redirect, |
|---|
| 598 | + net, table, fl6, skb, flags); |
|---|
| 599 | +} |
|---|
| 600 | + |
|---|
| 471 | 601 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
|---|
| 602 | +static inline bool fib6_has_custom_rules(const struct net *net) |
|---|
| 603 | +{ |
|---|
| 604 | + return net->ipv6.fib6_has_custom_rules; |
|---|
| 605 | +} |
|---|
| 606 | + |
|---|
| 472 | 607 | int fib6_rules_init(void); |
|---|
| 473 | 608 | void fib6_rules_cleanup(void); |
|---|
| 474 | 609 | bool fib6_rule_default(const struct fib_rule *rule); |
|---|
| 475 | | -int fib6_rules_dump(struct net *net, struct notifier_block *nb); |
|---|
| 610 | +int fib6_rules_dump(struct net *net, struct notifier_block *nb, |
|---|
| 611 | + struct netlink_ext_ack *extack); |
|---|
| 476 | 612 | unsigned int fib6_rules_seq_read(struct net *net); |
|---|
| 477 | 613 | |
|---|
| 478 | 614 | static inline bool fib6_rules_early_flow_dissect(struct net *net, |
|---|
| .. | .. |
|---|
| 493 | 629 | return true; |
|---|
| 494 | 630 | } |
|---|
| 495 | 631 | #else |
|---|
| 632 | +static inline bool fib6_has_custom_rules(const struct net *net) |
|---|
| 633 | +{ |
|---|
| 634 | + return false; |
|---|
| 635 | +} |
|---|
| 496 | 636 | static inline int fib6_rules_init(void) |
|---|
| 497 | 637 | { |
|---|
| 498 | 638 | return 0; |
|---|
| .. | .. |
|---|
| 505 | 645 | { |
|---|
| 506 | 646 | return true; |
|---|
| 507 | 647 | } |
|---|
| 508 | | -static inline int fib6_rules_dump(struct net *net, struct notifier_block *nb) |
|---|
| 648 | +static inline int fib6_rules_dump(struct net *net, struct notifier_block *nb, |
|---|
| 649 | + struct netlink_ext_ack *extack) |
|---|
| 509 | 650 | { |
|---|
| 510 | 651 | return 0; |
|---|
| 511 | 652 | } |
|---|