From 02ba2abafb9d38dc32119673bdd409b403d39ad6 Mon Sep 17 00:00:00 2001 From: jca Date: Fri, 9 Feb 2018 22:52:54 +0000 Subject: [PATCH] Style tweaks ok remi@ benno@ --- usr.sbin/ospfd/ospfd.c | 9 ++++----- usr.sbin/ospfd/parse.y | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c index 381b35fc600..3c5057ae04e 100644 --- a/usr.sbin/ospfd/ospfd.c +++ b/usr.sbin/ospfd/ospfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.c,v 1.95 2018/02/05 12:11:28 remi Exp $ */ +/* $OpenBSD: ospfd.c,v 1.96 2018/02/09 22:52:54 jca Exp $ */ /* * Copyright (c) 2005 Claudio Jeker @@ -516,13 +516,12 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric) struct in_addr addr; struct kif *kif; struct redistribute *r; - int is_default = 0, depend_ok = 1; + int is_default, depend_ok; bzero(&addr, sizeof(addr)); /* only allow 0.0.0.0/0 via REDIST_DEFAULT */ - if (kr->prefix.s_addr == INADDR_ANY && kr->prefixlen == 0) - is_default = 1; + is_default = (kr->prefix.s_addr == INADDR_ANY && kr->prefixlen == 0); SIMPLEQ_FOREACH(r, &ospfd_conf->redist_list, entry) { if (r->dependon[0] != '\0') { @@ -530,7 +529,7 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric) depend_ok = ifstate_is_up(kif); else depend_ok = 0; - } else + } else depend_ok = 1; switch (r->type & ~REDIST_NO) { diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y index 03d9ca912ab..4bf64d5d7e3 100644 --- a/usr.sbin/ospfd/parse.y +++ b/usr.sbin/ospfd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.84 2018/02/05 12:11:28 remi Exp $ */ +/* $OpenBSD: parse.y,v 1.85 2018/02/09 22:52:54 jca Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby @@ -296,9 +296,9 @@ redistribute : no REDISTRIBUTE NUMBER '/' NUMBER optlist dependon { if ($1) r->type |= REDIST_NO; r->metric = $6; - if ($7) { + if ($7) strlcpy(r->dependon, $7, sizeof(r->dependon)); - } else + else r->dependon[0] = '\0'; free($7); $$ = r; @@ -326,9 +326,9 @@ redistribute : no REDISTRIBUTE NUMBER '/' NUMBER optlist dependon { if ($1) r->type |= REDIST_NO; r->metric = $4; - if ($5) { + if ($5) strlcpy(r->dependon, $5, sizeof(r->dependon)); - } else + else r->dependon[0] = '\0'; free($3); free($5); -- 2.20.1