]> git.ipfire.org Git - thirdparty/iproute2.git/commit
utils: Introduce get_addr_rta() and inet_addr_match_rta()
authorSerhey Popovych <serhe.popovych@gmail.com>
Wed, 24 Jan 2018 18:56:33 +0000 (20:56 +0200)
committerDavid Ahern <dsahern@gmail.com>
Thu, 25 Jan 2018 17:31:16 +0000 (09:31 -0800)
commit27c523e209ab956ff269afec68c6e744e7f5edb6
treea4c2bea7fdaec349cb11730097f4e5d108ead761
parent68944e6f93296231c5ad4e4b06a9a619760b4754
utils: Introduce get_addr_rta() and inet_addr_match_rta()

First is used to get address from netlink attribute to
inet_prefix data structure. Use memcpy() with constant
value to let complier optimize by replacing a call by
inlining load/store instructions.

Second is used to match address in given netlink attribute
with one given as reference. It matches successfully if
no attribute is given (@rta is NULL), reference address
family is AF_UNSPEC or it's length isn't given; fails if
get_attr_rta() can't get attribute or it's family does
not match reference; calls inet_addr_match() to get final
verdict.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
include/utils.h
lib/utils.c