diff -r 3c4c3d48a835 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Aug 26 11:16:56 2010 +0100 +++ b/tools/libxl/xl_cmdimpl.c Thu Aug 26 17:51:27 2010 +0200 @@ -41,6 +41,14 @@ #include "libxlutil.h" #include "xl.h" +#define NET_DEFAULT_ADDRESS "127.0.0.1" +#if defined(__linux__) +#define NET_DEFAULT_BRIDGE "xenbr0" +#endif +#if defined(__NetBSD__) +#define NET_DEFAULT_BRIDGE "bridge0" +#endif + #define CHK_ERRNO( call ) ({ \ int chk_errno = (call); \ if (chk_errno < 0) { \ @@ -309,7 +317,7 @@ static void init_dm_info(libxl_device_mo dm_info->stdvga = 0; dm_info->vnc = 1; - dm_info->vnclisten = "127.0.0.1"; + dm_info->vnclisten = NET_DEFAULT_ADDRESS; dm_info->vncdisplay = 0; dm_info->vncunused = 1; dm_info->keymap = NULL; @@ -339,7 +347,7 @@ static void init_nic_info(libxl_device_n nic_info->mac[4] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0))); nic_info->mac[5] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0))); nic_info->ifname = NULL; - nic_info->bridge = strdup("xenbr0"); + nic_info->bridge = strdup(NET_DEFAULT_BRIDGE); CHK_ERRNO( asprintf(&nic_info->script, "%s/vif-bridge", libxl_xen_script_dir_path()) ); nic_info->nictype = NICTYPE_IOEMU; @@ -365,7 +373,7 @@ static void init_net2_info(libxl_device_ net2_info->back_trusted = 1; net2_info->filter_mac = 1; net2_info->max_bypasses = 5; - net2_info->bridge = "xenbr0"; + net2_info->bridge = NET_DEFAULT_BRIDGE; } static void init_vfb_info(libxl_device_vfb *vfb, int dev_num) @@ -373,7 +381,7 @@ static void init_vfb_info(libxl_device_v memset(vfb, 0x00, sizeof(libxl_device_vfb)); vfb->devid = dev_num; vfb->vnc = 1; - vfb->vnclisten = "127.0.0.1"; + vfb->vnclisten = NET_DEFAULT_ADDRESS; vfb->vncdisplay = 0; vfb->vncunused = 1; vfb->keymap = NULL;