summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldpd/hello.c
diff options
context:
space:
mode:
authorrenato <renato@openbsd.org>2016-05-23 18:28:22 +0000
committerrenato <renato@openbsd.org>2016-05-23 18:28:22 +0000
commit7aa09c5d411a57a218dbba27d81f403f655f7ab8 (patch)
tree4228d3740e9c975fdbcd66b18a4bd5fa4073db6e /usr.sbin/ldpd/hello.c
parentMove socket creation and setup into a specialized function. (diff)
downloadwireguard-openbsd-7aa09c5d411a57a218dbba27d81f403f655f7ab8.tar.xz
wireguard-openbsd-7aa09c5d411a57a218dbba27d81f403f655f7ab8.zip
Copy structs by assignment instead of memcpy.
Copying by straight assignment is shorter, easier to read and has a higher level of abstraction. We'll only avoid it when copying from an unaligned source (e.g., network buffers). In addition, copy in_addr structs directly.
Diffstat (limited to 'usr.sbin/ldpd/hello.c')
-rw-r--r--usr.sbin/ldpd/hello.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/ldpd/hello.c b/usr.sbin/ldpd/hello.c
index 3b0f5730f35..6b1497b1c77 100644
--- a/usr.sbin/ldpd/hello.c
+++ b/usr.sbin/ldpd/hello.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hello.c,v 1.37 2016/05/23 17:43:42 renato Exp $ */
+/* $OpenBSD: hello.c,v 1.38 2016/05/23 18:28:22 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -63,7 +63,7 @@ send_hello(enum hello_type type, struct iface *iface, struct tnbr *tnbr)
fd = global.ldp_disc_socket;
break;
case HELLO_TARGETED:
- dst.sin_addr.s_addr = tnbr->addr.s_addr;
+ dst.sin_addr = tnbr->addr;
holdtime = tnbr->hello_holdtime;
flags = TARGETED_HELLO;
if ((tnbr->flags & F_TNBR_CONFIGURED) || tnbr->pw_count)
@@ -158,7 +158,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *lm, struct in_addr src,
} else {
source.type = HELLO_LINK;
source.link.iface = iface;
- source.link.src_addr.s_addr = src.s_addr;
+ source.link.src_addr = src;
}
r = tlv_decode_opt_hello_prms(buf, len, &transport_addr,
@@ -176,7 +176,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *lm, struct in_addr src,
/* implicit transport address */
if (transport_addr.s_addr == INADDR_ANY)
- transport_addr.s_addr = src.s_addr;
+ transport_addr = src;
if (bad_ip_addr(transport_addr)) {
log_debug("%s: lsr-id %s: invalid transport address %s",
__func__, inet_ntoa(lsr_id), inet_ntoa(transport_addr));