chiark
/
gitweb
/
~ianmdlvl
/
secnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
udp: Insist on only one successful default socket setup
[secnet.git]
/
polypath.c
diff --git
a/polypath.c
b/polypath.c
index 48d06a1308ef3924771285163c45922678a3c666..abbda21c4afcaf5d2bdcade49798fd75f345d196 100644
(file)
--- a/
polypath.c
+++ b/
polypath.c
@@
-321,8
+321,8
@@
static void polypath_record_ifaddr(struct polypath *st,
interf->socks.n_socks=0;
FILLZERO(interf->experienced_xmit_noaf);
LIST_INSERT_HEAD(&st->interfs,interf,entry);
interf->socks.n_socks=0;
FILLZERO(interf->experienced_xmit_noaf);
LIST_INSERT_HEAD(&st->interfs,interf,entry);
- udp_socks_register(&st->uc,&interf->socks);
interf->name=strdup(ifname);
interf->name=strdup(ifname);
+ udp_socks_register(&st->uc,&interf->socks,interf->name);
if (!interf->name) BADE("strdup interface name",errno);
found_interf:
if (!interf->name) BADE("strdup interface name",errno);
found_interf:
@@
-336,21
+336,23
@@
static void polypath_record_ifaddr(struct polypath *st,
bool_t ok=polypath_make_socket(st,bad,badctx, us,ifname);
if (!ok) goto out;
} else {
bool_t ok=polypath_make_socket(st,bad,badctx, us,ifname);
if (!ok) goto out;
} else {
-
FILLZERO(us->experience
d);
-
us->fd=fd
;
+
bool_t ok=udp_import_socket(uc,us,M_WARNING,f
d);
+
if (!ok) goto out
;
fd=-1;
}
interf->socks.n_socks++;
fd=-1;
}
interf->socks.n_socks++;
+ lg_perror(LG,M_INFO,0,"using %s %s",ifname,
+ iaddr_to_string(&us->addr));
us=0; /* do not destroy this socket during `out' */
us=0; /* do not destroy this socket during `out' */
- lg_perror(LG,M_INFO,0,"using %s %s",ifname,ifaddr);
} else {
int i;
for (i=0; i<interf->socks.n_socks; i++)
} else {
int i;
for (i=0; i<interf->socks.n_socks; i++)
- if (
!memcmp(&interf->socks.socks[i].addr,ia,sizeof(*ia)
))
+ if (
iaddr_equal(&interf->socks.socks[i].addr,ia,True
))
goto address_remove_found;
BAD("address to remove not found");
address_remove_found:
goto address_remove_found;
BAD("address to remove not found");
address_remove_found:
- lg_perror(LG,M_INFO,0,"removed %s %s",ifname,ifaddr);
+ lg_perror(LG,M_INFO,0,"removed %s %s",ifname,
+ iaddr_to_string(&interf->socks.socks[i].addr));
udp_destroy_socket(&st->uc,&interf->socks.socks[i]);
interf->socks.socks[i]=
interf->socks.socks[--interf->socks.n_socks];
udp_destroy_socket(&st->uc,&interf->socks.socks[i]);
interf->socks.socks[i]=
interf->socks.socks[--interf->socks.n_socks];
@@
-437,8
+439,8
@@
static bool_t polypath_sendmsg(void *commst, struct buffer_if *buf,
attempted=True;
int r=sendto(us->fd,buf->start,buf->size,
0,&dest->ia.sa,iaddr_socklen(&dest->ia));
attempted=True;
int r=sendto(us->fd,buf->start,buf->size,
0,&dest->ia.sa,iaddr_socklen(&dest->ia));
- udp_sock_experienced(0,&st->uc,
interf->name
,us,
-
1
,af, r,errno);
+ udp_sock_experienced(0,&st->uc,
&interf->socks
,us,
+
&dest->ia
,af, r,errno);
if (r>=0) {
reasonable=True;
break;
if (r>=0) {
reasonable=True;
break;