+ callback(st, bad,badctx, add,ifname,ifaddr,&ia,-1);
+
+ out:;
+}
+
+static void dump_pria(struct polypath *st, const char *ifname)
+{
+#ifdef POLYPATH_DEBUG
+ struct interf *interf;
+ if (ifname)
+ lg_perror(LG,M_DEBUG,0, "polypath record ifaddr `%s'",ifname);
+ LIST_FOREACH(interf, &st->interfs, entry) {
+ lg_perror(LG,M_DEBUG,0, " polypath interface `%s', nsocks=%d",
+ interf->name, interf->socks.n_socks);
+ int i;
+ for (i=0; i<interf->socks.n_socks; i++) {
+ struct udpsock *us=&interf->socks.socks[i];
+ lg_perror(LG,M_DEBUG,0, " polypath sock fd=%d addr=%s",
+ us->fd, iaddr_to_string(&us->addr));
+ }
+ }
+#endif
+}
+
+static bool_t polypath_make_socket(struct polypath *st,
+ bad_fn_type *bad, void *badctx,
+ struct udpsock *us, const char *ifname)
+ /* on error exit has called bad; might leave us->fd as -1 */
+{
+ assert(us->fd==-1);
+
+ bool_t ok=udp_make_socket(&st->uc,us,M_WARNING);
+ if (!ok) BAD("unable to set up socket");
+ int r=setsockopt(us->fd,SOL_SOCKET,SO_BINDTODEVICE,
+ ifname,strlen(ifname)+1);
+ if (r) BADE("setsockopt(,,SO_BINDTODEVICE,)",errno);
+ return True;
+
+ out:
+ return False;
+}
+
+static void polypath_record_ifaddr(struct polypath *st,
+ bad_fn_type *bad, void *badctx,
+ bool_t add, const char *ifname,
+ const char *ifaddr,
+ const union iaddr *ia, int fd)
+{
+ struct udpcommon *uc=&st->uc;
+ struct interf *interf=0;
+ struct udpsock *us=0;
+
+ dump_pria(st,ifname);
+