From b878aa88eb8bb7ab74e24314e87c88586f15598d Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Sun, 11 Apr 2010 11:17:37 +0100 Subject: Support gai_strerror() and tidy bgp_listener code. Added support for EAI_XXX error names and gai_strerror() error messages. Tidied up bgp_listener set up to remove #if skips around the "old" way -- so that the older code doesn't simply rot away. --- lib/sockunion.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/sockunion.c') diff --git a/lib/sockunion.c b/lib/sockunion.c index 23287cd2..9a063190 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -209,7 +209,7 @@ sockunion_set_addr_any(sockunion su) * * For good measure, set the size (if that's required) and return same. */ -static int +extern int sockunion_set_port(sockunion su, in_port_t port) { switch (su->sa.sa_family) @@ -234,6 +234,8 @@ sockunion_set_port(sockunion su, in_port_t port) * * Allocates a sockunion if required. * + * Result is set "any". + * * Advice is to zeroize sockaddr_in6, in particular. */ extern sockunion @@ -455,7 +457,7 @@ sockunion_socket(sa_family_t family, int type, int protocol) err = errno ; zlog (NULL, LOG_WARNING, - "Can't make socket family=%d, type=%d, protocol=%d: %s", + "Cannot make socket family=%d, type=%d, protocol=%d: %s", (int)family, type, protocol, errtoa(err, 0).str) ; errno = err ; return -1; @@ -907,6 +909,15 @@ sockunion_dup (union sockunion *su) return dup; } +/*------------------------------------------------------------------------------ + * Copy one sockunion to another + */ +extern void +sockunion_copy (sockunion dst, sockunion src) +{ + memcpy (dst, src, sizeof(*dst)) ; +} ; + /*------------------------------------------------------------------------------ * Free given sockunion (if any). */ -- cgit v1.2.3