Revision 061ab802 sysdep/unix/io.c

View differences:

sysdep/unix/io.c
636 636
  set_inaddr(&sa->sin6_addr, a);
637 637
}
638 638

  
639
static inline void
640
fill_in_sockifa(sockaddr *sa, struct iface *ifa)
641
{
642
  sa->sin6_scope_id = ifa ? ifa->index : 0;
643
}
644

  
639 645
void
640 646
get_sockaddr(struct sockaddr_in6 *sa, ip_addr *a, unsigned *port, int check)
641 647
{
......
661 667
  set_inaddr(&sa->sin_addr, a);
662 668
}
663 669

  
670
static inline void
671
fill_in_sockifa(sockaddr *sa, struct iface *ifa)
672
{
673
}
674

  
664 675
void
665 676
get_sockaddr(struct sockaddr_in *sa, ip_addr *a, unsigned *port, int check)
666 677
{
......
874 885
    {
875 886
    case SK_UDP:
876 887
    case SK_IP:
888
#ifndef IPV6
877 889
      if (s->iface)			/* It's a broadcast socket */
878
#ifdef IPV6
879
	bug("IPv6 has no broadcasts");
880
#else
881 890
	if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one)) < 0)
882 891
	  ERR("SO_BROADCAST");
883 892
#endif
......
911 920
	    if (setsockopt(fd, SOL_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
912 921
	      ERR("IPV6_ADD_MEMBERSHIP");
913 922
	  }
914
#else
923
#else /* IPv4 */
915 924
	/* With IPv4 there are zillions of different socket interface variants. Ugh. */
916 925
	ASSERT(s->iface && s->iface->addr);
917 926
	if (err = sysio_mcast_join(s))
......
933 942
	    ERR("SO_REUSEADDR");
934 943
	}
935 944
      fill_in_sockaddr(&sa, s->saddr, port);
945
      fill_in_sockifa(&sa, s->iface);
936 946
#ifdef CONFIG_SKIP_MC_BIND
937 947
      if ((type != SK_UDP_MC) && (type != SK_IP_MC) &&
938 948
	  bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
......
1067 1077

  
1068 1078
	if (s->tbuf == s->tpos)
1069 1079
	  return 1;
1070
	fill_in_sockaddr(&sa, s->faddr, s->fport);
1071 1080

  
1081
	fill_in_sockaddr(&sa, s->faddr, s->fport);
1082
	fill_in_sockifa(&sa, s->iface);
1072 1083
	e = sendto(s->fd, s->tbuf, s->tpos - s->tbuf, 0, (struct sockaddr *) &sa, sizeof(sa));
1073 1084
	if (e < 0)
1074 1085
	  {

Also available in: Unified diff