Kerem,
Have you tried adding the same static route from the command line?
Your static route looks like this using ip route command:
ip route add 100.100.100.1/24 dev eth0 via 200.200.200.1
Right?
My guess is that 200.200.200.1 is unreachable and the ip route command
would fail with a message indicating that. Look at zebra.log you might
see something similar there. You can take a look at you syslog which
will also log a message along the same lines when zebra tries to inject
such route.
Cheers,
Jafar
On 9/10/2016 7:41 AM, Kerem saka wrote:
Hi Developer,
I have build my own daemon in quagga. It runs and i can telnet into
it, but now i want to add static routes with this daemon to the
routing table. I am using the zapi_ipv4_route funkion (funtion i
implemeted is added at the end) to add a route to the routing table,
but after i call this funktion i can not see any changes in the
routing table and i don´t get any error message. So now i am trying to
find out what i am doing wrong. Can you please look into the funktion
and look if there are any errors i made by initializing the variables?
I tried the same funktion in the ripd daemon but it still didn´t add
any routes to the routing table.
Code:
int i2rs_route_add ()
{
struct zapi_ipv4 api;
struct prefix_ipv4 routeToAdd;
struct in_addr nexthop[1];
struct in_addr *nexthop_p;
unsigned int ifindex;
routeToAdd.family = AF_INET; //only ip4 address
routeToAdd.prefixlen = 24; // ip4 mask \24
inet_pton(AF_INET, "100.100.100.1", &routeToAdd.prefix.s_addr);
//ip4 address saved in routeToAdd.prefix.s_addr with type s_addr
//currently static
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_STATIC;//static route in route table
api.flags =0; //initialized with 0
api.message = ZAPI_MESSAGE_NEXTHOP | ZAPI_MESSAGE_METRIC;//message flags
api.nexthop_num = 1;//number of nexthop
api.ifindex_num = 0;//interface number initialized
inet_pton(AF_INET, "200.200.200.1", &nexthop[0].s_addr);
//ip4 address saved as s_addr
nexthop_p = nexthop; //nexthop pointer
api.nexthop = &nexthop_p;
ifindex = 1;//eth0 number
api.ifindex = &ifindex;
api.distance = 0;//default distance
api.metric = 10;//
zapi_ipv4_route (ZEBRA_IPV4_ROUTE_ADD, zclient, &routeToAdd, &api);
printf("add route\n");
return 0;
}
Best Regards
Kerem Saka
_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev
_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev