Commit 4a4d66da authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Merge branch 'ss-tables-merge'

parents b68c481d f074d209
...@@ -10,10 +10,12 @@ CFLAGS = $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES) ...@@ -10,10 +10,12 @@ CFLAGS = $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES)
LDLIBS = -lrt LDLIBS = -lrt
SRCS = babeld.c net.c kernel.c util.c interface.c source.c neighbour.c \ SRCS = babeld.c net.c kernel.c util.c interface.c source.c neighbour.c \
route.c xroute.c message.c resend.c configuration.c local.c route.c xroute.c message.c resend.c configuration.c local.c \
disambiguation.c
OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \ OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \
route.o xroute.o message.o resend.o configuration.o local.o route.o xroute.o message.o resend.o configuration.o local.o \
disambiguation.o
babeld: $(OBJS) babeld: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS) $(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS)
......
...@@ -82,6 +82,7 @@ unsigned char protocol_group[16]; ...@@ -82,6 +82,7 @@ unsigned char protocol_group[16];
int protocol_socket = -1; int protocol_socket = -1;
int kernel_socket = -1; int kernel_socket = -1;
static int kernel_routes_changed = 0; static int kernel_routes_changed = 0;
static int kernel_rules_changed = 0;
static int kernel_link_changed = 0; static int kernel_link_changed = 0;
static int kernel_addr_changed = 0; static int kernel_addr_changed = 0;
...@@ -512,6 +513,7 @@ main(int argc, char **argv) ...@@ -512,6 +513,7 @@ main(int argc, char **argv)
fprintf(stderr, "Warning: couldn't check exported routes.\n"); fprintf(stderr, "Warning: couldn't check exported routes.\n");
kernel_routes_changed = 0; kernel_routes_changed = 0;
kernel_rules_changed = 0;
kernel_link_changed = 0; kernel_link_changed = 0;
kernel_addr_changed = 0; kernel_addr_changed = 0;
kernel_dump_time = now.tv_sec + roughly(30); kernel_dump_time = now.tv_sec + roughly(30);
...@@ -540,7 +542,7 @@ main(int argc, char **argv) ...@@ -540,7 +542,7 @@ main(int argc, char **argv)
send_hello(ifp); send_hello(ifp);
send_wildcard_retraction(ifp); send_wildcard_retraction(ifp);
send_self_update(ifp); send_self_update(ifp);
send_request(ifp, NULL, 0); send_request(ifp, NULL, 0, NULL, 0);
flushupdates(ifp); flushupdates(ifp);
flushbuf(ifp); flushbuf(ifp);
} }
...@@ -673,11 +675,12 @@ main(int argc, char **argv) ...@@ -673,11 +675,12 @@ main(int argc, char **argv)
} }
if(kernel_routes_changed || kernel_addr_changed || if(kernel_routes_changed || kernel_addr_changed ||
now.tv_sec >= kernel_dump_time) { kernel_rules_changed || now.tv_sec >= kernel_dump_time) {
rc = check_xroutes(1); rc = check_xroutes(1);
if(rc < 0) if(rc < 0)
fprintf(stderr, "Warning: couldn't check exported routes.\n"); fprintf(stderr, "Warning: couldn't check exported routes.\n");
kernel_routes_changed = kernel_addr_changed = 0; kernel_routes_changed = kernel_rules_changed =
kernel_addr_changed = 0;
if(kernel_socket >= 0) if(kernel_socket >= 0)
kernel_dump_time = now.tv_sec + roughly(300); kernel_dump_time = now.tv_sec + roughly(300);
else else
...@@ -714,7 +717,7 @@ main(int argc, char **argv) ...@@ -714,7 +717,7 @@ main(int argc, char **argv)
if(timeval_compare(&now, &ifp->hello_timeout) >= 0) if(timeval_compare(&now, &ifp->hello_timeout) >= 0)
send_hello(ifp); send_hello(ifp);
if(timeval_compare(&now, &ifp->update_timeout) >= 0) if(timeval_compare(&now, &ifp->update_timeout) >= 0)
send_update(ifp, 0, NULL, 0); send_update(ifp, 0, NULL, 0, NULL, 0);
if(timeval_compare(&now, &ifp->update_flush_timeout) >= 0) if(timeval_compare(&now, &ifp->update_flush_timeout) >= 0)
flushupdates(ifp); flushupdates(ifp);
} }
...@@ -1028,9 +1031,10 @@ dump_route(FILE *out, struct babel_route *route) ...@@ -1028,9 +1031,10 @@ dump_route(FILE *out, struct babel_route *route)
channels[0] = '\0'; channels[0] = '\0';
} }
fprintf(out, "%s metric %d (%d) refmetric %d id %s seqno %d%s age %d " fprintf(out, "%s from %s metric %d (%d) refmetric %d id %s "
"via %s neigh %s%s%s%s\n", "seqno %d%s age %d via %s neigh %s%s%s%s\n",
format_prefix(route->src->prefix, route->src->plen), format_prefix(route->src->prefix, route->src->plen),
format_prefix(route->src->src_prefix, route->src->src_plen),
route_metric(route), route_smoothed_metric(route), route->refmetric, route_metric(route), route_smoothed_metric(route), route->refmetric,
format_eui64(route->src->id), format_eui64(route->src->id),
(int)route->seqno, (int)route->seqno,
...@@ -1047,8 +1051,9 @@ dump_route(FILE *out, struct babel_route *route) ...@@ -1047,8 +1051,9 @@ dump_route(FILE *out, struct babel_route *route)
static void static void
dump_xroute(FILE *out, struct xroute *xroute) dump_xroute(FILE *out, struct xroute *xroute)
{ {
fprintf(out, "%s metric %d (exported)\n", fprintf(out, "%s from %s metric %d (exported)\n",
format_prefix(xroute->prefix, xroute->plen), format_prefix(xroute->prefix, xroute->plen),
format_prefix(xroute->src_prefix, xroute->src_plen),
xroute->metric); xroute->metric);
} }
...@@ -1138,5 +1143,7 @@ kernel_routes_callback(int changed, void *closure) ...@@ -1138,5 +1143,7 @@ kernel_routes_callback(int changed, void *closure)
kernel_addr_changed = 1; kernel_addr_changed = 1;
if(changed & CHANGE_ROUTE) if(changed & CHANGE_ROUTE)
kernel_routes_changed = 1; kernel_routes_changed = 1;
if(changed & CHANGE_RULE)
kernel_rules_changed = 1;
return 1; return 1;
} }
...@@ -80,6 +80,12 @@ THE SOFTWARE. ...@@ -80,6 +80,12 @@ THE SOFTWARE.
#endif #endif
#endif #endif
#ifdef IPV6_SUBTREES
#define has_ipv6_subtrees 1
#else
#define has_ipv6_subtrees 0
#endif
extern struct timeval now; extern struct timeval now;
extern int debug; extern int debug;
extern time_t reboot_time; extern time_t reboot_time;
......
...@@ -260,6 +260,14 @@ This specifies the name of the file to which ...@@ -260,6 +260,14 @@ This specifies the name of the file to which
.B babeld .B babeld
writes out its process id, and is equivalent to the command-line option writes out its process id, and is equivalent to the command-line option
.BR \-I . .BR \-I .
.TP
.BI first-table-number " table"
This specifies the index of the first routing table to use for
source-specific routes. The default is 10.
.TP
.BI first-rule-priority " priority"
This specifies smallest (highest) rule priority used with source-specific
routes. The default is 100.
.SS Interface configuration .SS Interface configuration
An interface is configured by a line with the following format: An interface is configured by a line with the following format:
.IP .IP
...@@ -410,6 +418,23 @@ This entry only applies to routes with a prefix length less or equal to ...@@ -410,6 +418,23 @@ This entry only applies to routes with a prefix length less or equal to
This entry only applies to routes with a prefix length greater or equal to This entry only applies to routes with a prefix length greater or equal to
.BR plen . .BR plen .
.TP .TP
.BI src-ip " prefix"
This entry only applies to routes with a source prefix in the given prefix.
.TP
.BI src-eq " plen"
This entry only applies to routes with a source prefix length equal to
.BR plen .
.TP
.BI src-le " plen"
This entry only applies to routes with a source prefix length less or
equal to
.BR plen .
.TP
.BI src-ge " plen"
This entry only applies to routes with a source prefix length greater
or equal to
.BR plen .
.TP
.BI neigh " address" .BI neigh " address"
This entry only applies to routes learned from a neighbour with This entry only applies to routes learned from a neighbour with
link-local address link-local address
...@@ -454,6 +479,10 @@ For an input or output filter, allow this route after increasing its metric by ...@@ -454,6 +479,10 @@ For an input or output filter, allow this route after increasing its metric by
.IR value . .IR value .
For a redistribute filter, redistribute this route with metric For a redistribute filter, redistribute this route with metric
.IR value . .IR value .
.TP
.BI src-prefix " prefix"
For a redistribute filter, set the source prefix of this route to
.IR prefix .
.PP .PP
If If
.I action .I action
...@@ -496,6 +525,12 @@ or, if you want to constrain the routes that you redistribute, ...@@ -496,6 +525,12 @@ or, if you want to constrain the routes that you redistribute,
\-C 'redistribute proto 11 ip ::/0 le 64 metric 256' \\ \-C 'redistribute proto 11 ip ::/0 le 64 metric 256' \\
\-C 'redistribute proto 11 ip 0.0.0.0/0 le 24 metric 256' \\ \-C 'redistribute proto 11 ip 0.0.0.0/0 le 24 metric 256' \\
wlan0 wlan0
.SS Source-sensitive routing
.PP
If your want to redistribute kernel routes as source-specific to the network,
with the 2001:DB8:0:1::/64 prefix:
.IP
redistribute src-prefix 2001:DB8:0:1::/64
.SH FILES .SH FILES
.TP .TP
.B /etc/babeld.conf .B /etc/babeld.conf
......
...@@ -283,6 +283,7 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return) ...@@ -283,6 +283,7 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return)
if(filter == NULL) if(filter == NULL)
goto error; goto error;
filter->plen_le = 128; filter->plen_le = 128;
filter->src_plen_le = 128;
while(1) { while(1) {
c = skip_whitespace(c, gnc, closure); c = skip_whitespace(c, gnc, closure);
...@@ -295,10 +296,25 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return) ...@@ -295,10 +296,25 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return)
goto error; goto error;
if(strcmp(token, "ip") == 0) { if(strcmp(token, "ip") == 0) {
c = getnet(c, &filter->prefix, &filter->plen, &filter->af, int af;
c = getnet(c, &filter->prefix, &filter->plen, &af,
gnc, closure); gnc, closure);
if(c < -1) if(c < -1)
goto error; goto error;
if(filter->af == AF_UNSPEC)
filter->af = af;
else if(filter->af != af)
goto error;
} else if(strcmp(token, "src-ip") == 0) {
int af;
c = getnet(c, &filter->src_prefix, &filter->src_plen, &af,
gnc, closure);
if(c < -1)
goto error;
if(filter->af == AF_UNSPEC)
filter->af = af;
else if(filter->af != af)
goto error;
} else if(strcmp(token, "eq") == 0) { } else if(strcmp(token, "eq") == 0) {
int p; int p;
c = getint(c, &p, gnc, closure); c = getint(c, &p, gnc, closure);
...@@ -318,6 +334,25 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return) ...@@ -318,6 +334,25 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return)
if(c < -1) if(c < -1)
goto error; goto error;
filter->plen_ge = MAX(filter->plen_ge, p); filter->plen_ge = MAX(filter->plen_ge, p);
} else if(strcmp(token, "src-eq") == 0) {
int p;
c = getint(c, &p, gnc, closure);
if(c < -1)
goto error;
filter->src_plen_ge = MAX(filter->src_plen_ge, p);
filter->src_plen_le = MIN(filter->src_plen_le, p);
} else if(strcmp(token, "src-le") == 0) {
int p;
c = getint(c, &p, gnc, closure);
if(c < -1)
goto error;
filter->src_plen_le = MIN(filter->src_plen_le, p);
} else if(strcmp(token, "src-ge") == 0) {
int p;
c = getint(c, &p, gnc, closure);
if(c < -1)
goto error;
filter->src_plen_ge = MAX(filter->src_plen_ge, p);
} else if(strcmp(token, "neigh") == 0) { } else if(strcmp(token, "neigh") == 0) {
unsigned char *neigh = NULL; unsigned char *neigh = NULL;
c = getip(c, &neigh, NULL, gnc, closure); c = getip(c, &neigh, NULL, gnc, closure);
...@@ -346,23 +381,36 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return) ...@@ -346,23 +381,36 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return)
filter->ifname = interface; filter->ifname = interface;
filter->ifindex = if_nametoindex(interface); filter->ifindex = if_nametoindex(interface);
} else if(strcmp(token, "allow") == 0) { } else if(strcmp(token, "allow") == 0) {
filter->result = 0; filter->action.add_metric = 0;
} else if(strcmp(token, "deny") == 0) { } else if(strcmp(token, "deny") == 0) {
filter->result = INFINITY; filter->action.add_metric = INFINITY;
} else if(strcmp(token, "metric") == 0) { } else if(strcmp(token, "metric") == 0) {
int metric; int metric;
c = getint(c, &metric, gnc, closure); c = getint(c, &metric, gnc, closure);
if(c < -1) goto error; if(c < -1) goto error;
if(metric <= 0 || metric > INFINITY) if(metric <= 0 || metric > INFINITY)
goto error; goto error;
filter->result = metric; filter->action.add_metric = metric;
} else if(strcmp(token, "src-prefix") == 0) {
int af;
c = getnet(c, &filter->action.src_prefix, &filter->action.src_plen,
&af, gnc, closure);
if(c < -1)
goto error;
if(filter->af == AF_UNSPEC)
filter->af = af;
else if(filter->af != af)
goto error;
if(af == AF_INET && filter->action.src_plen == 96)
memset(&filter->action.src_prefix, 0, 16);
} else { } else {
goto error; goto error;
} }
free(token); free(token);
} }
if(filter->af == 0) { if(filter->af == 0) {
if(filter->plen_le < 128 || filter->plen_ge > 0) if(filter->plen_le < 128 || filter->plen_ge > 0 ||
filter->src_plen_le < 128 || filter->src_plen_ge > 0)
filter->af = AF_INET6; filter->af = AF_INET6;
} else if(filter->af == AF_INET) { } else if(filter->af == AF_INET) {
filter->plen_le += 96; filter->plen_le += 96;
...@@ -716,6 +764,18 @@ parse_option(int c, gnc_t gnc, void *closure, char *token) ...@@ -716,6 +764,18 @@ parse_option(int c, gnc_t gnc, void *closure, char *token)
if(c < -1 || h < 0) if(c < -1 || h < 0)
goto error; goto error;
change_smoothing_half_life(h); change_smoothing_half_life(h);
} else if(strcmp(token, "first-table-number") == 0) {
int n;
c = getint(c, &n, gnc, closure);
if(c < -1 || n <= 0 || n + SRC_TABLE_NUM >= 254)
goto error;
src_table_idx = n;
} else if(strcmp(token, "first-rule-priority") == 0) {
int n;
c = getint(c, &n, gnc, closure);
if(c < -1 || n <= 0 || n + SRC_TABLE_NUM >= 32765)
goto error;
src_table_prio = n;
} else { } else {
goto error; goto error;
} }
...@@ -876,6 +936,7 @@ renumber_filters() ...@@ -876,6 +936,7 @@ renumber_filters()
static int static int
filter_match(struct filter *f, const unsigned char *id, filter_match(struct filter *f, const unsigned char *id,
const unsigned char *prefix, unsigned short plen, const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
const unsigned char *neigh, unsigned int ifindex, int proto) const unsigned char *neigh, unsigned int ifindex, int proto)
{ {
if(f->af) { if(f->af) {
...@@ -893,6 +954,11 @@ filter_match(struct filter *f, const unsigned char *id, ...@@ -893,6 +954,11 @@ filter_match(struct filter *f, const unsigned char *id,
if(!prefix || plen < f->plen || !in_prefix(prefix, f->prefix, f->plen)) if(!prefix || plen < f->plen || !in_prefix(prefix, f->prefix, f->plen))
return 0; return 0;
} }
if(f->src_prefix) {
if(!src_prefix || src_plen < f->src_plen ||
!in_prefix(src_prefix, f->src_prefix, f->src_plen))
return 0;
}
if(f->plen_ge > 0 || f->plen_le < 128) { if(f->plen_ge > 0 || f->plen_le < 128) {
if(!prefix) if(!prefix)
return 0; return 0;
...@@ -901,6 +967,14 @@ filter_match(struct filter *f, const unsigned char *id, ...@@ -901,6 +967,14 @@ filter_match(struct filter *f, const unsigned char *id,
if(plen < f->plen_ge) if(plen < f->plen_ge)
return 0; return 0;
} }
if(f->src_plen_ge > 0 || f->src_plen_le < 128) {
if(!src_prefix)
return 0;
if(src_plen > f->src_plen_le)
return 0;
if(src_plen < f->src_plen_ge)
return 0;
}
if(f->neigh) { if(f->neigh) {
if(!neigh || memcmp(f->neigh, neigh, 16) != 0) if(!neigh || memcmp(f->neigh, neigh, 16) != 0)
return 0; return 0;
...@@ -928,34 +1002,49 @@ filter_match(struct filter *f, const unsigned char *id, ...@@ -928,34 +1002,49 @@ filter_match(struct filter *f, const unsigned char *id,
static int static int
do_filter(struct filter *f, const unsigned char *id, do_filter(struct filter *f, const unsigned char *id,
const unsigned char *prefix, unsigned short plen, const unsigned char *prefix, unsigned short plen,
const unsigned char *neigh, unsigned int ifindex, int proto) const unsigned char *src_prefix, unsigned short src_plen,
const unsigned char *neigh, unsigned int ifindex, int proto,
struct filter_result *result)
{ {
if(result)
memset(result, 0, sizeof(struct filter_result));
while(f) { while(f) {
if(filter_match(f, id, prefix, plen, neigh, ifindex, proto)) if(filter_match(f, id, prefix, plen, src_prefix, src_plen,
return f->result; neigh, ifindex, proto)) {
if(result)
memcpy(result, &f->action, sizeof(struct filter_result));
return f->action.add_metric;
}
f = f->next; f = f->next;
} }
return -1; return -1;
} }
int int
input_filter(const unsigned char *id, input_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen, const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
const unsigned char *neigh, unsigned int ifindex) const unsigned char *neigh, unsigned int ifindex)
{ {
int res; int res;
res = do_filter(input_filters, id, prefix, plen, neigh, ifindex, 0); res = do_filter(input_filters, id, prefix, plen,
src_prefix, src_plen, neigh, ifindex, 0, NULL);
if(res < 0) if(res < 0)
res = 0; res = 0;
return res; return res;
} }
int int
output_filter(const unsigned char *id, const unsigned char *prefix, output_filter(const unsigned char *id,
unsigned short plen, unsigned int ifindex) const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
unsigned int ifindex)
{ {
int res; int res;
res = do_filter(output_filters, id, prefix, plen, NULL, ifindex, 0); res = do_filter(output_filters, id, prefix, plen,
src_prefix, src_plen, NULL, ifindex, 0, NULL);
if(res < 0) if(res < 0)
res = 0; res = 0;
return res; return res;
...@@ -963,11 +1052,13 @@ output_filter(const unsigned char *id, const unsigned char *prefix, ...@@ -963,11 +1052,13 @@ output_filter(const unsigned char *id, const unsigned char *prefix,
int int
redistribute_filter(const unsigned char *prefix, unsigned short plen, redistribute_filter(const unsigned char *prefix, unsigned short plen,
unsigned int ifindex, int proto) const unsigned char *src_prefix, unsigned short src_plen,
unsigned int ifindex, int proto,
struct filter_result *result)
{ {
int res; int res;
res = do_filter(redistribute_filters, NULL, prefix, plen, NULL, res = do_filter(redistribute_filters, NULL, prefix, plen,
ifindex, proto); src_prefix, src_plen, NULL, ifindex, proto, result);
if(res < 0) if(res < 0)
res = INFINITY; res = INFINITY;
return res; return res;
...@@ -982,6 +1073,7 @@ finalise_config() ...@@ -982,6 +1073,7 @@ finalise_config()
filter->proto = RTPROT_BABEL_LOCAL; filter->proto = RTPROT_BABEL_LOCAL;
filter->plen_le = 128; filter->plen_le = 128;
filter->src_plen_le = 128;
add_filter(filter, &redistribute_filters); add_filter(filter, &redistribute_filters);
while(interface_confs) { while(interface_confs) {
......
...@@ -20,6 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ...@@ -20,6 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
struct filter_result {
unsigned int add_metric; /* allow = 0, deny = INF, metric = <0..INF> */
unsigned char *src_prefix;
unsigned char src_plen;
};
struct filter { struct filter {
int af; int af;
char *ifname; char *ifname;
...@@ -28,9 +34,12 @@ struct filter { ...@@ -28,9 +34,12 @@ struct filter {
unsigned char *prefix; unsigned char *prefix;
unsigned char plen; unsigned char plen;
unsigned char plen_ge, plen_le; unsigned char plen_ge, plen_le;
unsigned char *src_prefix;
unsigned char src_plen;
unsigned char src_plen_ge, src_plen_le;
unsigned char *neigh; unsigned char *neigh;
int proto; /* May be negative */ int proto; /* May be negative */
unsigned int result; struct filter_result action;
struct filter *next; struct filter *next;
}; };
...@@ -42,9 +51,14 @@ void renumber_filters(void); ...@@ -42,9 +51,14 @@ void renumber_filters(void);
int input_filter(const unsigned char *id, int input_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen, const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
const unsigned char *neigh, unsigned int ifindex); const unsigned char *neigh, unsigned int ifindex);
int output_filter(const unsigned char *id, const unsigned char *prefix, int output_filter(const unsigned char *id,
unsigned short plen, unsigned int ifindex); const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
unsigned int ifindex);
int redistribute_filter(const unsigned char *prefix, unsigned short plen, int redistribute_filter(const unsigned char *prefix, unsigned short plen,
unsigned int ifindex, int proto); const unsigned char *src_prefix, unsigned short src_plen,
unsigned int ifindex, int proto,
struct filter_result *result);
int finalise_config(void); int finalise_config(void);
This diff is collapsed.
/*
Copyright (c) 2014 by Matthieu Boutier and Juliusz Chroboczek.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
int kinstall_route(struct babel_route *route);
int kuninstall_route(struct babel_route *route);
int kswitch_routes(struct babel_route *old, struct babel_route *new);
int kchange_route_metric(struct babel_route *route,
unsigned refmetric, unsigned cost, unsigned add);
...@@ -177,6 +177,40 @@ check_interface_channel(struct interface *ifp) ...@@ -177,6 +177,40 @@ check_interface_channel(struct interface *ifp)
return 0; return 0;
} }
static int
check_link_local_addresses(struct interface *ifp)
{
struct kernel_route ll[32];
int rc, i;
if(ifp->ll)
free(ifp->ll);
ifp->numll = 0;
ifp->ll = NULL;
rc = kernel_addresses(ifp->name, ifp->ifindex, 1, ll, 32);
if(rc < 0) {
perror("kernel_addresses(link local)");
return -1;
} else if(rc == 0) {
fprintf(stderr, "Interface %s has no link-local address.\n",
ifp->name);
/* Most probably DAD hasn't finished yet. Reschedule us
real soon. */
schedule_interfaces_check(2000, 0);
return -1;
} else {
ifp->ll = malloc(16 * rc);
if(ifp->ll == NULL) {
perror("malloc(ll)");
} else {
for(i = 0; i < rc; i++)
memcpy(ifp->ll[i], ll[i].prefix, 16);
ifp->numll = rc;
}
}
return 0;
}
int int
interface_up(struct interface *ifp, int up) interface_up(struct interface *ifp, int up)
{ {
...@@ -192,7 +226,6 @@ interface_up(struct interface *ifp, int up) ...@@ -192,7 +226,6 @@ interface_up(struct interface *ifp, int up)
ifp->flags &= ~IF_UP; ifp->flags &= ~IF_UP;
if(up) { if(up) {
struct kernel_route ll[32];
if(ifp->ifindex <= 0) { if(ifp->ifindex <= 0) {
fprintf(stderr, fprintf(stderr,
"Upping unknown interface %s.\n", ifp->name); "Upping unknown interface %s.\n", ifp->name);
...@@ -329,32 +362,10 @@ interface_up(struct interface *ifp, int up) ...@@ -329,32 +362,10 @@ interface_up(struct interface *ifp, int up)
ifp->max_rtt_penalty > 0)) ifp->max_rtt_penalty > 0))
ifp->flags |= IF_TIMESTAMPS; ifp->flags |= IF_TIMESTAMPS;
if(ifp->ll) rc = check_link_local_addresses(ifp);
free(ifp->ll);
ifp->numll = 0;
ifp->ll = NULL;
rc = kernel_addresses(ifp->name, ifp->ifindex, 1, ll, 32);
if(rc < 0) { if(rc < 0) {
perror("kernel_addresses(link local)");
goto fail; goto fail;
} else if(rc == 0) {
fprintf(stderr, "Interface %s has no link-local address.\n",
ifp->name);
/* Most probably DAD hasn't finished yet. Reschedule us
real soon. */
goto fail_retry;
} else {
ifp->ll = malloc(16 * rc);
if(ifp->ll == NULL) {
perror("malloc(ll)");
} else {
int i;
for(i = 0; i < rc; i++)
memcpy(ifp->ll[i], ll[i].prefix, 16);
ifp->numll = rc;
} }
}
memset(&mreq, 0, sizeof(mreq)); memset(&mreq, 0, sizeof(mreq));
memcpy(&mreq.ipv6mr_multiaddr, protocol_group, 16); memcpy(&mreq.ipv6mr_multiaddr, protocol_group, 16);
mreq.ipv6mr_interface = ifp->ifindex; mreq.ipv6mr_interface = ifp->ifindex;
...@@ -380,8 +391,8 @@ interface_up(struct interface *ifp, int up) ...@@ -380,8 +391,8 @@ interface_up(struct interface *ifp, int up)
set_timeout(&ifp->update_timeout, ifp->update_interval); set_timeout(&ifp->update_timeout, ifp->update_interval);
send_hello(ifp); send_hello(ifp);
if(rc > 0) if(rc > 0)
send_update(ifp, 0, NULL, 0); send_update(ifp, 0, NULL, 0, NULL, 0);
send_request(ifp, NULL, 0); send_request(ifp, NULL, 0, NULL, 0);
} else { } else {
flush_interface_routes(ifp, 0); flush_interface_routes(ifp, 0);
ifp->buffered = 0; ifp->buffered = 0;
...@@ -411,8 +422,6 @@ interface_up(struct interface *ifp, int up) ...@@ -411,8 +422,6 @@ interface_up(struct interface *ifp, int up)
return 1; return 1;
fail_retry:
schedule_interfaces_check(2000, 0);
fail: fail:
assert(up); assert(up);
interface_up(ifp, 0); interface_up(ifp, 0);
...@@ -462,12 +471,13 @@ check_interfaces(void) ...@@ -462,12 +471,13 @@ check_interfaces(void)
if(if_up(ifp)) { if(if_up(ifp)) {
/* Bother, said Pooh. We should probably check for a change /* Bother, said Pooh. We should probably check for a change
in link-local and IPv4 addresses at this point. */ in IPv4 addresses at this point. */
check_link_local_addresses(ifp);
check_interface_channel(ifp); check_interface_channel(ifp);
rc = check_interface_ipv4(ifp); rc = check_interface_ipv4(ifp);
if(rc > 0) { if(rc > 0) {
send_request(ifp, NULL, 0); send_request(ifp, NULL, 0, NULL, 0);
send_update(ifp, 0, NULL, 0); send_update(ifp, 0, NULL, 0, NULL, 0);
} }
} }
} }
......
...@@ -23,8 +23,10 @@ THE SOFTWARE. ...@@ -23,8 +23,10 @@ THE SOFTWARE.
struct buffered_update { struct buffered_update {
unsigned char id[8]; unsigned char id[8];
unsigned char prefix[16]; unsigned char prefix[16];
unsigned char src_prefix[16];
unsigned char plen; unsigned char plen;
unsigned char pad[3]; unsigned char src_plen; /* 0 <=> no src prefix */
unsigned char pad[2];
}; };
struct interface_conf { struct interface_conf {
...@@ -94,6 +96,7 @@ struct interface { ...@@ -94,6 +96,7 @@ struct interface {
time_t bucket_time; time_t bucket_time;
unsigned int bucket; unsigned int bucket;
time_t last_update_time; time_t last_update_time;
time_t last_specific_update_time;
unsigned short hello_seqno; unsigned short hello_seqno;
unsigned hello_interval; unsigned hello_interval;
unsigned update_interval; unsigned update_interval;
......
...@@ -32,6 +32,9 @@ THE SOFTWARE. ...@@ -32,6 +32,9 @@ THE SOFTWARE.
#include "kernel_socket.c" #include "kernel_socket.c"
#endif #endif
int src_table_idx = 10;
int src_table_prio = 100;
/* Like gettimeofday, but returns monotonic time. If POSIX clocks are not /* Like gettimeofday, but returns monotonic time. If POSIX clocks are not
available, falls back to gettimeofday but enforces monotonicity. */ available, falls back to gettimeofday but enforces monotonicity. */
int int
......
...@@ -28,6 +28,8 @@ THE SOFTWARE. ...@@ -28,6 +28,8 @@ THE SOFTWARE.
struct kernel_route { struct kernel_route {
unsigned char prefix[16]; unsigned char prefix[16];
int plen; int plen;
unsigned char src_prefix[16];
int src_plen; /* no source prefix <=> src_plen == 0 */
int metric; int metric;
unsigned int ifindex; unsigned int ifindex;
int proto; int proto;
...@@ -41,6 +43,7 @@ struct kernel_route { ...@@ -41,6 +43,7 @@ struct kernel_route {
#define CHANGE_LINK (1 << 0) #define CHANGE_LINK (1 << 0)
#define CHANGE_ROUTE (1 << 1) #define CHANGE_ROUTE (1 << 1)
#define CHANGE_ADDR (1 << 2) #define CHANGE_ADDR (1 << 2)
#define CHANGE_RULE (1 << 3)
#ifndef MAX_IMPORT_TABLES #ifndef MAX_IMPORT_TABLES
#define MAX_IMPORT_TABLES 10 #define MAX_IMPORT_TABLES 10
...@@ -49,6 +52,9 @@ struct kernel_route { ...@@ -49,6 +52,9 @@ struct kernel_route {
extern int export_table, import_tables[MAX_IMPORT_TABLES], import_table_count; extern int export_table, import_tables[MAX_IMPORT_TABLES], import_table_count;
int add_import_table(int table); int add_import_table(int table);
#define SRC_TABLE_NUM 10
extern int src_table_idx; /* number of the first table */
extern int src_table_prio; /* first prio range */
int kernel_setup(int setup); int kernel_setup(int setup);
int kernel_setup_socket(int setup); int kernel_setup_socket(int setup);
...@@ -60,6 +66,7 @@ int kernel_interface_mtu(const char *ifname, int ifindex); ...@@ -60,6 +66,7 @@ int kernel_interface_mtu(const char *ifname, int ifindex);
int kernel_interface_wireless(const char *ifname, int ifindex); int kernel_interface_wireless(const char *ifname, int ifindex);
int kernel_interface_channel(const char *ifname, int ifindex); int kernel_interface_channel(const char *ifname, int ifindex);
int kernel_route(int operation, const unsigned char *dest, unsigned short plen, int kernel_route(int operation, const unsigned char *dest, unsigned short plen,
const unsigned char *src, unsigned short src_plen,
const unsigned char *gate, int ifindex, unsigned int metric, const unsigned char *gate, int ifindex, unsigned int metric,
const unsigned char *newgate, int newifindex, const unsigned char *newgate, int newifindex,
unsigned int newmetric); unsigned int newmetric);
......
This diff is collapsed.
...@@ -29,8 +29,6 @@ THE SOFTWARE. ...@@ -29,8 +29,6 @@ THE SOFTWARE.
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#include <strings.h> #include <strings.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/icmp6.h> #include <netinet/icmp6.h>
...@@ -53,7 +51,6 @@ THE SOFTWARE. ...@@ -53,7 +51,6 @@ THE SOFTWARE.
static int get_sdl(struct sockaddr_dl *sdl, char *ifname); static int get_sdl(struct sockaddr_dl *sdl, char *ifname);
static const unsigned char v4prefix[16] = static const unsigned char v4prefix[16] =
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 0 }; {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 0 };
...@@ -387,6 +384,7 @@ kernel_interface_channel(const char *ifname, int ifindex) ...@@ -387,6 +384,7 @@ kernel_interface_channel(const char *ifname, int ifindex)
int int
kernel_route(int operation, const unsigned char *dest, unsigned short plen, kernel_route(int operation, const unsigned char *dest, unsigned short plen,
const unsigned char *src, unsigned short src_plen,
const unsigned char *gate, int ifindex, unsigned int metric, const unsigned char *gate, int ifindex, unsigned int metric,
const unsigned char *newgate, int newifindex, const unsigned char *newgate, int newifindex,
unsigned int newmetric) unsigned int newmetric)
...@@ -403,6 +401,12 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen, ...@@ -403,6 +401,12 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x01 }}}; 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x01 }}};
/* Source-specific routes are not implemented yet for BSD. */
if(src_plen > 0) {
errno = ENOSYS;
return -1;
}
/* Check that the protocol family is consistent. */ /* Check that the protocol family is consistent. */
if(plen >= 96 && v4mapped(dest)) { if(plen >= 96 && v4mapped(dest)) {
if(!v4mapped(gate)) { if(!v4mapped(gate)) {
...@@ -427,9 +431,11 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen, ...@@ -427,9 +431,11 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
/* Avoid atomic route changes that is buggy on OS X. */ /* Avoid atomic route changes that is buggy on OS X. */
kernel_route(ROUTE_FLUSH, dest, plen, kernel_route(ROUTE_FLUSH, dest, plen,
src, src_plen,
gate, ifindex, metric, gate, ifindex, metric,
NULL, 0, 0); NULL, 0, 0);
return kernel_route(ROUTE_ADD, dest, plen, return kernel_route(ROUTE_ADD, dest, plen,
src, src_plen,
newgate, newifindex, newmetric, newgate, newifindex, newmetric,
NULL, 0, 0); NULL, 0, 0);
......
...@@ -185,12 +185,14 @@ local_notify_xroute_1(int s, struct xroute *xroute, int kind) ...@@ -185,12 +185,14 @@ local_notify_xroute_1(int s, struct xroute *xroute, int kind)
{ {
char buf[512]; char buf[512];
int rc; int rc;
const char *dst_prefix = format_prefix(xroute->prefix,
xroute->plen);
const char *src_prefix = format_prefix(xroute->src_prefix,
xroute->src_plen);
rc = snprintf(buf, 512, "%s xroute %s prefix %s metric %d\n", rc = snprintf(buf, 512, "%s xroute %s-%s prefix %s from %s metric %d\n",
local_kind(kind), local_kind(kind), dst_prefix, src_prefix,
format_prefix(xroute->prefix, xroute->plen), dst_prefix, src_prefix, xroute->metric);
format_prefix(xroute->prefix, xroute->plen),
xroute->metric);
if(rc < 0 || rc >= 512) if(rc < 0 || rc >= 512)
goto fail; goto fail;
...@@ -218,14 +220,17 @@ local_notify_route_1(int s, struct babel_route *route, int kind) ...@@ -218,14 +220,17 @@ local_notify_route_1(int s, struct babel_route *route, int kind)
{ {
char buf[512]; char buf[512];
int rc; int rc;
const char *dst_prefix = format_prefix(route->src->prefix,
route->src->plen);
const char *src_prefix = format_prefix(route->src->src_prefix,
route->src->src_plen);
rc = snprintf(buf, 512, rc = snprintf(buf, 512,
"%s route %s-%lx prefix %s installed %s " "%s route %s-%lx-%s prefix %s from %s installed %s "
"id %s metric %d refmetric %d via %s if %s\n", "id %s metric %d refmetric %d via %s if %s\n",
local_kind(kind), local_kind(kind),
format_prefix(route->src->prefix, route->src->plen), dst_prefix, (unsigned long)route->neigh, src_prefix,
(unsigned long)route->neigh, dst_prefix, src_prefix,
format_prefix(route->src->prefix, route->src->plen),
route->installed ? "yes" : "no", route->installed ? "yes" : "no",
format_eui64(route->src->id), format_eui64(route->src->id),
route_metric(route), route->refmetric, route_metric(route), route->refmetric,
......
This diff is collapsed.
...@@ -39,6 +39,10 @@ THE SOFTWARE. ...@@ -39,6 +39,10 @@ THE SOFTWARE.
#define MESSAGE_UPDATE 8 #define MESSAGE_UPDATE 8
#define MESSAGE_REQUEST 9 #define MESSAGE_REQUEST 9
#define MESSAGE_MH_REQUEST 10 #define MESSAGE_MH_REQUEST 10
/* 11 and 12 are for authentication */
#define MESSAGE_UPDATE_SRC_SPECIFIC 13
#define MESSAGE_REQUEST_SRC_SPECIFIC 14
#define MESSAGE_MH_REQUEST_SRC_SPECIFIC 15
/* Protocol extension through sub-TLVs. */ /* Protocol extension through sub-TLVs. */
#define SUBTLV_PAD1 0 #define SUBTLV_PAD1 0
...@@ -67,30 +71,44 @@ void send_hello_noupdate(struct interface *ifp, unsigned interval); ...@@ -67,30 +71,44 @@ void send_hello_noupdate(struct interface *ifp, unsigned interval);
void send_hello(struct interface *ifp); void send_hello(struct interface *ifp);
void flush_unicast(int dofree); void flush_unicast(int dofree);
void send_update(struct interface *ifp, int urgent, void send_update(struct interface *ifp, int urgent,
const unsigned char *prefix, unsigned char plen); const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen);
void send_update_resend(struct interface *ifp, void send_update_resend(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);
void send_wildcard_retraction(struct interface *ifp); void send_wildcard_retraction(struct interface *ifp);
void update_myseqno(void); void update_myseqno(void);
void send_self_update(struct interface *ifp); void send_self_update(struct interface *ifp);
void send_ihu(struct neighbour *neigh, struct interface *ifp); void send_ihu(struct neighbour *neigh, struct interface *ifp);
void send_marginal_ihu(struct interface *ifp); void send_marginal_ihu(struct interface *ifp);
void send_request(struct interface *ifp, void send_request(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);
void send_unicast_request(struct neighbour *neigh, void send_unicast_request(struct neighbour *neigh,
const unsigned char *prefix, unsigned char plen); const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix,
unsigned char src_plen);
void send_multihop_request(struct interface *ifp, void send_multihop_request(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,
unsigned short seqno, const unsigned char *id, unsigned short seqno, const unsigned char *id,
unsigned short hop_count); unsigned short hop_count);
void void
send_unicast_multihop_request(struct neighbour *neigh, send_unicast_multihop_request(struct neighbour *neigh,
const unsigned char *prefix, unsigned char plen, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix,
unsigned char src_plen,
unsigned short seqno, const unsigned char *id, unsigned short seqno, const unsigned char *id,
unsigned short hop_count); unsigned short hop_count);
void send_request_resend(struct neighbour *neigh, void send_request_resend(struct neighbour *neigh,
const unsigned char *prefix, unsigned char plen, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix,
unsigned char src_plen,
unsigned short seqno, unsigned char *id); unsigned short seqno, unsigned char *id);
void handle_request(struct neighbour *neigh, const unsigned char *prefix, void handle_request(struct neighbour *neigh, const unsigned char *prefix,
unsigned char plen, unsigned char hop_count, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned char hop_count,
unsigned short seqno, const unsigned char *id); unsigned short seqno, const unsigned char *id);
...@@ -193,7 +193,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) ...@@ -193,7 +193,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
if((neigh->reach & 0xFC00) == 0xC000) { if((neigh->reach & 0xFC00) == 0xC000) {
/* This is a newish neighbour, let's request a full route dump. /* This is a newish neighbour, let's request a full route dump.
We ought to avoid this when the network is dense */ We ought to avoid this when the network is dense */
send_unicast_request(neigh, NULL, 0); send_unicast_request(neigh, NULL, 0, NULL, 0);
send_ihu(neigh, NULL); send_ihu(neigh, NULL);
} }
return rc; return rc;
......
...@@ -38,10 +38,13 @@ struct resend *to_resend = NULL; ...@@ -38,10 +38,13 @@ struct resend *to_resend = NULL;
static int static int
resend_match(struct resend *resend, resend_match(struct resend *resend,
int kind, const unsigned char *prefix, unsigned char plen) int kind, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen)
{ {
return (resend->kind == kind && return (resend->kind == kind &&
resend->plen == plen && memcmp(resend->prefix, prefix, 16) == 0); resend->plen == plen && memcmp(resend->prefix, prefix, 16) == 0 &&
resend->src_plen == src_plen &&
memcmp(resend->src_prefix, src_prefix, 16) == 0);
} }
/* This is called by neigh.c when a neighbour is flushed */ /* This is called by neigh.c when a neighbour is flushed */
...@@ -54,6 +57,7 @@ flush_resends(struct neighbour *neigh) ...@@ -54,6 +57,7 @@ flush_resends(struct neighbour *neigh)
static struct resend * static struct resend *
find_resend(int kind, const unsigned char *prefix, unsigned char plen, find_resend(int kind, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
struct resend **previous_return) struct resend **previous_return)
{ {
struct resend *current, *previous; struct resend *current, *previous;
...@@ -61,7 +65,7 @@ find_resend(int kind, const unsigned char *prefix, unsigned char plen, ...@@ -61,7 +65,7 @@ find_resend(int kind, const unsigned char *prefix, unsigned char plen,
previous = NULL; previous = NULL;
current = to_resend; current = to_resend;
while(current) { while(current) {
if(resend_match(current, kind, prefix, plen)) { if(resend_match(current, kind, prefix, plen, src_prefix, src_plen)) {
if(previous_return) if(previous_return)
*previous_return = previous; *previous_return = previous;
return current; return current;
...@@ -75,13 +79,16 @@ find_resend(int kind, const unsigned char *prefix, unsigned char plen, ...@@ -75,13 +79,16 @@ find_resend(int kind, const unsigned char *prefix, unsigned char plen,
struct resend * struct resend *
find_request(const unsigned char *prefix, unsigned char plen, find_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
struct resend **previous_return) struct resend **previous_return)
{ {
return find_resend(RESEND_REQUEST, prefix, plen, previous_return); return find_resend(RESEND_REQUEST, prefix, plen, src_prefix, src_plen,
previous_return);
} }
int int
record_resend(int kind, const unsigned char *prefix, unsigned char plen, record_resend(int kind, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id, unsigned short seqno, const unsigned char *id,
struct interface *ifp, int delay) struct interface *ifp, int delay)
{ {
...@@ -89,15 +96,18 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen, ...@@ -89,15 +96,18 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
unsigned int ifindex = ifp ? ifp->ifindex : 0; unsigned int ifindex = ifp ? ifp->ifindex : 0;
if((kind == RESEND_REQUEST && if((kind == RESEND_REQUEST &&
input_filter(NULL, prefix, plen, NULL, ifindex) >= INFINITY) || input_filter(NULL, prefix, plen, src_prefix, src_plen, NULL,
ifindex) >=
INFINITY) ||
(kind == RESEND_UPDATE && (kind == RESEND_UPDATE &&
output_filter(NULL, prefix, plen, ifindex) >= INFINITY)) output_filter(NULL, prefix, plen, src_prefix, src_plen, ifindex) >=
INFINITY))
return 0; return 0;
if(delay >= 0xFFFF) if(delay >= 0xFFFF)
delay = 0xFFFF; delay = 0xFFFF;
resend = find_resend(kind, prefix, plen, NULL); resend = find_resend(kind, prefix, plen, src_prefix, src_plen, NULL);
if(resend) { if(resend) {
if(resend->delay && delay) if(resend->delay && delay)
resend->delay = MIN(resend->delay, delay); resend->delay = MIN(resend->delay, delay);
...@@ -125,6 +135,8 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen, ...@@ -125,6 +135,8 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
resend->delay = delay; resend->delay = delay;
memcpy(resend->prefix, prefix, 16); memcpy(resend->prefix, prefix, 16);
resend->plen = plen; resend->plen = plen;
memcpy(resend->src_prefix, src_prefix, 16);
resend->src_plen = src_plen;
resend->seqno = seqno; resend->seqno = seqno;
if(id) if(id)
memcpy(resend->id, id, 8); memcpy(resend->id, id, 8);
...@@ -157,11 +169,12 @@ resend_expired(struct resend *resend) ...@@ -157,11 +169,12 @@ resend_expired(struct resend *resend)
int int
unsatisfied_request(const unsigned char *prefix, unsigned char plen, unsatisfied_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id) unsigned short seqno, const unsigned char *id)
{ {
struct resend *request; struct resend *request;
request = find_request(prefix, plen, NULL); request = find_request(prefix, plen, src_prefix, src_plen, NULL);
if(request == NULL || resend_expired(request)) if(request == NULL || resend_expired(request))
return 0; return 0;
...@@ -176,11 +189,12 @@ unsatisfied_request(const unsigned char *prefix, unsigned char plen, ...@@ -176,11 +189,12 @@ unsatisfied_request(const unsigned char *prefix, unsigned char plen,
int int
request_redundant(struct interface *ifp, request_redundant(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,
unsigned short seqno, const unsigned char *id) unsigned short seqno, const unsigned char *id)
{ {
struct resend *request; struct resend *request;
request = find_request(prefix, plen, NULL); request = find_request(prefix, plen, src_prefix, src_plen, NULL);
if(request == NULL || resend_expired(request)) if(request == NULL || resend_expired(request))
return 0; return 0;
...@@ -205,12 +219,13 @@ request_redundant(struct interface *ifp, ...@@ -205,12 +219,13 @@ request_redundant(struct interface *ifp,
int int
satisfy_request(const unsigned char *prefix, unsigned char plen, satisfy_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id, unsigned short seqno, const unsigned char *id,
struct interface *ifp) struct interface *ifp)
{ {
struct resend *request, *previous; struct resend *request, *previous;
request = find_request(prefix, plen, &previous); request = find_request(prefix, plen, src_prefix, src_plen, &previous);
if(request == NULL) if(request == NULL)
return 0; return 0;
...@@ -293,11 +308,13 @@ do_resend() ...@@ -293,11 +308,13 @@ do_resend()
case RESEND_REQUEST: case RESEND_REQUEST:
send_multihop_request(resend->ifp, send_multihop_request(resend->ifp,
resend->prefix, resend->plen, resend->prefix, resend->plen,
resend->src_prefix, resend->src_plen,
resend->seqno, resend->id, 127); resend->seqno, resend->id, 127);
break; break;
case RESEND_UPDATE: case RESEND_UPDATE:
send_update(resend->ifp, 1, send_update(resend->ifp, 1,
resend->prefix, resend->plen); resend->prefix, resend->plen,
resend->src_prefix, resend->src_plen);
break; break;
default: abort(); default: abort();
} }
......
...@@ -33,6 +33,8 @@ struct resend { ...@@ -33,6 +33,8 @@ struct resend {
struct timeval time; struct timeval time;
unsigned char prefix[16]; unsigned char prefix[16];
unsigned char plen; unsigned char plen;
unsigned char src_prefix[16];
unsigned char src_plen;
unsigned short seqno; unsigned short seqno;
unsigned char id[8]; unsigned char id[8];
struct interface *ifp; struct interface *ifp;
...@@ -42,17 +44,22 @@ struct resend { ...@@ -42,17 +44,22 @@ struct resend {
extern struct timeval resend_time; extern struct timeval resend_time;
struct resend *find_request(const unsigned char *prefix, unsigned char plen, struct resend *find_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
struct resend **previous_return); struct resend **previous_return);
void flush_resends(struct neighbour *neigh); void flush_resends(struct neighbour *neigh);
int record_resend(int kind, const unsigned char *prefix, unsigned char plen, int record_resend(int kind, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id, unsigned short seqno, const unsigned char *id,
struct interface *ifp, int delay); struct interface *ifp, int delay);
int unsatisfied_request(const unsigned char *prefix, unsigned char plen, int unsatisfied_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id); unsigned short seqno, const unsigned char *id);
int request_redundant(struct interface *ifp, int request_redundant(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,
unsigned short seqno, const unsigned char *id); unsigned short seqno, const unsigned char *id);
int satisfy_request(const unsigned char *prefix, unsigned char plen, int satisfy_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id, unsigned short seqno, const unsigned char *id,
struct interface *ifp); struct interface *ifp);
......
This diff is collapsed.
...@@ -70,9 +70,15 @@ route_metric_noninterfering(const struct babel_route *route) ...@@ -70,9 +70,15 @@ route_metric_noninterfering(const struct babel_route *route)
} }
struct babel_route *find_route(const unsigned char *prefix, unsigned char plen, struct babel_route *find_route(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
struct neighbour *neigh, const unsigned char *nexthop); struct neighbour *neigh, const unsigned char *nexthop);
struct babel_route *find_installed_route(const unsigned char *prefix, struct babel_route *find_installed_route(const unsigned char *prefix,
unsigned char plen); unsigned char plen, const unsigned char *src_prefix,
unsigned char src_plen);
struct babel_route *find_min_iroute(const unsigned char *dst_prefix,
unsigned char dst_plen,
const unsigned char *src_prefix, unsigned char src_plen,
int is_fixed_dst, int exclusive_min);
int installed_routes_estimate(void); int installed_routes_estimate(void);
void flush_route(struct babel_route *route); void flush_route(struct babel_route *route);
void flush_all_routes(void); void flush_all_routes(void);
...@@ -81,6 +87,7 @@ void flush_interface_routes(struct interface *ifp, int v4only); ...@@ -81,6 +87,7 @@ void flush_interface_routes(struct interface *ifp, int v4only);
struct route_stream *route_stream(int installed); struct route_stream *route_stream(int installed);
struct babel_route *route_stream_next(struct route_stream *stream); struct babel_route *route_stream_next(struct route_stream *stream);
void route_stream_done(struct route_stream *stream); void route_stream_done(struct route_stream *stream);
int metric_to_kernel(int metric);
void install_route(struct babel_route *route); void install_route(struct babel_route *route);
void uninstall_route(struct babel_route *route); void uninstall_route(struct babel_route *route);
int route_feasible(struct babel_route *route); int route_feasible(struct babel_route *route);
...@@ -93,6 +100,8 @@ void change_smoothing_half_life(int half_life); ...@@ -93,6 +100,8 @@ void change_smoothing_half_life(int half_life);
int route_smoothed_metric(struct babel_route *route); int route_smoothed_metric(struct babel_route *route);
struct babel_route *find_best_route(const unsigned char *prefix, struct babel_route *find_best_route(const unsigned char *prefix,
unsigned char plen, unsigned char plen,
const unsigned char *src_prefix,
unsigned char src_plen,
int feasible, struct neighbour *exclude); int feasible, struct neighbour *exclude);
struct babel_route *install_best_route(const unsigned char prefix[16], struct babel_route *install_best_route(const unsigned char prefix[16],
unsigned char plen); unsigned char plen);
...@@ -101,6 +110,8 @@ void update_interface_metric(struct interface *ifp); ...@@ -101,6 +110,8 @@ void update_interface_metric(struct interface *ifp);
void update_route_metric(struct babel_route *route); void update_route_metric(struct babel_route *route);
struct babel_route *update_route(const unsigned char *id, struct babel_route *update_route(const unsigned char *id,
const unsigned char *prefix, unsigned char plen, const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix,
unsigned char src_plen,
unsigned short seqno, unsigned short refmetric, unsigned short seqno, unsigned short refmetric,
unsigned short interval, struct neighbour *neigh, unsigned short interval, struct neighbour *neigh,
const unsigned char *nexthop, const unsigned char *nexthop,
......
...@@ -35,7 +35,9 @@ THE SOFTWARE. ...@@ -35,7 +35,9 @@ THE SOFTWARE.
struct source *srcs = NULL; struct source *srcs = NULL;
struct source* struct source*
find_source(const unsigned char *id, const unsigned char *p, unsigned char plen, find_source(const unsigned char *id,
const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
int create, unsigned short seqno) int create, unsigned short seqno)
{ {
struct source *src; struct source *src;
...@@ -49,7 +51,11 @@ find_source(const unsigned char *id, const unsigned char *p, unsigned char plen, ...@@ -49,7 +51,11 @@ find_source(const unsigned char *id, const unsigned char *p, unsigned char plen,
continue; continue;
if(src->plen != plen) if(src->plen != plen)
continue; continue;
if(memcmp(src->prefix, p, 16) == 0) if(src->src_plen != src_plen)
continue;
if(memcmp(src->prefix, prefix, 16) != 0)
continue;
if(memcmp(src->src_prefix, src_prefix, 16) == 0)
return src; return src;
} }
...@@ -63,8 +69,10 @@ find_source(const unsigned char *id, const unsigned char *p, unsigned char plen, ...@@ -63,8 +69,10 @@ find_source(const unsigned char *id, const unsigned char *p, unsigned char plen,
} }
memcpy(src->id, id, 8); memcpy(src->id, id, 8);
memcpy(src->prefix, p, 16); memcpy(src->prefix, prefix, 16);
src->plen = plen; src->plen = plen;
memcpy(src->src_prefix, src_prefix, 16);
src->src_plen = src_plen;
src->seqno = seqno; src->seqno = seqno;
src->metric = INFINITY; src->metric = INFINITY;
src->time = now.tv_sec; src->time = now.tv_sec;
......
...@@ -27,6 +27,8 @@ struct source { ...@@ -27,6 +27,8 @@ struct source {
unsigned char id[8]; unsigned char id[8];
unsigned char prefix[16]; unsigned char prefix[16];
unsigned char plen; unsigned char plen;
unsigned char src_prefix[16];
unsigned char src_plen;
unsigned short seqno; unsigned short seqno;
unsigned short metric; unsigned short metric;
unsigned short route_count; unsigned short route_count;
...@@ -34,8 +36,10 @@ struct source { ...@@ -34,8 +36,10 @@ struct source {
}; };
struct source *find_source(const unsigned char *id, struct source *find_source(const unsigned char *id,
const unsigned char *p, const unsigned char *prefix,
unsigned char plen, unsigned char plen,
const unsigned char *src_prefix,
unsigned char src_plen,
int create, unsigned short seqno); int create, unsigned short seqno);
struct source *retain_source(struct source *src); struct source *retain_source(struct source *src);
void release_source(struct source *src); void release_source(struct source *src);
......
...@@ -28,6 +28,7 @@ THE SOFTWARE. ...@@ -28,6 +28,7 @@ THE SOFTWARE.
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h> #include <limits.h>
#include <assert.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
...@@ -488,3 +489,30 @@ daemonise() ...@@ -488,3 +489,30 @@ daemonise()
return 1; return 1;
} }
enum prefix_status
prefix_cmp(const unsigned char *p1, unsigned char plen1,
const unsigned char *p2, unsigned char plen2)
{
int min = MIN(plen1, plen2);
unsigned char mask = 0xFF;
int i = 0;
while(i < min / 8) {
if(p1[i] != p2[i])
return PST_DISJOINT;
i++;
}
min -= i * 8;
if(min != 0) {
mask <<= 8 - min;
if((p1[i] & mask) != (p2[i] & mask))
return PST_DISJOINT;
}
if(plen1 < plen2)
return PST_LESS_SPECIFIC;
if(plen1 > plen2)
return PST_MORE_SPECIFIC;
return PST_EQUALS;
}
...@@ -111,6 +111,17 @@ int linklocal(const unsigned char *address) ATTRIBUTE ((pure)); ...@@ -111,6 +111,17 @@ int linklocal(const unsigned char *address) ATTRIBUTE ((pure));
int v4mapped(const unsigned char *address) ATTRIBUTE ((pure)); int v4mapped(const unsigned char *address) ATTRIBUTE ((pure));
void v4tov6(unsigned char *dst, const unsigned char *src); void v4tov6(unsigned char *dst, const unsigned char *src);
int daemonise(void); int daemonise(void);
int set_src_prefix(unsigned char *src_addr, unsigned char *src_plen);
enum prefix_status {
PST_DISJOINT = 1 << 0,
PST_EQUALS = 1 << 1,
PST_MORE_SPECIFIC = 1 << 2,
PST_LESS_SPECIFIC = 1 << 3,
};
enum prefix_status
prefix_cmp(const unsigned char *p1, unsigned char plen1,
const unsigned char *p2, unsigned char plen2);
/* If debugging is disabled, we want to avoid calling format_address /* If debugging is disabled, we want to avoid calling format_address
for every omitted debugging message. So debug is a macro. But for every omitted debugging message. So debug is a macro. But
......
...@@ -43,12 +43,15 @@ static struct xroute *xroutes; ...@@ -43,12 +43,15 @@ static struct xroute *xroutes;
static int numxroutes = 0, maxxroutes = 0; static int numxroutes = 0, maxxroutes = 0;
struct xroute * struct xroute *
find_xroute(const unsigned char *prefix, unsigned char plen) find_xroute(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen)
{ {
int i; int i;
for(i = 0; i < numxroutes; i++) { for(i = 0; i < numxroutes; i++) {
if(xroutes[i].plen == plen && if(xroutes[i].plen == plen &&
memcmp(xroutes[i].prefix, prefix, 16) == 0) memcmp(xroutes[i].prefix, prefix, 16) == 0 &&
xroutes[i].src_plen == src_plen &&
memcmp(xroutes[i].src_prefix, src_prefix, 16) == 0)
return &xroutes[i]; return &xroutes[i];
} }
return NULL; return NULL;
...@@ -86,9 +89,10 @@ flush_xroute(struct xroute *xroute) ...@@ -86,9 +89,10 @@ flush_xroute(struct xroute *xroute)
int int
add_xroute(unsigned char prefix[16], unsigned char plen, add_xroute(unsigned char prefix[16], unsigned char plen,
unsigned char src_prefix[16], unsigned char src_plen,
unsigned short metric, unsigned int ifindex, int proto) unsigned short metric, unsigned int ifindex, int proto)
{ {
struct xroute *xroute = find_xroute(prefix, plen); struct xroute *xroute = find_xroute(prefix, plen, src_prefix, src_plen);
if(xroute) { if(xroute) {
if(xroute->metric <= metric) if(xroute->metric <= metric)
return 0; return 0;
...@@ -111,6 +115,8 @@ add_xroute(unsigned char prefix[16], unsigned char plen, ...@@ -111,6 +115,8 @@ add_xroute(unsigned char prefix[16], unsigned char plen,
memcpy(xroutes[numxroutes].prefix, prefix, 16); memcpy(xroutes[numxroutes].prefix, prefix, 16);
xroutes[numxroutes].plen = plen; xroutes[numxroutes].plen = plen;
memcpy(xroutes[numxroutes].src_prefix, src_prefix, 16);
xroutes[numxroutes].src_plen = src_plen;
xroutes[numxroutes].metric = metric; xroutes[numxroutes].metric = metric;
xroutes[numxroutes].ifindex = ifindex; xroutes[numxroutes].ifindex = ifindex;
xroutes[numxroutes].proto = proto; xroutes[numxroutes].proto = proto;
...@@ -163,14 +169,15 @@ check_xroutes(int send_updates) ...@@ -163,14 +169,15 @@ check_xroutes(int send_updates)
{ {
int i, j, metric, export, change = 0, rc; int i, j, metric, export, change = 0, rc;
struct kernel_route *routes; struct kernel_route *routes;
int numroutes; struct filter_result filter_result = {0};
int numroutes, numaddresses;
static int maxroutes = 8; static int maxroutes = 8;
const int maxmaxroutes = 16 * 1024; const int maxmaxroutes = 16 * 1024;
debugf("\nChecking kernel routes.\n"); debugf("\nChecking kernel routes.\n");
again: again:
routes = malloc(maxroutes * sizeof(struct kernel_route)); routes = calloc(maxroutes, sizeof(struct kernel_route));
if(routes == NULL) if(routes == NULL)
return -1; return -1;
...@@ -185,6 +192,8 @@ check_xroutes(int send_updates) ...@@ -185,6 +192,8 @@ check_xroutes(int send_updates)
if(numroutes >= maxroutes) if(numroutes >= maxroutes)
goto resize; goto resize;
numaddresses = numroutes;
rc = kernel_routes(routes + numroutes, maxroutes - numroutes); rc = kernel_routes(routes + numroutes, maxroutes - numroutes);
if(rc < 0) if(rc < 0)
fprintf(stderr, "Couldn't get kernel routes.\n"); fprintf(stderr, "Couldn't get kernel routes.\n");
...@@ -194,13 +203,30 @@ check_xroutes(int send_updates) ...@@ -194,13 +203,30 @@ check_xroutes(int send_updates)
if(numroutes >= maxroutes) if(numroutes >= maxroutes)
goto resize; goto resize;
/* Apply filter to kernel routes (e.g. change the source prefix). */
for(i = numaddresses; i < numroutes; i++) {
filter_result.src_prefix = NULL;
redistribute_filter(routes[i].prefix, routes[i].plen,
routes[i].src_prefix, routes[i].src_plen,
routes[i].ifindex, routes[i].proto,
&filter_result);
if(filter_result.src_prefix) {
memcpy(routes[i].src_prefix, filter_result.src_prefix, 16);
routes[i].src_plen = filter_result.src_plen;
}
}
/* Check for any routes that need to be flushed */ /* Check for any routes that need to be flushed */
i = 0; i = 0;
while(i < numxroutes) { while(i < numxroutes) {
export = 0; export = 0;
metric = redistribute_filter(xroutes[i].prefix, xroutes[i].plen, metric = redistribute_filter(xroutes[i].prefix, xroutes[i].plen,
xroutes[i].ifindex, xroutes[i].proto); xroutes[i].src_prefix, xroutes[i].src_plen,
xroutes[i].ifindex, xroutes[i].proto,
NULL);
if(metric < INFINITY && metric == xroutes[i].metric) { if(metric < INFINITY && metric == xroutes[i].metric) {
for(j = 0; j < numroutes; j++) { for(j = 0; j < numroutes; j++) {
if(xroutes[i].plen == routes[j].plen && if(xroutes[i].plen == routes[j].plen &&
...@@ -215,17 +241,20 @@ check_xroutes(int send_updates) ...@@ -215,17 +241,20 @@ check_xroutes(int send_updates)
if(!export) { if(!export) {
unsigned char prefix[16], plen; unsigned char prefix[16], plen;
unsigned char src_prefix[16], src_plen;
struct babel_route *route; struct babel_route *route;
memcpy(prefix, xroutes[i].prefix, 16); memcpy(prefix, xroutes[i].prefix, 16);
plen = xroutes[i].plen; plen = xroutes[i].plen;
memcpy(src_prefix, xroutes[i].src_prefix, 16);
src_plen = xroutes[i].src_plen;
flush_xroute(&xroutes[i]); flush_xroute(&xroutes[i]);
route = find_best_route(prefix, plen, 1, NULL); route = find_best_route(prefix, plen, src_prefix, src_plen, 1,NULL);
if(route) if(route)
install_route(route); install_route(route);
/* send_update_resend only records the prefix, so the update /* send_update_resend only records the prefix, so the update
will only be sent after we perform all of the changes. */ will only be sent after we perform all of the changes. */
if(send_updates) if(send_updates)
send_update_resend(NULL, prefix, plen); send_update_resend(NULL, prefix, plen, src_prefix, src_plen);
change = 1; change = 1;
} else { } else {
i++; i++;
...@@ -238,13 +267,17 @@ check_xroutes(int send_updates) ...@@ -238,13 +267,17 @@ check_xroutes(int send_updates)
if(martian_prefix(routes[i].prefix, routes[i].plen)) if(martian_prefix(routes[i].prefix, routes[i].plen))
continue; continue;
metric = redistribute_filter(routes[i].prefix, routes[i].plen, metric = redistribute_filter(routes[i].prefix, routes[i].plen,
routes[i].ifindex, routes[i].proto); routes[i].src_prefix, routes[i].src_plen,
routes[i].ifindex, routes[i].proto, NULL);
if(metric < INFINITY) { if(metric < INFINITY) {
rc = add_xroute(routes[i].prefix, routes[i].plen, rc = add_xroute(routes[i].prefix, routes[i].plen,
routes[i].src_prefix, routes[i].src_plen,
metric, routes[i].ifindex, routes[i].proto); metric, routes[i].ifindex, routes[i].proto);
if(rc > 0) { if(rc > 0) {
struct babel_route *route; struct babel_route *route;
route = find_installed_route(routes[i].prefix, routes[i].plen); route = find_installed_route(routes[i].prefix, routes[i].plen,
routes[i].src_prefix,
routes[i].src_plen);
if(route) { if(route) {
if(allow_duplicates < 0 || if(allow_duplicates < 0 ||
routes[i].metric < allow_duplicates) routes[i].metric < allow_duplicates)
...@@ -252,7 +285,8 @@ check_xroutes(int send_updates) ...@@ -252,7 +285,8 @@ check_xroutes(int send_updates)
} }
change = 1; change = 1;
if(send_updates) if(send_updates)
send_update(NULL, 0, routes[i].prefix, routes[i].plen); send_update(NULL, 0, routes[i].prefix, routes[i].plen,
routes[i].src_prefix, routes[i].src_plen);
} }
} }
} }
......
...@@ -23,6 +23,8 @@ THE SOFTWARE. ...@@ -23,6 +23,8 @@ THE SOFTWARE.
struct xroute { struct xroute {
unsigned char prefix[16]; unsigned char prefix[16];
unsigned char plen; unsigned char plen;
unsigned char src_prefix[16];
unsigned char src_plen;
unsigned short metric; unsigned short metric;
unsigned int ifindex; unsigned int ifindex;
int proto; int proto;
...@@ -30,9 +32,11 @@ struct xroute { ...@@ -30,9 +32,11 @@ struct xroute {
struct xroute_stream; struct xroute_stream;
struct xroute *find_xroute(const unsigned char *prefix, unsigned char plen); struct xroute *find_xroute(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen);
void flush_xroute(struct xroute *xroute); void flush_xroute(struct xroute *xroute);
int add_xroute(unsigned char prefix[16], unsigned char plen, int add_xroute(unsigned char prefix[16], unsigned char plen,
unsigned char src_prefix[16], unsigned char src_plen,
unsigned short metric, unsigned int ifindex, int proto); unsigned short metric, unsigned int ifindex, int proto);
int xroutes_estimate(void); int xroutes_estimate(void);
struct xroute_stream *xroute_stream(); struct xroute_stream *xroute_stream();
......
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