]> git.proxmox.com Git - mirror_iproute2.git/commit
utils: Introduce and use inet_prefix_reset()
authorSerhey Popovych <serhe.popovych@gmail.com>
Mon, 12 Feb 2018 20:17:56 +0000 (22:17 +0200)
committerDavid Ahern <dsahern@gmail.com>
Wed, 14 Feb 2018 17:00:26 +0000 (09:00 -0800)
commit9cc173d4855a279631f91736d83a6005dd4ee5f3
tree717201e4a991c70eda50df64321783a0013db43e
parent5a809da4f56b724861725e74f809b49dae084fa5
utils: Introduce and use inet_prefix_reset()

Initializing @inet_prefix using C initializers or memset() seems
inefficient and unnecessary: only small part of ->data[] field will be
used to store address corresponding to ->family.

Instead initialize ->flags with zero and assume no other fields accessed
before checking corresponding bits in ->flags. For example special
helpers (e.g. is_addrtype_*()) can be used to ensure that @inet_prefix
contains valid ip or ipv6 address.

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