
On Fri, Jan 20, 2012 at 03:56:27PM +0100, D. Herrendoerfer wrote:
From: "D. Herrendoerfer" <d.herrendoerfer@herrendoerfer.name>
Make macvtap setup code register a callback to handle link status changes sent by lldpad.
This is prototype code for reference only.
Signed-off-by: D. Herrendoerfer <d.herrendoerfer@herrendoerfer.name> --- src/util/virnetdevmacvlan.c | 161 ++++++++++++++++++++++++++++++++++++++++++- src/util/virnetdevmacvlan.h | 1 + 2 files changed, 161 insertions(+), 1 deletions(-)
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index 5e55b72..e4a280b 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -46,7 +46,6 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST, "passthrough")
#if WITH_MACVTAP - # include <stdint.h> # include <stdio.h> # include <errno.h> @@ -57,6 +56,8 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST, # include <linux/if.h> # include <linux/if_tun.h>
+# include <c-ctype.h> + /* Older kernels lacked this enum value. */ # if !HAVE_DECL_MACVLAN_MODE_PASSTHRU # define MACVLAN_MODE_PASSTHRU 8 @@ -67,6 +68,7 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST, # include "uuid.h" # include "virfile.h" # include "netlink.h" +# include "netlink-event.h" # include "virnetdev.h"
# define MACVTAP_NAME_PREFIX "macvtap" @@ -75,6 +77,7 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST, # define MACVLAN_NAME_PREFIX "macvlan" # define MACVLAN_NAME_PATTERN "macvlan%d"
+ /** * virNetDevMacVLanCreate: * @@ -445,6 +448,142 @@ static const uint32_t modeMap[VIR_NETDEV_MACVLAN_MODE_LAST] = { [VIR_NETDEV_MACVLAN_MODE_PASSTHRU] = MACVLAN_MODE_PASSTHRU, };
+# define LLDPAD_PID_FILE "/var/run/lldpad.pid" + +static uint32_t +GetLldpadPid(void) {
Please use standard name prefixes for all functions & structs, even if they are static. eg virNetDevMacVLanGetLldpadPid()
+/* Struct to hold the state and configuration of a 802.1qbg port */ +struct netlinkCallbackData {
struct virNetDevMacVLanCallbackData Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|