Commit 360f9e19 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Move rfc6126_compatible back into struct interface.

Avoid the duplication by passing around an interface pointer.
parent 68b6c5ec
...@@ -443,7 +443,10 @@ interface_up(struct interface *ifp, int up) ...@@ -443,7 +443,10 @@ interface_up(struct interface *ifp, int up)
"but timestamps are disabled on interface %s.\n", "but timestamps are disabled on interface %s.\n",
ifp->name); ifp->name);
ifp->buf.rfc6126_compatible = (IF_CONF(ifp, rfc6126) == CONFIG_YES); if(IF_CONF(ifp, rfc6126) == CONFIG_YES)
ifp->flags |= IF_RFC6126;
else
ifp->flags &= ~IF_RFC6126;
rc = check_link_local_addresses(ifp); rc = check_link_local_addresses(ifp);
if(rc < 0) { if(rc < 0) {
......
...@@ -72,6 +72,8 @@ struct interface_conf { ...@@ -72,6 +72,8 @@ struct interface_conf {
#define IF_FARAWAY (1 << 4) #define IF_FARAWAY (1 << 4)
/* Send most TLVs over unicast. */ /* Send most TLVs over unicast. */
#define IF_UNICAST (1 << 5) #define IF_UNICAST (1 << 5)
/* Remain compatible with RFC 6126. */
#define IF_RFC6126 (1 << 6)
/* Only INTERFERING can appear on the wire. */ /* Only INTERFERING can appear on the wire. */
#define IF_CHANNEL_UNKNOWN 0 #define IF_CHANNEL_UNKNOWN 0
...@@ -86,7 +88,6 @@ struct buffered { ...@@ -86,7 +88,6 @@ struct buffered {
int flush_interval; int flush_interval;
struct timeval timeout; struct timeval timeout;
char enable_timestamps; char enable_timestamps;
char rfc6126_compatible;
char have_id; char have_id;
char have_nh; char have_nh;
char have_prefix; char have_prefix;
......
...@@ -1069,7 +1069,7 @@ really_buffer_update(struct buffered *buf, struct interface *ifp, ...@@ -1069,7 +1069,7 @@ really_buffer_update(struct buffered *buf, struct interface *ifp,
if(!if_up(ifp)) if(!if_up(ifp))
return; return;
if(is_ss && buf->rfc6126_compatible) if(is_ss && (ifp->flags & IF_RFC6126) != 0)
return; return;
add_metric = output_filter(id, prefix, plen, src_prefix, add_metric = output_filter(id, prefix, plen, src_prefix,
...@@ -1690,14 +1690,14 @@ send_marginal_ihu(struct interface *ifp) ...@@ -1690,14 +1690,14 @@ send_marginal_ihu(struct interface *ifp)
/* Standard wildcard request with prefix == NULL && src_prefix == zeroes, /* Standard wildcard request with prefix == NULL && src_prefix == zeroes,
Specific wildcard request with prefix == zeroes && src_prefix == NULL. */ Specific wildcard request with prefix == zeroes && src_prefix == NULL. */
static void static void
send_request(struct buffered *buf, send_request(struct buffered *buf, struct interface *ifp,
const unsigned char *prefix, unsigned char plen, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen) const unsigned char *src_prefix, unsigned char src_plen)
{ {
int v4, pb, spb, len; int v4, pb, spb, len;
int is_ss = !is_default(src_prefix, src_plen); int is_ss = !is_default(src_prefix, src_plen);
if(is_ss && buf->rfc6126_compatible) if(is_ss && (ifp->flags & IF_RFC6126) != 0)
return; return;
if(!prefix) { if(!prefix) {
...@@ -1763,12 +1763,12 @@ send_multicast_request(struct interface *ifp, ...@@ -1763,12 +1763,12 @@ send_multicast_request(struct interface *ifp,
struct neighbour *neigh; struct neighbour *neigh;
FOR_ALL_NEIGHBOURS(neigh) { FOR_ALL_NEIGHBOURS(neigh) {
if(neigh->ifp == ifp) { if(neigh->ifp == ifp) {
send_request(&neigh->buf, prefix, plen, send_request(&neigh->buf, ifp, prefix, plen,
src_prefix, src_plen); src_prefix, src_plen);
} }
} }
} else { } else {
send_request(&ifp->buf, prefix, plen, src_prefix, src_plen); send_request(&ifp->buf, ifp, prefix, plen, src_prefix, src_plen);
} }
} }
...@@ -1782,11 +1782,11 @@ send_unicast_request(struct neighbour *neigh, ...@@ -1782,11 +1782,11 @@ send_unicast_request(struct neighbour *neigh,
flushupdates(neigh->ifp); flushupdates(neigh->ifp);
send_request(&neigh->buf, prefix, plen, src_prefix, src_plen); send_request(&neigh->buf, neigh->ifp, prefix, plen, src_prefix, src_plen);
} }
static void static void
send_multihop_request(struct buffered *buf, send_multihop_request(struct buffered *buf, struct interface *ifp,
const unsigned char *prefix, unsigned char plen, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen, const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id, unsigned short seqno, const unsigned char *id,
...@@ -1795,7 +1795,7 @@ send_multihop_request(struct buffered *buf, ...@@ -1795,7 +1795,7 @@ send_multihop_request(struct buffered *buf,
int v4, pb, spb, len; int v4, pb, spb, len;
int is_ss = !is_default(src_prefix, src_plen); int is_ss = !is_default(src_prefix, src_plen);
if(is_ss && buf->rfc6126_compatible) if(is_ss && (ifp->flags & IF_RFC6126) != 0)
return; return;
debugf("Sending request (%d) for %s.\n", debugf("Sending request (%d) for %s.\n",
...@@ -1859,13 +1859,15 @@ send_multicast_multihop_request(struct interface *ifp, ...@@ -1859,13 +1859,15 @@ send_multicast_multihop_request(struct interface *ifp,
struct neighbour *neigh; struct neighbour *neigh;
FOR_ALL_NEIGHBOURS(neigh) { FOR_ALL_NEIGHBOURS(neigh) {
if(neigh->ifp == ifp) { if(neigh->ifp == ifp) {
send_multihop_request(&neigh->buf, prefix, plen, send_multihop_request(&neigh->buf, neigh->ifp,
prefix, plen,
src_prefix, src_plen, src_prefix, src_plen,
seqno, id, hop_count); seqno, id, hop_count);
} }
} }
} else { } else {
send_multihop_request(&ifp->buf, prefix, plen, send_multihop_request(&ifp->buf, ifp,
prefix, plen,
src_prefix, src_plen, src_prefix, src_plen,
seqno, id, hop_count); seqno, id, hop_count);
} }
...@@ -1880,7 +1882,8 @@ send_unicast_multihop_request(struct neighbour *neigh, ...@@ -1880,7 +1882,8 @@ send_unicast_multihop_request(struct neighbour *neigh,
unsigned short hop_count) unsigned short hop_count)
{ {
flushupdates(neigh->ifp); flushupdates(neigh->ifp);
send_multihop_request(&neigh->buf, prefix, plen, src_prefix, src_plen, send_multihop_request(&neigh->buf, neigh->ifp,
prefix, plen, src_prefix, src_plen,
seqno, id, hop_count); seqno, id, hop_count);
} }
...@@ -1905,7 +1908,8 @@ send_request_resend(const unsigned char *prefix, unsigned char plen, ...@@ -1905,7 +1908,8 @@ send_request_resend(const unsigned char *prefix, unsigned char plen,
struct interface *ifp; struct interface *ifp;
FOR_ALL_INTERFACES(ifp) { FOR_ALL_INTERFACES(ifp) {
if(!if_up(ifp)) continue; if(!if_up(ifp)) continue;
send_multihop_request(&ifp->buf, prefix, plen, src_prefix, src_plen, send_multihop_request(&ifp->buf, ifp,
prefix, plen, src_prefix, src_plen,
seqno, id, 127); seqno, id, 127);
} }
} }
......
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