Commit 0b78168b authored by Théophile Bastian's avatar Théophile Bastian

Handle sending update TLVs for v4-over-v6.

parent de085c50
...@@ -1190,7 +1190,7 @@ really_buffer_update(struct buffered *buf, struct interface *ifp, ...@@ -1190,7 +1190,7 @@ really_buffer_update(struct buffered *buf, struct interface *ifp,
unsigned char *channels, int channels_len) unsigned char *channels, int channels_len)
{ {
int add_metric, v4, real_plen, real_src_plen; int add_metric, v4, real_plen, real_src_plen;
int omit, spb, channels_size, len; int ae, omit, spb, channels_size, len;
const unsigned char *real_prefix, *real_src_prefix; const unsigned char *real_prefix, *real_src_prefix;
unsigned short flags = 0; unsigned short flags = 0;
int is_ss = !is_default(src_prefix, src_plen); int is_ss = !is_default(src_prefix, src_plen);
...@@ -1214,24 +1214,28 @@ really_buffer_update(struct buffered *buf, struct interface *ifp, ...@@ -1214,24 +1214,28 @@ really_buffer_update(struct buffered *buf, struct interface *ifp,
v4 = plen >= 96 && v4mapped(prefix); v4 = plen >= 96 && v4mapped(prefix);
if(v4) { if(v4) {
if(!ifp->ipv4) if(!ifp->ipv4) {
return; ae = AE_V4OV6;
omit = 0; } else {
if(!buf->have_nh || ae = AE_IPV4;
memcmp(buf->nh, ifp->ipv4, 4) != 0) { if(!buf->have_nh ||
start_message(buf, ifp, MESSAGE_NH, 6); memcmp(buf->nh, ifp->ipv4, 4) != 0) {
accumulate_byte(buf, 1); start_message(buf, ifp, MESSAGE_NH, 6);
accumulate_byte(buf, 0); accumulate_byte(buf, AE_IPV4);
accumulate_bytes(buf, ifp->ipv4, 4); accumulate_byte(buf, 0);
end_message(buf, MESSAGE_NH, 6); accumulate_bytes(buf, ifp->ipv4, 4);
memcpy(&buf->nh, ifp->ipv4, 4); end_message(buf, MESSAGE_NH, 6);
buf->have_nh = 1; memcpy(&buf->nh, ifp->ipv4, 4);
buf->have_nh = 1;
}
} }
omit = 0;
real_prefix = prefix + 12; real_prefix = prefix + 12;
real_plen = plen - 96; real_plen = plen - 96;
real_src_prefix = src_prefix + 12; real_src_prefix = src_prefix + 12;
real_src_plen = src_plen - 96; real_src_plen = src_plen - 96;
} else { } else {
ae = AE_IPV6;
omit = 0; omit = 0;
if(buf->have_prefix) { if(buf->have_prefix) {
while(omit < plen / 8 && while(omit < plen / 8 &&
...@@ -1267,7 +1271,7 @@ really_buffer_update(struct buffered *buf, struct interface *ifp, ...@@ -1267,7 +1271,7 @@ really_buffer_update(struct buffered *buf, struct interface *ifp,
len += 3 + spb; len += 3 + spb;
start_message(buf, ifp, MESSAGE_UPDATE, len); start_message(buf, ifp, MESSAGE_UPDATE, len);
accumulate_byte(buf, v4 ? 1 : 2); accumulate_byte(buf, ae);
accumulate_byte(buf, flags); accumulate_byte(buf, flags);
accumulate_byte(buf, real_plen); accumulate_byte(buf, real_plen);
accumulate_byte(buf, omit); accumulate_byte(buf, omit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment