miniupnpd/upnputils.c: use scope in get_lan_for_peer() for IPv6 addresses

see #032
This commit is contained in:
Thomas Bernard 2013-04-20 11:06:17 +02:00
parent e371359050
commit e21e724b81
2 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,7 @@
$Id: Changelog.txt,v 1.332 2013/03/23 10:46:53 nanard Exp $
$Id: Changelog.txt,v 1.333 2013/04/20 09:03:17 nanard Exp $
2013/04/20:
use scope in get_lan_for_peer() for IPv6 addresses
2013/03/23:
autodetect LAN interface netmask instead of defaulting to /24

View File

@ -1,4 +1,4 @@
/* $Id: upnputils.c,v 1.6 2013/02/06 10:50:04 nanard Exp $ */
/* $Id: upnputils.c,v 1.7 2013/04/20 09:03:18 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2013 Thomas Bernard
@ -114,8 +114,13 @@ get_lan_for_peer(const struct sockaddr * peer)
else
{
int index = -1;
if(get_src_for_route_to(peer, NULL, NULL, &index) < 0)
return NULL;
if(peer6->sin6_scope_id > 0)
index = (int)peer6->sin6_scope_id;
else
{
if(get_src_for_route_to(peer, NULL, NULL, &index) < 0)
return NULL;
}
syslog(LOG_DEBUG, "%s looking for LAN interface index=%d",
"get_lan_for_peer()", index);
for(lan_addr = lan_addrs.lh_first;