This patchset is to improve if_vxlan(4) in terms of the following:
- VIMAGE support
- vxlan_[un]load() are converted to vnet_vxlan_[un]init() which are called by per-vnet SYSINIT.
- vxlan if cloner, vxlan_ifdetach_event_tag, vxlan_reuse_port, and vxlan_socket_list are now vnet-aware.
- Eliminate per-if sysctl nodes. They do not work with VIMAGE because if_index is VIMAGE-local. Configuration knobs and stats are shown in "ifconfig -v" instead. vxlan_ftable_sysctl_dump() is not converted yet, but is this really needed for practical use? If we want to keep it, converting it to an ioctl which can be called by ifconfig would work.
- scoped IPv6 address support
if_vxlan(4) did not support scoped IPv6 address properly. This means sin6_scope_id was always ignored and prevented link-local addresses from working.
Add sa6_embedscope() and sa6_recoverscope() around sockaddr passed via userland interface. To make things easy for sin6_scope_id, vxlp_local_in and vxlp_remote_in are converted to union vxlan_sockaddr.
- ifconfig tunnel command support
For consistency, if_vxlan(4) should support "ifconfig tunnel" command and use .af_status_tunnel for the endpoint configuration.
- Add support of SIOCSIFPHYADDR and SIOCSIFPHYADDR_IN6. ifconfig tunnel uses this.
- Add support of SIOCDIFPHYADDR. ifconfig -tunnel uses this. This sets vni to VXLAN_VNI_MAX to effectively disable the endpoint configuration.
Note that this does not break vxlanlocal and vxlanremote at all. The following now works:
- ifconfig vxlan0 create inet tunnel 192.168.2.1 10.0.0.1 vni 100
- ifconfig vxlan1 create inet6 tunnel 2001:db8:1::1 2001:db8:2::1 vni 110
and endpoint configuration is now shown in a consistent way with the other encapsulating network devices such as if_gif(4) and if_gre(4).
And, "vxlanvni" command in DEF_CMD_ARG was renamed to "vxlanid" and "vni" was added. DEF_CLONE_CMD_ARG() already defines "vxlanid" instead of "vxlanvni", so this difference is confusing. Both "vni" and "vxlanid" are now always valid.
- Use counter for statistics counters
counter_u64_t is now used for members in struct vxlan_statistics.