2011-03-13 18:33:50 +08:00
|
|
|
/*
|
|
|
|
* BIRD -- RAdv Packet Processing
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "radv.h"
|
|
|
|
|
|
|
|
struct radv_ra_packet
|
|
|
|
{
|
|
|
|
u8 type;
|
|
|
|
u8 code;
|
|
|
|
u16 checksum;
|
|
|
|
u8 current_hop_limit;
|
|
|
|
u8 flags;
|
|
|
|
u16 router_lifetime;
|
|
|
|
u32 reachable_time;
|
|
|
|
u32 retrans_timer;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OPT_RA_MANAGED 0x80
|
|
|
|
#define OPT_RA_OTHER_CFG 0x40
|
|
|
|
|
2012-07-07 16:40:00 +08:00
|
|
|
#define OPT_PREFIX 3
|
|
|
|
#define OPT_MTU 5
|
2017-08-31 21:40:23 +08:00
|
|
|
#define OPT_ROUTE 24
|
2012-07-07 16:40:00 +08:00
|
|
|
#define OPT_RDNSS 25
|
|
|
|
#define OPT_DNSSL 31
|
2011-03-13 18:33:50 +08:00
|
|
|
|
|
|
|
struct radv_opt_prefix
|
|
|
|
{
|
|
|
|
u8 type;
|
|
|
|
u8 length;
|
|
|
|
u8 pxlen;
|
|
|
|
u8 flags;
|
|
|
|
u32 valid_lifetime;
|
|
|
|
u32 preferred_lifetime;
|
|
|
|
u32 reserved;
|
|
|
|
ip_addr prefix;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OPT_PX_ONLINK 0x80
|
|
|
|
#define OPT_PX_AUTONOMOUS 0x40
|
|
|
|
|
|
|
|
struct radv_opt_mtu
|
|
|
|
{
|
|
|
|
u8 type;
|
|
|
|
u8 length;
|
|
|
|
u16 reserved;
|
|
|
|
u32 mtu;
|
|
|
|
};
|
|
|
|
|
2017-08-31 21:40:23 +08:00
|
|
|
struct radv_opt_route {
|
|
|
|
u8 type;
|
|
|
|
u8 length;
|
|
|
|
u8 pxlen;
|
|
|
|
u8 flags;
|
|
|
|
u32 lifetime;
|
|
|
|
u8 prefix[];
|
|
|
|
};
|
|
|
|
|
2012-07-07 16:40:00 +08:00
|
|
|
struct radv_opt_rdnss
|
|
|
|
{
|
|
|
|
u8 type;
|
|
|
|
u8 length;
|
|
|
|
u16 reserved;
|
|
|
|
u32 lifetime;
|
|
|
|
ip_addr servers[];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct radv_opt_dnssl
|
|
|
|
{
|
|
|
|
u8 type;
|
|
|
|
u8 length;
|
|
|
|
u16 reserved;
|
|
|
|
u32 lifetime;
|
|
|
|
char domain[];
|
|
|
|
};
|
|
|
|
|
2017-08-31 21:40:23 +08:00
|
|
|
static int
|
|
|
|
radv_prepare_route(struct radv_iface *ifa, struct radv_route *rt,
|
|
|
|
char **buf, char *bufend)
|
|
|
|
{
|
|
|
|
struct radv_proto *p = ifa->ra;
|
|
|
|
struct radv_config *cf = (void *) p->p.cf;
|
|
|
|
u8 px_blocks = (rt->n.pxlen + 63) / 64;
|
|
|
|
u8 opt_len = 8 * (1 + px_blocks);
|
|
|
|
|
|
|
|
if (*buf + opt_len > bufend)
|
|
|
|
{
|
|
|
|
log(L_WARN, "%s: Too many RA options on interface %s",
|
|
|
|
p->p.name, ifa->iface->name);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct radv_opt_route *opt = (void *) *buf;
|
|
|
|
*buf += opt_len;
|
|
|
|
opt->type = OPT_ROUTE;
|
|
|
|
opt->length = 1 + px_blocks;
|
|
|
|
opt->pxlen = rt->n.pxlen;
|
|
|
|
opt->flags = rt->preference;
|
|
|
|
|
|
|
|
if (p->valid && (p->active || !cf->route_lifetime_sensitive) && rt->alive)
|
|
|
|
opt->lifetime = htonl(rt->lifetime_set ? rt->lifetime : cf->route_lifetime);
|
|
|
|
else
|
|
|
|
opt->lifetime = 0;
|
|
|
|
|
|
|
|
/* Copy the relevant part of the prefix */
|
|
|
|
ip6_addr px_addr = ip6_hton(rt->n.prefix);
|
|
|
|
memcpy(opt->prefix, &px_addr, 8 * px_blocks);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-07-07 16:40:00 +08:00
|
|
|
static int
|
|
|
|
radv_prepare_rdnss(struct radv_iface *ifa, list *rdnss_list, char **buf, char *bufend)
|
|
|
|
{
|
|
|
|
struct radv_rdnss_config *rcf = HEAD(*rdnss_list);
|
|
|
|
|
|
|
|
while(NODE_VALID(rcf))
|
|
|
|
{
|
|
|
|
struct radv_rdnss_config *rcf_base = rcf;
|
|
|
|
struct radv_opt_rdnss *op = (void *) *buf;
|
|
|
|
int max_i = (bufend - *buf - sizeof(struct radv_opt_rdnss)) / sizeof(ip_addr);
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if (max_i < 1)
|
|
|
|
goto too_much;
|
|
|
|
|
|
|
|
op->type = OPT_RDNSS;
|
|
|
|
op->reserved = 0;
|
|
|
|
|
|
|
|
if (rcf->lifetime_mult)
|
|
|
|
op->lifetime = htonl(rcf->lifetime_mult * ifa->cf->max_ra_int);
|
|
|
|
else
|
|
|
|
op->lifetime = htonl(rcf->lifetime);
|
|
|
|
|
2017-08-09 22:00:16 +08:00
|
|
|
while(NODE_VALID(rcf) &&
|
2012-07-07 16:40:00 +08:00
|
|
|
(rcf->lifetime == rcf_base->lifetime) &&
|
|
|
|
(rcf->lifetime_mult == rcf_base->lifetime_mult))
|
|
|
|
{
|
|
|
|
if (i >= max_i)
|
|
|
|
goto too_much;
|
|
|
|
|
|
|
|
op->servers[i] = rcf->server;
|
|
|
|
ipa_hton(op->servers[i]);
|
|
|
|
i++;
|
|
|
|
|
|
|
|
rcf = NODE_NEXT(rcf);
|
|
|
|
}
|
2017-08-09 22:00:16 +08:00
|
|
|
|
2012-07-07 16:40:00 +08:00
|
|
|
op->length = 1+2*i;
|
|
|
|
*buf += 8 * op->length;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
too_much:
|
|
|
|
log(L_WARN "%s: Too many RA options on interface %s",
|
|
|
|
ifa->ra->p.name, ifa->iface->name);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
radv_process_domain(struct radv_dnssl_config *cf)
|
|
|
|
{
|
|
|
|
/* Format of domain in search list is <size> <label> <size> <label> ... 0 */
|
|
|
|
|
|
|
|
char *dom = cf->domain;
|
|
|
|
char *dom_end = dom; /* Just to */
|
|
|
|
u8 *dlen_save = &cf->dlen_first;
|
2016-10-14 21:37:04 +08:00
|
|
|
uint len;
|
2012-07-07 16:40:00 +08:00
|
|
|
|
|
|
|
while (dom_end)
|
|
|
|
{
|
|
|
|
dom_end = strchr(dom, '.');
|
2016-10-14 21:37:04 +08:00
|
|
|
len = dom_end ? (uint)(dom_end - dom) : strlen(dom);
|
2012-07-07 16:40:00 +08:00
|
|
|
|
|
|
|
if (len < 1 || len > 63)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
*dlen_save = len;
|
|
|
|
dlen_save = (u8 *) dom_end;
|
|
|
|
|
|
|
|
dom += len + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = dom - cf->domain;
|
|
|
|
if (len > 254)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
cf->dlen_all = len;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
radv_prepare_dnssl(struct radv_iface *ifa, list *dnssl_list, char **buf, char *bufend)
|
|
|
|
{
|
|
|
|
struct radv_dnssl_config *dcf = HEAD(*dnssl_list);
|
|
|
|
|
|
|
|
while(NODE_VALID(dcf))
|
|
|
|
{
|
|
|
|
struct radv_dnssl_config *dcf_base = dcf;
|
|
|
|
struct radv_opt_dnssl *op = (void *) *buf;
|
|
|
|
int bsize = bufend - *buf - sizeof(struct radv_opt_dnssl);
|
|
|
|
int bpos = 0;
|
|
|
|
|
|
|
|
if (bsize < 0)
|
|
|
|
goto too_much;
|
|
|
|
|
|
|
|
bsize = bsize & ~7; /* Round down to multiples of 8 */
|
|
|
|
|
|
|
|
op->type = OPT_DNSSL;
|
|
|
|
op->reserved = 0;
|
|
|
|
|
|
|
|
if (dcf->lifetime_mult)
|
|
|
|
op->lifetime = htonl(dcf->lifetime_mult * ifa->cf->max_ra_int);
|
|
|
|
else
|
|
|
|
op->lifetime = htonl(dcf->lifetime);
|
|
|
|
|
2017-08-08 20:40:51 +08:00
|
|
|
while(NODE_VALID(dcf) &&
|
2012-07-07 16:40:00 +08:00
|
|
|
(dcf->lifetime == dcf_base->lifetime) &&
|
|
|
|
(dcf->lifetime_mult == dcf_base->lifetime_mult))
|
|
|
|
{
|
|
|
|
if (bpos + dcf->dlen_all + 1 > bsize)
|
|
|
|
goto too_much;
|
|
|
|
|
|
|
|
op->domain[bpos++] = dcf->dlen_first;
|
|
|
|
memcpy(op->domain + bpos, dcf->domain, dcf->dlen_all);
|
|
|
|
bpos += dcf->dlen_all;
|
|
|
|
|
|
|
|
dcf = NODE_NEXT(dcf);
|
|
|
|
}
|
|
|
|
|
|
|
|
int blen = (bpos + 7) / 8;
|
|
|
|
bzero(op->domain + bpos, 8 * blen - bpos);
|
|
|
|
op->length = 1 + blen;
|
|
|
|
*buf += 8 * op->length;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
too_much:
|
|
|
|
log(L_WARN "%s: Too many RA options on interface %s",
|
|
|
|
ifa->ra->p.name, ifa->iface->name);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-08-09 22:00:16 +08:00
|
|
|
static int
|
2017-08-11 18:25:36 +08:00
|
|
|
radv_prepare_prefix(struct radv_iface *ifa, struct radv_prefix *prefix,
|
|
|
|
char **buf, char *bufend)
|
2017-08-09 22:00:16 +08:00
|
|
|
{
|
2017-08-30 01:17:35 +08:00
|
|
|
struct radv_prefix_config *pc = prefix->cf;
|
2017-08-09 22:00:16 +08:00
|
|
|
|
2017-08-30 01:17:35 +08:00
|
|
|
if (*buf + sizeof(struct radv_opt_prefix) > bufend)
|
2017-08-09 22:00:16 +08:00
|
|
|
{
|
2017-08-30 01:17:35 +08:00
|
|
|
log(L_WARN "%s: Too many prefixes on interface %s",
|
|
|
|
ifa->ra->p.name, ifa->iface->name);
|
2017-08-09 22:00:16 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-08-30 01:17:35 +08:00
|
|
|
struct radv_opt_prefix *op = (void *) *buf;
|
2017-08-09 22:00:16 +08:00
|
|
|
op->type = OPT_PREFIX;
|
|
|
|
op->length = 4;
|
2017-08-11 18:25:36 +08:00
|
|
|
op->pxlen = prefix->len;
|
2017-08-09 22:00:16 +08:00
|
|
|
op->flags = (pc->onlink ? OPT_PX_ONLINK : 0) |
|
|
|
|
(pc->autonomous ? OPT_PX_AUTONOMOUS : 0);
|
|
|
|
op->valid_lifetime = (ifa->ra->active || !pc->valid_lifetime_sensitive) ?
|
|
|
|
htonl(pc->valid_lifetime) : 0;
|
|
|
|
op->preferred_lifetime = (ifa->ra->active || !pc->preferred_lifetime_sensitive) ?
|
|
|
|
htonl(pc->preferred_lifetime) : 0;
|
|
|
|
op->reserved = 0;
|
2017-08-11 18:25:36 +08:00
|
|
|
op->prefix = prefix->prefix;
|
2017-08-09 22:00:16 +08:00
|
|
|
ipa_hton(op->prefix);
|
|
|
|
*buf += sizeof(*op);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-03-13 18:33:50 +08:00
|
|
|
static void
|
|
|
|
radv_prepare_ra(struct radv_iface *ifa)
|
|
|
|
{
|
2017-08-08 20:40:51 +08:00
|
|
|
struct radv_proto *p = ifa->ra;
|
|
|
|
struct radv_config *cf = (struct radv_config *) (p->p.cf);
|
2013-02-09 06:58:27 +08:00
|
|
|
struct radv_iface_config *ic = ifa->cf;
|
2011-03-13 18:33:50 +08:00
|
|
|
|
|
|
|
char *buf = ifa->sk->tbuf;
|
|
|
|
char *bufstart = buf;
|
|
|
|
char *bufend = buf + ifa->sk->tbsize;
|
|
|
|
|
|
|
|
struct radv_ra_packet *pkt = (void *) buf;
|
|
|
|
pkt->type = ICMPV6_RA;
|
|
|
|
pkt->code = 0;
|
|
|
|
pkt->checksum = 0;
|
2013-02-09 06:58:27 +08:00
|
|
|
pkt->current_hop_limit = ic->current_hop_limit;
|
2017-08-31 21:40:23 +08:00
|
|
|
pkt->router_lifetime = (p->valid && (p->active || !ic->default_lifetime_sensitive)) ?
|
2013-02-09 06:58:27 +08:00
|
|
|
htons(ic->default_lifetime) : 0;
|
2014-07-08 04:56:21 +08:00
|
|
|
pkt->flags = (ic->managed ? OPT_RA_MANAGED : 0) |
|
|
|
|
(ic->other_config ? OPT_RA_OTHER_CFG : 0) |
|
|
|
|
(pkt->router_lifetime ? ic->default_preference : 0);
|
2013-02-09 06:58:27 +08:00
|
|
|
pkt->reachable_time = htonl(ic->reachable_time);
|
|
|
|
pkt->retrans_timer = htonl(ic->retrans_timer);
|
2011-03-13 18:33:50 +08:00
|
|
|
buf += sizeof(*pkt);
|
|
|
|
|
2013-02-09 06:58:27 +08:00
|
|
|
if (ic->link_mtu)
|
2011-03-13 18:33:50 +08:00
|
|
|
{
|
|
|
|
struct radv_opt_mtu *om = (void *) buf;
|
|
|
|
om->type = OPT_MTU;
|
|
|
|
om->length = 1;
|
|
|
|
om->reserved = 0;
|
2013-02-09 06:58:27 +08:00
|
|
|
om->mtu = htonl(ic->link_mtu);
|
2011-03-13 18:33:50 +08:00
|
|
|
buf += sizeof (*om);
|
|
|
|
}
|
|
|
|
|
2017-08-11 18:25:36 +08:00
|
|
|
struct radv_prefix *prefix;
|
|
|
|
WALK_LIST(prefix, ifa->prefixes)
|
2011-03-13 18:33:50 +08:00
|
|
|
{
|
2017-08-11 18:25:36 +08:00
|
|
|
if (radv_prepare_prefix(ifa, prefix, &buf, bufend) < 0)
|
2012-07-07 16:40:00 +08:00
|
|
|
goto done;
|
2011-03-13 18:33:50 +08:00
|
|
|
}
|
2012-07-07 16:40:00 +08:00
|
|
|
|
2013-02-09 06:58:27 +08:00
|
|
|
if (! ic->rdnss_local)
|
2012-07-07 16:40:00 +08:00
|
|
|
if (radv_prepare_rdnss(ifa, &cf->rdnss_list, &buf, bufend) < 0)
|
|
|
|
goto done;
|
|
|
|
|
2013-02-09 06:58:27 +08:00
|
|
|
if (radv_prepare_rdnss(ifa, &ic->rdnss_list, &buf, bufend) < 0)
|
2012-07-07 16:40:00 +08:00
|
|
|
goto done;
|
|
|
|
|
2013-02-09 06:58:27 +08:00
|
|
|
if (! ic->dnssl_local)
|
2012-07-07 16:40:00 +08:00
|
|
|
if (radv_prepare_dnssl(ifa, &cf->dnssl_list, &buf, bufend) < 0)
|
|
|
|
goto done;
|
|
|
|
|
2013-02-09 06:58:27 +08:00
|
|
|
if (radv_prepare_dnssl(ifa, &ic->dnssl_list, &buf, bufend) < 0)
|
2012-07-07 16:40:00 +08:00
|
|
|
goto done;
|
|
|
|
|
2017-08-31 21:40:23 +08:00
|
|
|
if (p->fib_up)
|
|
|
|
{
|
|
|
|
FIB_WALK(&p->routes, rt)
|
|
|
|
{
|
|
|
|
if (radv_prepare_route(ifa, (struct radv_route *) rt, &buf, bufend) < 0)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
FIB_WALK_END;
|
|
|
|
}
|
|
|
|
|
2012-07-07 16:40:00 +08:00
|
|
|
done:
|
2011-03-13 18:33:50 +08:00
|
|
|
ifa->plen = buf - bufstart;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2017-08-31 21:40:23 +08:00
|
|
|
radv_send_ra(struct radv_iface *ifa)
|
2011-03-13 18:33:50 +08:00
|
|
|
{
|
2017-08-08 20:40:51 +08:00
|
|
|
struct radv_proto *p = ifa->ra;
|
2011-03-13 18:33:50 +08:00
|
|
|
|
|
|
|
/* We store prepared RA in tbuf */
|
|
|
|
if (!ifa->plen)
|
|
|
|
radv_prepare_ra(ifa);
|
|
|
|
|
|
|
|
RADV_TRACE(D_PACKETS, "Sending RA via %s", ifa->iface->name);
|
2014-10-24 17:11:43 +08:00
|
|
|
sk_send_to(ifa->sk, ifa->plen, IP6_ALL_NODES, 0);
|
2011-03-13 18:33:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2016-10-14 21:37:04 +08:00
|
|
|
radv_rx_hook(sock *sk, uint size)
|
2011-03-13 18:33:50 +08:00
|
|
|
{
|
|
|
|
struct radv_iface *ifa = sk->data;
|
2017-08-08 20:40:51 +08:00
|
|
|
struct radv_proto *p = ifa->ra;
|
2011-03-13 18:33:50 +08:00
|
|
|
|
|
|
|
/* We want just packets from sk->iface */
|
|
|
|
if (sk->lifindex != sk->iface->index)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (ipa_equal(sk->faddr, ifa->addr->ip))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (size < 8)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
byte *buf = sk->rbuf;
|
|
|
|
|
|
|
|
if (buf[1] != 0)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Validation is a bit sloppy - Hop Limit is not checked and
|
|
|
|
length of options is ignored for RS and left to later for RA */
|
|
|
|
|
|
|
|
switch (buf[0])
|
|
|
|
{
|
|
|
|
case ICMPV6_RS:
|
|
|
|
RADV_TRACE(D_PACKETS, "Received RS from %I via %s",
|
|
|
|
sk->faddr, ifa->iface->name);
|
|
|
|
radv_iface_notify(ifa, RA_EV_RS);
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case ICMPV6_RA:
|
|
|
|
RADV_TRACE(D_PACKETS, "Received RA from %I via %s",
|
|
|
|
sk->faddr, ifa->iface->name);
|
|
|
|
/* FIXME - there should be some checking of received RAs, but we just ignore them */
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
radv_tx_hook(sock *sk)
|
|
|
|
{
|
|
|
|
struct radv_iface *ifa = sk->data;
|
|
|
|
log(L_WARN "%s: TX hook called", ifa->ra->p.name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
radv_err_hook(sock *sk, int err)
|
|
|
|
{
|
|
|
|
struct radv_iface *ifa = sk->data;
|
2013-07-24 20:19:37 +08:00
|
|
|
log(L_ERR "%s: Socket error on %s: %M", ifa->ra->p.name, ifa->iface->name, err);
|
2011-03-13 18:33:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
radv_sk_open(struct radv_iface *ifa)
|
|
|
|
{
|
2017-08-11 18:25:36 +08:00
|
|
|
sock *sk = sk_new(ifa->pool);
|
2011-03-13 18:33:50 +08:00
|
|
|
sk->type = SK_IP;
|
|
|
|
sk->dport = ICMPV6_PROTO;
|
2014-02-07 00:46:01 +08:00
|
|
|
sk->saddr = ifa->addr->ip;
|
2017-09-06 23:38:48 +08:00
|
|
|
sk->vrf = ifa->ra->p.vrf;
|
2011-03-13 18:33:50 +08:00
|
|
|
|
|
|
|
sk->ttl = 255; /* Mandatory for Neighbor Discovery packets */
|
|
|
|
sk->rx_hook = radv_rx_hook;
|
|
|
|
sk->tx_hook = radv_tx_hook;
|
|
|
|
sk->err_hook = radv_err_hook;
|
|
|
|
sk->iface = ifa->iface;
|
|
|
|
sk->rbsize = 1024; // bufsize(ifa);
|
|
|
|
sk->tbsize = 1024; // bufsize(ifa);
|
|
|
|
sk->data = ifa;
|
|
|
|
sk->flags = SKF_LADDR_RX;
|
|
|
|
|
2014-05-18 17:42:26 +08:00
|
|
|
if (sk_open(sk) < 0)
|
2011-03-13 18:33:50 +08:00
|
|
|
goto err;
|
|
|
|
|
|
|
|
/* We want listen just to ICMPv6 messages of type RS and RA */
|
2014-05-18 17:42:26 +08:00
|
|
|
if (sk_set_icmp6_filter(sk, ICMPV6_RS, ICMPV6_RA) < 0)
|
2011-03-13 18:33:50 +08:00
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (sk_setup_multicast(sk) < 0)
|
|
|
|
goto err;
|
|
|
|
|
2014-10-24 17:11:43 +08:00
|
|
|
if (sk_join_group(sk, IP6_ALL_ROUTERS) < 0)
|
2011-03-13 18:33:50 +08:00
|
|
|
goto err;
|
|
|
|
|
|
|
|
ifa->sk = sk;
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
err:
|
2014-05-18 17:42:26 +08:00
|
|
|
sk_log_error(sk, ifa->ra->p.name);
|
2011-03-13 18:33:50 +08:00
|
|
|
rfree(sk);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|