minissdpd/getroute.c: define SA_LEN in all situations

This commit is contained in:
Thomas Bernard 2014-12-01 10:31:13 +01:00
parent 63179a1f7f
commit f43f7ee18f
1 changed files with 18 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $Id: getroute.c,v 1.3 2014/11/28 16:30:37 nanard Exp $ */
/* $Id: getroute.c,v 1.4 2014/12/01 09:07:17 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2014 Thomas Bernard
@ -30,6 +30,23 @@
#include "getroute.h"
#include "upnputils.h"
#if defined(__sun)
static size_t _sa_len(const struct sockaddr *addr)
{
if(addr->sa_family == AF_INET)
return (sizeof(struct sockaddr_in));
else if (addr->sa_family == AF_INET6)
return (sizeof(struct sockaddr_in6));
else
return (sizeof(struct sockaddr));
}
#define SA_LEN(sa) (_sa_len(sa))
#else
#if !defined(SA_LEN)
#define SA_LEN(sa) ((sa)->sa_len)
#endif
#endif
int
get_src_for_route_to(const struct sockaddr * dst,
void * src, size_t * src_len,