vrrpd: style cleanup

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2019-02-26 18:49:11 +00:00
parent 8cd1d2779d
commit 354b49d6d9
4 changed files with 13 additions and 12 deletions

View File

@ -478,7 +478,6 @@ static bool vrrp_attach_interface(struct vrrp_router *r)
r->mvl_ifp = selection;
return !!r->mvl_ifp;
}
static struct vrrp_router *vrrp_router_create(struct vrrp_vrouter *vr,
@ -594,8 +593,8 @@ static void vrrp_send_advertisement(struct vrrp_router *r)
if (DEBUG_MODE_CHECK(&vrrp_dbg_pkt, DEBUG_MODE_ALL))
zlog_hexdump(pkt, (size_t)pktsz);
const char *group =
r->family == AF_INET ? VRRP_MCASTV4_GROUP_STR : VRRP_MCASTV6_GROUP_STR;
const char *group = r->family == AF_INET ? VRRP_MCASTV4_GROUP_STR
: VRRP_MCASTV6_GROUP_STR;
str2sockunion(group, &dest);
ssize_t sent = sendto(r->sock_tx, pkt, (size_t)pktsz, 0, &dest.sa,
@ -711,7 +710,8 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
r->vr->advertisement_interval * 10,
&r->t_adver_timer);
} else if (pkt->hdr.priority > r->priority
|| ((pkt->hdr.priority == r->priority) && addrcmp > 0)) {
|| ((pkt->hdr.priority == r->priority)
&& addrcmp > 0)) {
zlog_info(
VRRP_LOGPFX VRRP_LOGPFX_VRID
"Received advertisement from %s w/ priority %" PRIu8
@ -1520,8 +1520,8 @@ static void vrrp_autoconfig_autoaddrupdate(struct vrrp_vrouter *vr)
vr->vrid, vr->v4->mvl_ifp->name);
for (ALL_LIST_ELEMENTS_RO(vr->v4->mvl_ifp->connected, ln, c))
if (c->address->family == AF_INET) {
inet_ntop(AF_INET, &c->address->u.prefix4, ipbuf,
sizeof(ipbuf));
inet_ntop(AF_INET, &c->address->u.prefix4,
ipbuf, sizeof(ipbuf));
DEBUGD(&vrrp_dbg_auto,
VRRP_LOGPFX VRRP_LOGPFX_VRID "Adding %s",
vr->vrid, ipbuf);

View File

@ -50,7 +50,8 @@
static int garp_fd = -1;
/* Send the gratuitous ARP message */
static ssize_t vrrp_send_garp(struct interface *ifp, uint8_t *buf, ssize_t pack_len)
static ssize_t vrrp_send_garp(struct interface *ifp, uint8_t *buf,
ssize_t pack_len)
{
struct sockaddr_ll sll;
ssize_t len;
@ -59,7 +60,7 @@ static ssize_t vrrp_send_garp(struct interface *ifp, uint8_t *buf, ssize_t pack_
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = ETH_P_ARP;
sll.sll_ifindex = (int) ifp->ifindex;
sll.sll_ifindex = (int)ifp->ifindex;
sll.sll_halen = ifp->hw_addr_len;
memset(sll.sll_addr, 0xFF, ETH_ALEN);
@ -80,14 +81,14 @@ static ssize_t vrrp_build_garp(uint8_t *buf, struct interface *ifp,
return -1;
/* Build Ethernet header */
struct ether_header *eth = (struct ether_header *) buf;
struct ether_header *eth = (struct ether_header *)buf;
memset(eth->ether_dhost, 0xFF, ETH_ALEN);
memcpy(eth->ether_shost, ifp->hw_addr, ETH_ALEN);
eth->ether_type = htons(ETHERTYPE_ARP);
/* Build ARP payload */
struct arphdr *arph = (struct arphdr *) (buf + ETHER_HDR_LEN);
struct arphdr *arph = (struct arphdr *)(buf + ETHER_HDR_LEN);
arph->ar_hrd = htons(HWTYPE_ETHER);
arph->ar_pro = htons(ETHERTYPE_IP);

View File

@ -57,7 +57,7 @@ struct zebra_privs_t vrrp_privs = {
.cap_num_p = array_size(_caps_p),
.cap_num_i = 0};
struct option longopts[] = { { 0 } };
struct option longopts[] = {{0}};
/* Master of threads. */
struct thread_master *master;

View File

@ -67,7 +67,7 @@ static int ndisc_fd = -1;
* 0 otherwise
*/
static int vrrp_ndisc_una_build(struct interface *ifp, struct ipaddr *ip,
uint8_t *buf, size_t bufsiz)
uint8_t *buf, size_t bufsiz)
{
if (bufsiz < VRRP_NDISC_SIZE)
return -1;