VRRP: Fix incorrect computation for packet size
authorVincent Bernat <bernat@luffy.cx>
Sat, 17 Jul 2010 17:56:55 +0000 (17:56 +0000)
committerAlexandre Cassen <acassen@lnxos-dev.(none)>
Wed, 8 Dec 2010 10:40:30 +0000 (11:40 +0100)
Ternary conditional operator has lower precedence than addition. The
size of the VRRP packet was incorrectly computed and there was not
enough room for plain authentication string.

keepalived/vrrp/vrrp.c

index 7463d47..4710cf9 100644 (file)
@@ -86,7 +86,7 @@ vrrp_hd_len(vrrp_rt * vrrp)
 {
        int len = sizeof (vrrp_pkt);
        if (vrrp->family == AF_INET)
-               len += VRRP_AUTH_LEN + (!LIST_ISEMPTY(vrrp->vip)) ? LIST_SIZE(vrrp->vip) * sizeof (uint32_t) : 0;
+               len += VRRP_AUTH_LEN + ((!LIST_ISEMPTY(vrrp->vip)) ? LIST_SIZE(vrrp->vip) * sizeof (uint32_t) : 0);
         return len;
 }