static int
kernel_route_add_v4(const unsigned char *pref, unsigned short plen,
- const unsigned char *gate, int ifindex, unsigned int metric,
- const unsigned char *newgate, int newifindex,
- unsigned int newmetric);
+ const unsigned char *gate, int ifindex,
+ unsigned int metric);
static int
kernel_route_add_v6(const unsigned char *pref, unsigned short plen,
- const unsigned char *gate, int ifindex, unsigned int metric,
- const unsigned char *newgate, int newifindex,
- unsigned int newmetric);
+ const unsigned char *gate, int ifindex,
+ unsigned int metric);
static int
kernel_route_delete_v4(const unsigned char *pref, unsigned short plen,
const unsigned char *gate, int ifindex,
- unsigned int metric,
- const unsigned char *newgate, int newifindex,
- unsigned int newmetric);
+ unsigned int metric);
static int
kernel_route_delete_v6(const unsigned char *pref, unsigned short plen,
const unsigned char *gate, int ifindex,
- unsigned int metric,
- const unsigned char *newgate, int newifindex,
- unsigned int newmetric);
+ unsigned int metric);
int
kernel_interface_operational(struct interface *interface)
switch (operation) {
case ROUTE_ADD:
return ipv4 ?
- kernel_route_add_v4(pref, plen, gate, ifindex, metric,
- newgate, newifindex, newmetric):
- kernel_route_add_v6(pref, plen, gate, ifindex, metric,
- newgate, newifindex, newmetric);
+ kernel_route_add_v4(pref, plen, gate, ifindex, metric):
+ kernel_route_add_v6(pref, plen, gate, ifindex, metric);
break;
case ROUTE_FLUSH:
return ipv4 ?
- kernel_route_delete_v4(pref, plen, gate, ifindex, metric,
- newgate, newifindex, newmetric):
- kernel_route_delete_v6(pref, plen, gate, ifindex, metric,
- newgate, newifindex, newmetric);
+ kernel_route_delete_v4(pref, plen, gate, ifindex, metric):
+ kernel_route_delete_v6(pref, plen, gate, ifindex, metric);
break;
case ROUTE_MODIFY:
if(newmetric == metric && memcmp(newgate, gate, 16) == 0 &&
newifindex == ifindex)
return 0;
debugf(BABEL_DEBUG_ROUTE, "Modify route: delete old; add new.");
- if (ipv4) {
- kernel_route_delete_v4(pref, plen,
- gate, ifindex, metric,
- NULL, 0, 0);
- } else {
- kernel_route_delete_v6(pref, plen,
- gate, ifindex, metric,
- NULL, 0, 0);
- }
+ rc = ipv4 ?
+ kernel_route_delete_v4(pref, plen, gate, ifindex, metric):
+ kernel_route_delete_v6(pref, plen, gate, ifindex, metric);
+
+ if (rc < 0)
+ return -1;
rc = ipv4 ?
- kernel_route_add_v4(pref, plen,
- newgate, newifindex, newmetric,
- NULL, 0, 0):
- kernel_route_add_v6(pref, plen,
- newgate, newifindex, newmetric,
- NULL, 0, 0);
- if(rc < 0) {
- if(errno == EEXIST)
- rc = 1;
- /* In principle, we should try to re-install the flushed
- route on failure to preserve. However, this should
- hopefully not matter much in practice. */
- }
+ kernel_route_add_v4(pref, plen, newgate, newifindex, newmetric):
+ kernel_route_add_v6(pref, plen, newgate, newifindex, newmetric);
return rc;
break;
static int
kernel_route_add_v4(const unsigned char *pref, unsigned short plen,
- const unsigned char *gate, int ifindex, unsigned int metric,
- const unsigned char *newgate, int newifindex,
- unsigned int newmetric)
+ const unsigned char *gate, int ifindex, unsigned int metric)
{
unsigned int tmp_ifindex = ifindex; /* (for typing) */
struct zapi_ipv4 api; /* quagga's communication system */
struct in_addr nexthop; /* next router to go */
struct in_addr *nexthop_pointer = &nexthop; /* it's an array! */
- /* convert to be comprehensive by quagga */
+ /* convert to be understandable by quagga */
/* convert given addresses */
uchar_to_inaddr(&babel_prefix_addr, pref);
uchar_to_inaddr(&nexthop, gate);
static int
kernel_route_add_v6(const unsigned char *pref, unsigned short plen,
- const unsigned char *gate, int ifindex, unsigned int metric,
- const unsigned char *newgate, int newifindex,
- unsigned int newmetric)
+ const unsigned char *gate, int ifindex, unsigned int metric)
{
unsigned int tmp_ifindex = ifindex; /* (for typing) */
struct zapi_ipv6 api; /* quagga's communication system */
struct in6_addr nexthop; /* next router to go */
struct in6_addr *nexthop_pointer = &nexthop;
- /* convert to be comprehensive by quagga */
+ /* convert to be understandable by quagga */
/* convert given addresses */
uchar_to_in6addr(&babel_prefix_addr, pref);
uchar_to_in6addr(&nexthop, gate);
static int
kernel_route_delete_v4(const unsigned char *pref, unsigned short plen,
const unsigned char *gate, int ifindex,
- unsigned int metric,
- const unsigned char *newgate, int newifindex,
- unsigned int newmetric)
+ unsigned int metric)
{
unsigned int tmp_ifindex = ifindex; /* (for typing) */
struct zapi_ipv4 api; /* quagga's communication system */
struct in_addr nexthop; /* next router to go */
struct in_addr *nexthop_pointer = &nexthop; /* it's an array! */
- /* convert to be comprehensive by quagga */
+ /* convert to be understandable by quagga */
/* convert given addresses */
uchar_to_inaddr(&babel_prefix_addr, pref);
uchar_to_inaddr(&nexthop, gate);
static int
kernel_route_delete_v6(const unsigned char *pref, unsigned short plen,
const unsigned char *gate, int ifindex,
- unsigned int metric,
- const unsigned char *newgate, int newifindex,
- unsigned int newmetric)
+ unsigned int metric)
{
unsigned int tmp_ifindex = ifindex; /* (for typing) */
struct zapi_ipv6 api; /* quagga's communication system */
struct in6_addr nexthop; /* next router to go */
struct in6_addr *nexthop_pointer = &nexthop;
- /* convert to be comprehensive by quagga */
+ /* convert to be understandable by quagga */
/* convert given addresses */
uchar_to_in6addr(&babel_prefix_addr, pref);
uchar_to_in6addr(&nexthop, gate);