Skip to content
Browse files

High (LF 2034): RA: IPv6addr: fix aborting on x86_64 and sending neig…

…hbor advertisements
  • Loading branch information...
1 parent bd841ff commit 0300254d2f42c84a031915228b9495b949b218b3 @kskmori kskmori committed Jan 20, 2009
Showing with 12 additions and 0 deletions.
  1. +12 −0 heartbeat/IPv6addr.c
View
12 heartbeat/IPv6addr.c
@@ -387,12 +387,21 @@ send_ua(struct in6_addr* src_ip, char* if_name)
struct libnet_in6_addr dst_ip;
struct libnet_ether_addr *mac_address;
char payload[24];
+ int ifindex;
if ((l=libnet_init(LIBNET_RAW6, if_name, errbuf)) == NULL) {
cl_log(LOG_ERR, "libnet_init failure on %s", if_name);
goto err;
}
+ /* set the outgoing interface */
+ ifindex = if_nametoindex(if_name);
+ if (setsockopt(libnet_getfd(l), IPPROTO_IPV6, IPV6_MULTICAST_IF,
+ &ifindex, sizeof(ifindex)) < 0) {
+ cl_log(LOG_ERR, "setsockopt(IPV6_MULTICAST_IF): %s",
+ strerror(errno));
+ goto err;
+ }
mac_address = libnet_get_hwaddr(l);
if (!mac_address) {
@@ -414,6 +423,9 @@ send_ua(struct in6_addr* src_ip, char* if_name)
libnet_build_ipv6(0,0,LIBNET_ICMPV6_H + sizeof(payload),IPPROTO_ICMP6,
255,*(struct libnet_in6_addr*)src_ip,
dst_ip,NULL,0,l,0);
+ /* Hack: adjust the correct checksum offset. see LF #2034 */
+ libnet_pblock_record_ip_offset(l, l->total_size);
+
if (libnet_write(l) == -1)
{

0 comments on commit 0300254

Please sign in to comment.
Something went wrong with that request. Please try again.