summaryrefslogtreecommitdiff
path: root/proto/radv/packets.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-11-23 11:50:34 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2013-11-23 11:50:34 +0100
commit736e143fa50607fcd88132291e96089b899af979 (patch)
treec0fcd5fb3174bae8a39b3a32dfe582b2ccb6df17 /proto/radv/packets.c
parent094d2bdb79e1ffa0a02761fd651aa0f0b6b0c585 (diff)
parent2b3d52aa421ae1c31e30107beefd82fddbb42854 (diff)
Merge branch 'master' into add-path
Conflicts: filter/filter.c nest/proto.c nest/rt-table.c proto/bgp/bgp.h proto/bgp/config.Y
Diffstat (limited to 'proto/radv/packets.c')
-rw-r--r--proto/radv/packets.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/proto/radv/packets.c b/proto/radv/packets.c
index 6fdfcaa3..38abaa4c 100644
--- a/proto/radv/packets.c
+++ b/proto/radv/packets.c
@@ -240,6 +240,7 @@ radv_prepare_ra(struct radv_iface *ifa)
{
struct proto_radv *ra = ifa->ra;
struct radv_config *cf = (struct radv_config *) (ra->p.cf);
+ struct radv_iface_config *ic = ifa->cf;
char *buf = ifa->sk->tbuf;
char *bufstart = buf;
@@ -249,21 +250,22 @@ radv_prepare_ra(struct radv_iface *ifa)
pkt->type = ICMPV6_RA;
pkt->code = 0;
pkt->checksum = 0;
- pkt->current_hop_limit = ifa->cf->current_hop_limit;
- pkt->flags = (ifa->cf->managed ? OPT_RA_MANAGED : 0) |
- (ifa->cf->other_config ? OPT_RA_OTHER_CFG : 0);
- pkt->router_lifetime = htons(ifa->cf->default_lifetime);
- pkt->reachable_time = htonl(ifa->cf->reachable_time);
- pkt->retrans_timer = htonl(ifa->cf->retrans_timer);
+ pkt->current_hop_limit = ic->current_hop_limit;
+ pkt->flags = (ic->managed ? OPT_RA_MANAGED : 0) |
+ (ic->other_config ? OPT_RA_OTHER_CFG : 0);
+ pkt->router_lifetime = (ra->active || !ic->default_lifetime_sensitive) ?
+ htons(ic->default_lifetime) : 0;
+ pkt->reachable_time = htonl(ic->reachable_time);
+ pkt->retrans_timer = htonl(ic->retrans_timer);
buf += sizeof(*pkt);
- if (ifa->cf->link_mtu)
+ if (ic->link_mtu)
{
struct radv_opt_mtu *om = (void *) buf;
om->type = OPT_MTU;
om->length = 1;
om->reserved = 0;
- om->mtu = htonl(ifa->cf->link_mtu);
+ om->mtu = htonl(ic->link_mtu);
buf += sizeof (*om);
}
@@ -288,26 +290,28 @@ radv_prepare_ra(struct radv_iface *ifa)
op->pxlen = addr->pxlen;
op->flags = (pc->onlink ? OPT_PX_ONLINK : 0) |
(pc->autonomous ? OPT_PX_AUTONOMOUS : 0);
- op->valid_lifetime = htonl(pc->valid_lifetime);
- op->preferred_lifetime = htonl(pc->preferred_lifetime);
+ op->valid_lifetime = (ra->active || !pc->valid_lifetime_sensitive) ?
+ htonl(pc->valid_lifetime) : 0;
+ op->preferred_lifetime = (ra->active || !pc->preferred_lifetime_sensitive) ?
+ htonl(pc->preferred_lifetime) : 0;
op->reserved = 0;
op->prefix = addr->prefix;
ipa_hton(op->prefix);
buf += sizeof(*op);
}
- if (! ifa->cf->rdnss_local)
+ if (! ic->rdnss_local)
if (radv_prepare_rdnss(ifa, &cf->rdnss_list, &buf, bufend) < 0)
goto done;
- if (radv_prepare_rdnss(ifa, &ifa->cf->rdnss_list, &buf, bufend) < 0)
+ if (radv_prepare_rdnss(ifa, &ic->rdnss_list, &buf, bufend) < 0)
goto done;
- if (! ifa->cf->dnssl_local)
+ if (! ic->dnssl_local)
if (radv_prepare_dnssl(ifa, &cf->dnssl_list, &buf, bufend) < 0)
goto done;
- if (radv_prepare_dnssl(ifa, &ifa->cf->dnssl_list, &buf, bufend) < 0)
+ if (radv_prepare_dnssl(ifa, &ic->dnssl_list, &buf, bufend) < 0)
goto done;
done:
@@ -391,7 +395,7 @@ static void
radv_err_hook(sock *sk, int err)
{
struct radv_iface *ifa = sk->data;
- log(L_ERR "%s: Socket error: %m", ifa->ra->p.name, err);
+ log(L_ERR "%s: Socket error on %s: %M", ifa->ra->p.name, ifa->iface->name, err);
}
int