Page MenuHomeFreeBSD

if_vxlan(4) improvements

Authored by hrs on Jun 19 2015, 11:07 AM.



This patchset is to improve if_vxlan(4) in terms of the following:

  1. 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.
  2. 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[46] and vxlp_remote_in[46] are converted to union vxlan_sockaddr.
  3. 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:
      1. ifconfig vxlan0 create inet tunnel vni 100
      2. 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.
  4. Use counter for statistics counters

    counter_u64_t is now used for members in struct vxlan_statistics.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

hrs updated this revision to Diff 6328.Jun 19 2015, 11:07 AM
hrs retitled this revision from to if_vxlan(4) improvements.
hrs updated this object.
hrs edited the test plan for this revision. (Show Details)
hrs added reviewers: network, bryanv.
bryanv edited edge metadata.Jun 19 2015, 9:33 PM

First, thanks for this work! I had meant to add VNET support shortly after I committed this, but other stuff got in the way. Just a few initial high level comments:

  • I think using a counter(9) is overkill for those stats.
  • I'd really prefer to not lose the functionality provided by vxlan_ftable_sysctl_dump(). It is a very handy debugging feature, albeit even in its limited state.
This revision was automatically updated to reflect the committed changes.