int FAST_FUNC d6_send_kernel_packet(
struct d6_packet *d6_pkt, unsigned d6_pkt_size,
struct in6_addr *src_ipv6, int source_port,
- struct in6_addr *dst_ipv6, int dest_port
+ struct in6_addr *dst_ipv6, int dest_port,
+ int ifindex
);
#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 2
return d6_send_kernel_packet(
&packet, (opt_ptr - (uint8_t*) &packet),
our_cur_ipv6, CLIENT_PORT6,
- server_ipv6, SERVER_PORT6
+ server_ipv6, SERVER_PORT6,
+ client_config.ifindex
);
return d6_mcast_from_client_config_ifindex(&packet, opt_ptr);
}
return d6_send_kernel_packet(
&packet, (opt_ptr - (uint8_t*) &packet),
our_cur_ipv6, CLIENT_PORT6,
- server_ipv6, SERVER_PORT6
+ server_ipv6, SERVER_PORT6,
+ client_config.ifindex
);
}
/* Returns -1 on errors that are fatal for the socket, -2 for those that aren't */
/* NOINLINE: limit stack usage in caller */
-static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6
- UNUSED_PARAM
- , struct d6_packet *d6_pkt, int fd)
+static NOINLINE int d6_recv_raw_packet(struct in6_addr *peer_ipv6, struct d6_packet *d6_pkt, int fd)
{
int bytes;
struct ip6_udp_d6_packet packet;
// return -2;
// }
+ if (peer_ipv6)
+ *peer_ipv6 = packet.ip6.ip6_src; /* struct copy */
+
log1("received %s", "a packet");
d6_dump_packet(&packet.data);
int FAST_FUNC d6_send_kernel_packet(
struct d6_packet *d6_pkt, unsigned d6_pkt_size,
struct in6_addr *src_ipv6, int source_port,
- struct in6_addr *dst_ipv6, int dest_port)
+ struct in6_addr *dst_ipv6, int dest_port,
+ int ifindex)
{
struct sockaddr_in6 sa;
int fd;
sa.sin6_family = AF_INET6;
sa.sin6_port = htons(dest_port);
sa.sin6_addr = *dst_ipv6; /* struct copy */
+ sa.sin6_scope_id = ifindex;
if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
msg = "connect";
goto ret_close;