summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6_nbr.c
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2014-04-18 10:48:31 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2014-04-18 10:48:31 +0000
commitead8f16d7f9c050a5bff8d2edc980b290f54e7f9 (patch)
treee553cd5fec4045a19aee8bcf03d02210ec98cfa7 /sys/netinet6/nd6_nbr.c
parentc8eda18cb26aab069ab65363196d11a8a337b4ae (diff)
Invert the signature logic of in{,6}_selectsrc, make them return the
error code and pass the resulting source address back to the caller through a pointer, as suggested by chrisz. This gives us more readable code, and eases the deletion of useless checks in the callers' error path. Add a bunch of "0 -> NULL" conversions, while here. ok chrisz@ mpi@
Diffstat (limited to 'sys/netinet6/nd6_nbr.c')
-rw-r--r--sys/netinet6/nd6_nbr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 52da768dcf2..729c959ea27 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.77 2014/04/14 09:06:42 mpi Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.78 2014/04/18 10:48:30 jca Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -456,9 +456,9 @@ nd6_ns_output(struct ifnet *ifp, struct in6_addr *daddr6,
int error;
bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa));
- src0 = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL,
- &error, m->m_pkthdr.ph_rtableid);
- if (src0 == NULL) {
+ error = in6_selectsrc(&src0, &dst_sa, NULL, NULL, &ro,
+ NULL, m->m_pkthdr.ph_rtableid);
+ if (error) {
char addr[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG,
@@ -968,9 +968,9 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6,
* Select a source whose scope is the same as that of the dest.
*/
bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa));
- src0 = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, &error,
+ error = in6_selectsrc(&src0, &dst_sa, NULL, NULL, &ro, NULL,
m->m_pkthdr.ph_rtableid);
- if (src0 == NULL) {
+ if (error) {
char addr[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG, "nd6_na_output: source can't be "