mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
net_util: add support for IPv6 addresses on tap interfaces
Allow tap interfaces to be configured with an IPv6 address. The change is fairly straightforward: we need to update the API types and CLI parsing to accept either an IPv6 or IPv4 and then match on the IP address type when the tap device is configured. For IPv6 addresses, the netmask (prefix) must be provided at the same time as the address itself (in the SIOCSIFADDR ioctl). They cannot be configured separately. So we remove the separate "set_netmask" function and convert "set_ip_addr" to also accept a netmask. For IPv4 addresses, the IP address and netmask were already always set together, so this should have no functional impact for users of IPv4 addresses. Signed-off-by: Gregory Anders <ganders@cloudflare.com>
This commit is contained in:
committed by
Rob Bradford
parent
1454d39b28
commit
dce82a34d0
@@ -26,6 +26,9 @@ pub mod if_tun;
|
||||
// --constified-enum '*' --with-derive-default
|
||||
// Name is "inn" to avoid conflicting with "in" keyword.
|
||||
pub mod inn;
|
||||
// generated with bindgen /usr/include/linux/ipv6.h --no-layout-tests --constified-enum '*'
|
||||
// --allowlist-type 'sockaddr_in6|in6_ifreq'
|
||||
pub mod ipv6;
|
||||
// generated with bindgen /usr/include/linux/sockios.h --no-unstable-rust
|
||||
// --constified-enum '*' --with-derive-default
|
||||
pub mod sockios;
|
||||
@@ -35,6 +38,7 @@ pub use if_tun::{
|
||||
};
|
||||
pub use iff::{ifreq, net_device_flags_IFF_UP, setsockopt, sockaddr, AF_INET};
|
||||
pub use inn::sockaddr_in;
|
||||
pub use ipv6::{in6_ifreq, sockaddr_in6};
|
||||
|
||||
pub const TUNTAP: ::std::os::raw::c_uint = 84;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user