From: renato Date: Fri, 1 Jul 2016 23:18:24 +0000 (+0000) Subject: Rename hello flags to keep consistent with the rest of the code. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d7525efde485d62ed1c76a27679c9fc64125e701;p=openbsd Rename hello flags to keep consistent with the rest of the code. Flag constants should start with F_. --- diff --git a/usr.sbin/ldpd/hello.c b/usr.sbin/ldpd/hello.c index 09c3976ed1e..cfe6415a928 100644 --- a/usr.sbin/ldpd/hello.c +++ b/usr.sbin/ldpd/hello.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hello.c,v 1.53 2016/07/01 23:14:31 renato Exp $ */ +/* $OpenBSD: hello.c,v 1.54 2016/07/01 23:18:24 renato Exp $ */ /* * Copyright (c) 2013, 2016 Renato Westphal @@ -54,7 +54,7 @@ send_hello(enum hello_type type, struct iface_af *ia, struct tnbr *tnbr) switch (af) { case AF_INET: if (!(leconf->ipv4.flags & F_LDPD_AF_NO_GTSM)) - flags |= GTSM_HELLO; + flags |= F_HELLO_GTSM; dst.v4 = global.mcast_addr_v4; break; case AF_INET6: @@ -67,9 +67,9 @@ send_hello(enum hello_type type, struct iface_af *ia, struct tnbr *tnbr) case HELLO_TARGETED: af = tnbr->af; holdtime = tnbr->hello_holdtime; - flags = TARGETED_HELLO; + flags = F_HELLO_TARGETED; if ((tnbr->flags & F_TNBR_CONFIGURED) || tnbr->pw_count) - flags |= REQUEST_TARG_HELLO; + flags |= F_HELLO_REQ_TARG; fd = (ldp_af_global_get(&global, af))->ldp_edisc_socket; /* unicast destination address */ @@ -176,12 +176,12 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *lm, int af, __func__, inet_ntoa(lsr_id), holdtime); return; } - if (multicast && (flags & TARGETED_HELLO)) { + if (multicast && (flags & F_HELLO_TARGETED)) { log_debug("%s: lsr-id %s: multicast targeted hello", __func__, inet_ntoa(lsr_id)); return; } - if (!multicast && !((flags & TARGETED_HELLO))) { + if (!multicast && !((flags & F_HELLO_TARGETED))) { log_debug("%s: lsr-id %s: unicast link hello", __func__, inet_ntoa(lsr_id)); return; @@ -219,7 +219,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *lm, int af, * (i.e., MUST discard the targeted Hello if it failed the * check)". */ - if (flags & TARGETED_HELLO) { + if (flags & F_HELLO_TARGETED) { log_debug("%s: lsr-id %s: invalid targeted hello " "transport address %s", __func__, inet_ntoa(lsr_id), log_addr(af, &trans_addr)); @@ -229,7 +229,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *lm, int af, } memset(&source, 0, sizeof(source)); - if (flags & TARGETED_HELLO) { + if (flags & F_HELLO_TARGETED) { /* * RFC 7552 - Section 5.2: * "The link-local IPv6 addresses MUST NOT be used as the @@ -246,13 +246,13 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *lm, int af, /* remove the dynamic tnbr if the 'R' bit was cleared */ if (tnbr && (tnbr->flags & F_TNBR_DYNAMIC) && - !((flags & REQUEST_TARG_HELLO))) { + !((flags & F_HELLO_REQ_TARG))) { tnbr->flags &= ~F_TNBR_DYNAMIC; tnbr = tnbr_check(tnbr); } if (!tnbr) { - if (!((flags & REQUEST_TARG_HELLO) && + if (!((flags & F_HELLO_REQ_TARG) && ((ldp_af_conf_get(leconf, af))->flags & F_LDPD_AF_THELLO_ACCEPT))) return; @@ -367,7 +367,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *lm, int af, /* dynamic LDPv4 GTSM negotiation as per RFC 6720 */ if (nbr) { - if (flags & GTSM_HELLO) + if (flags & F_HELLO_GTSM) nbr->flags |= F_NBR_GTSM_NEGOTIATED; else nbr->flags &= ~F_NBR_GTSM_NEGOTIATED; diff --git a/usr.sbin/ldpd/ldp.h b/usr.sbin/ldpd/ldp.h index 281decc7729..242452db3aa 100644 --- a/usr.sbin/ldpd/ldp.h +++ b/usr.sbin/ldpd/ldp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldp.h,v 1.30 2016/07/01 23:14:31 renato Exp $ */ +/* $OpenBSD: ldp.h,v 1.31 2016/07/01 23:18:24 renato Exp $ */ /* * Copyright (c) 2013, 2016 Renato Westphal @@ -140,9 +140,9 @@ struct hello_prms_tlv { uint16_t flags; }; -#define TARGETED_HELLO 0x8000 -#define REQUEST_TARG_HELLO 0x4000 -#define GTSM_HELLO 0x2000 +#define F_HELLO_TARGETED 0x8000 +#define F_HELLO_REQ_TARG 0x4000 +#define F_HELLO_GTSM 0x2000 struct hello_prms_opt4_tlv { uint16_t type;