On Fri, 7 May 2010, Stefan Berger wrote:
Then there is a new function that reads the VLANid of a VLAN interface via an ioctl(). This one will be needed by upcoming VEPA related patches.
Yes, this is needed by VEPA. With this patch it should be possible to collect all the components required for the VEPA (for VSI discovery protocol).
As per your/David's earlier RFC for sending the netlink message to the VSI engine (LLDPAD), the netlink message will need to contain: 1. 'Port profile' comprising of : VSI Manager ID 1 octet VSI Type ID 3 octets VSI Type ID Version 1 octet VSI Instance ID 16 octets Therefore need to extend the domain xml to take the above 4 values. reference, Pg 50 of the proposal here http://www.ieee802.org/1/files/public/docs2010/bg-joint-evb-0410v1.pdf 2. MAC address (of the virtual interface) 3. VLAN tag (associtaed with the virtual interface) thanks Vivek
On cygwin for example none of the newly added functions are available. The flags related function could not be exported due to missing PF_PACKET -- or maybe other type of protocol that needs to be used when opening the socket for running the ioctl() on. Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
<..snip>
+ +#ifdef __linux__ +int +ifaceGetVlanID(const char *vlanifname, int *vlanid) { + struct vlan_ioctl_args vlanargs = { + .cmd = GET_VLAN_VID_CMD, + }; + int rc = 0; + int fd = socket(PF_PACKET, SOCK_DGRAM, 0); + + if (fd < 0) + return errno; + + if (virStrcpyStatic(vlanargs.device1, vlanifname) == NULL) { + rc = EINVAL; + goto err_exit; + } + + if (ioctl(fd, SIOCGIFVLAN, &vlanargs) != 0) { + rc = errno; + goto err_exit; + } + + *vlanid = vlanargs.u.VID; + + err_exit: + close(fd); + + return rc; +} + +#else + +int +ifaceGetVlanID(const char *vlanifname ATTRIBUTE_UNUSED, + int *vlanid ATTRIBUTE_UNUSED) { + + ifaceError(VIR_ERR_INTERNAL_ERROR, "%s", + _("ifaceGetVlanID is not supported on non-linux platforms")); + + return ENOSYS; +} +#endif /* __linux__ */ Index: libvirt-acl/src/util/interface.h =================================================================== --- libvirt-acl.orig/src/util/interface.h +++ libvirt-acl/src/util/interface.h @@ -12,6 +12,9 @@ # include "datatypes.h" +int ifaceGetFlags(const char *name, short *flags); +int ifaceIsUp(const char *name, bool *up); + int ifaceCtrl(const char *name, bool up); static inline int ifaceUp(const char *name) { @@ -27,4 +30,6 @@ int ifaceCheck(bool reportError, const c int ifaceGetIndex(bool reportError, const char *ifname, int *ifindex); +int ifaceGetVlanID(const char *vlanifname, int *vlanid); + #endif /* __VIR_INTERFACE_H__ */ Index: libvirt-acl/src/libvirt_private.syms =================================================================== --- libvirt-acl.orig/src/libvirt_private.syms +++ libvirt-acl/src/libvirt_private.syms @@ -685,6 +685,9 @@ virArgvToString; ifaceCtrl; ifaceCheck; ifaceGetIndex; +ifaceGetFlags; +ifaceIsUp; +ifaceGetVlanID; # usb.h usbGetDevice; -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list