aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/d6_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/d6_packet.c')
-rw-r--r--networking/udhcp/d6_packet.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/networking/udhcp/d6_packet.c b/networking/udhcp/d6_packet.c
index c1949f6e3..142de9b43 100644
--- a/networking/udhcp/d6_packet.c
+++ b/networking/udhcp/d6_packet.c
@@ -27,9 +27,8 @@ void FAST_FUNC d6_dump_packet(struct d6_packet *packet)
27} 27}
28#endif 28#endif
29 29
30int FAST_FUNC d6_recv_kernel_packet(struct in6_addr *peer_ipv6 30int FAST_FUNC d6_recv_kernel_packet(struct in6_addr *peer_ipv6 UNUSED_PARAM,
31 UNUSED_PARAM 31 struct d6_packet *packet, int fd)
32 , struct d6_packet *packet, int fd)
33{ 32{
34 int bytes; 33 int bytes;
35 34
@@ -81,12 +80,22 @@ int FAST_FUNC d6_send_raw_packet_from_client_data_ifindex(
81 dest_sll.sll_halen = 6; 80 dest_sll.sll_halen = 6;
82 memcpy(dest_sll.sll_addr, dest_arp, 6); 81 memcpy(dest_sll.sll_addr, dest_arp, 6);
83 82
83//TODO: is bind() necessary? we sendto() to this destination, should work anyway
84 if (bind(fd, (struct sockaddr *)&dest_sll, sizeof(dest_sll)) < 0) { 84 if (bind(fd, (struct sockaddr *)&dest_sll, sizeof(dest_sll)) < 0) {
85 msg = "bind(%s)"; 85 msg = "bind(%s)";
86 goto ret_close; 86 goto ret_close;
87 } 87 }
88 88
89 packet.ip6.ip6_vfc = (6 << 4); /* 4 bits version, top 4 bits of tclass */ 89 packet.ip6.ip6_vfc = (6 << 4); /* 4 bits version, top 4 bits of tclass */
90// In case we have no IPv6 on our interface at all, we can try
91// to fill "all hosts" mcast address as source:
92// /* FF02::1 is Link-local "All_Nodes" address */
93// packet.ip6.ip6_dst.s6_addr[0] = 0xff;
94// packet.ip6.ip6_dst.s6_addr[1] = 0x02;
95// packet.ip6.ip6_dst.s6_addr[15] = 0x01;
96// Maybe some servers will be able to respond to us this way?
97// Users report that leaving ::0 address there makes servers try to reply to ::0,
98// which doesn't work.
90 if (src_ipv6) 99 if (src_ipv6)
91 packet.ip6.ip6_src = *src_ipv6; /* struct copy */ 100 packet.ip6.ip6_src = *src_ipv6; /* struct copy */
92 packet.ip6.ip6_dst = *dst_ipv6; /* struct copy */ 101 packet.ip6.ip6_dst = *dst_ipv6; /* struct copy */