On Tue, Sep 06, 2011 at 02:19:09PM +0200, Stefan Rinkes wrote:

> Hi,
> 
> During some testing in a Carp-HA setup, we noticed that the PROMISC flag
> on carpdevs never was removed when we destroyed the carp interface.
> 
> Some investigation showed that a counter, which values defines if the
> ifpromisc() is called to remove the flag, was not initialized and the counter
> started with the DEADBEEF0 value:
> 
> #define DEADBEEF0       0xefffeecc      /* malloc's filler */
> 
> Diff:
> Index: ip_carp.c
> ===================================================================
> retrieving revision 1.189
> diff -u -r1.189 ip_carp.c
> --- ip_carp.c   8 Jul 2011 19:07:18 -0000       1.189
> +++ ip_carp.c   6 Sep 2011 12:04:49 -0000
> @@ -1821,6 +1821,7 @@
> 
>                 if (ifp->if_carp == NULL) {
>                         ncif = malloc(sizeof(*cif), M_IFADDR, M_NOWAIT);
> +                       ncif->vhif_nvrs = 0;
>                         if (ncif == NULL)
>                                 return (ENOBUFS);
>                         if ((error = ifpromisc(ifp, 1))) {
> 
> Fix is to initialize the value with 0 and now the PROMISC flag is removed if 
> the
> carp device is destroyed.
> 
> OK for you?
> 
> Greetz Stefan

That line should come (if it is correct) after the NULL check.

        -Otto

Reply via email to