[libvirt] [PATCH] Account for defined networks when generating bridge names

Jim Meyering jim at meyering.net
Wed Feb 18 09:12:13 UTC 2009


Cole Robinson <crobinso at redhat.com> wrote:
> This is the second part of the fix for rhbz 479622. If we are generating
> a bridge name for a virtual network, don't collide with any bridge name
> in a defined network. This patch also generates a bridge name at network
> define time, if none was passed in the xml.
>
> The downside to all this is that it won't fix things for existing
> victims of the bug: if they have 2 networks with the same bridge device
> in the xml, we can't intelligently remedy the situation. This patch just
> helps prevent future users getting into that predicament.
>
> Thanks,
> Cole
>
> diff --git a/src/bridge.c b/src/bridge.c
> index fc11429..4446a95 100644
> --- a/src/bridge.c
> +++ b/src/bridge.c
> @@ -49,7 +49,7 @@
>  #include "util.h"
>  #include "logging.h"
>
> -#define MAX_BRIDGE_ID 256
> +#define MAX_TAP_ID 256
>
>  #define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
>  #define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
> @@ -127,32 +127,13 @@ brShutdown(brControl *ctl)
>  #ifdef SIOCBRADDBR
>  int
>  brAddBridge(brControl *ctl,
> -            char **name)
> +            char *name)

Hi Cole,

Presuming this part will stay, as you rework the patch,
please make that "const".
and maybe save a line of vertical space:

  brAddBridge(brControl *ctl, const char *name)




More information about the libvir-list mailing list