Skip to content

Commit

Permalink
support for announcing routes to bird
Browse files Browse the repository at this point in the history
This migrates to the use of the "ip" command instead of "route", in order to
be able to append "proto static", since this is really a static route entry
that routing daemons should follow; it's neither an ICMP redirection, nor an
autoconfed kernel route, nor a bootup route, nor an RA route.
  • Loading branch information
sthibaul authored and ValdikSS committed Nov 20, 2015
1 parent 2b55411 commit 1a660b7
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions UserAcct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,13 +705,13 @@ void UserAcct::delSystemRoutes(PluginContext * context)
}

//create system call
strncat(routestring, "route del -net ",15);
strncat(routestring, "ip route del ",13);
strncat(routestring, framedip ,16);
strncat(routestring, "/" ,1);
strncat(routestring, framednetmask_cidr, 2);
if (framedgw[0]!='\0')
{
strncat(routestring, " gw ", 4);
strncat(routestring, " via ", 5);
strncat(routestring, framedgw, 16);
}
if (framedmetric[0]!='\0')
Expand All @@ -721,6 +721,7 @@ void UserAcct::delSystemRoutes(PluginContext * context)
}
strncat(routestring," dev ",5);
strcat(routestring,this->getDev().c_str());
strncat(routestring," proto static",13);
//redirect the output stderr to /dev/null
strncat(routestring," 2> /dev/null",13);

Expand Down Expand Up @@ -846,13 +847,13 @@ void UserAcct::delSystemRoutes(PluginContext * context)
}

//create system call
strncat(routestring, "route -6 del ",13);
strncat(routestring, "ip -6 route del ",16);
strncat(routestring, framedip ,40);
strncat(routestring, "/" ,1);
strncat(routestring, framednetmask_cidr, 3);
if (framedgw[0]!='\0')
{
strncat(routestring, " gw ", 4);
strncat(routestring, " via ", 5);
strncat(routestring, framedgw, 40);
}
if (framedmetric[0]!='\0')
Expand All @@ -862,6 +863,7 @@ void UserAcct::delSystemRoutes(PluginContext * context)
}
strncat(routestring," dev ",5);
strcat(routestring,this->getDev().c_str());
strncat(routestring," proto static",13);
//redirect the output stderr to /dev/null
strncat(routestring," 2> /dev/null",13);

Expand Down Expand Up @@ -1010,13 +1012,13 @@ void UserAcct::addSystemRoutes(PluginContext * context)


//create system call
strncat(routestring, "route add -net ",15);
strncat(routestring, "ip route add ",13);
strncat(routestring, framedip ,16);
strncat(routestring, "/" ,1);
strncat(routestring, framednetmask_cidr, 2);
if (framedgw[0]!='\0')
{
strncat(routestring, " gw ", 4);
strncat(routestring, " via ", 5);
strncat(routestring, framedgw, 16);
}
if (framedmetric[0]!='\0')
Expand All @@ -1026,6 +1028,7 @@ void UserAcct::addSystemRoutes(PluginContext * context)
}
strncat(routestring," dev ",5);
strcat(routestring,this->getDev().c_str());
strncat(routestring," proto static",13);
//redirect the output stderr to /dev/null
strncat(routestring," 2> /dev/null",13);

Expand Down Expand Up @@ -1150,13 +1153,13 @@ void UserAcct::addSystemRoutes(PluginContext * context)


//create system call
strncat(routestring, "route -6 add ",13);
strncat(routestring, "ip -6 route add ",21);
strncat(routestring, framedip ,40);
strncat(routestring, "/" ,1);
strncat(routestring, framednetmask_cidr, 3);
if (framedgw[0]!='\0')
{
strncat(routestring, " gw ", 4);
strncat(routestring, " via ", 5);
strncat(routestring, framedgw, 40);
}
if (framedmetric[0]!='\0')
Expand All @@ -1166,6 +1169,7 @@ void UserAcct::addSystemRoutes(PluginContext * context)
}
strncat(routestring," dev ",5);
strcat(routestring,this->getDev().c_str());
strncat(routestring," proto static",13);
//redirect the output stderr to /dev/null
strncat(routestring," 2> /dev/null",13);

Expand Down Expand Up @@ -1285,7 +1289,7 @@ int UserAcct::deleteCcdFile(PluginContext * context)
{
string filename;
filename = context->conf.getCcdPath()+ this->getCommonname();
if(context->conf.getOverWriteCCFiles()==true && (this->getFramedIp().length() > 0 || this->getFramedRoutes().length() > 0 || this->getFramedRoutes6().length() > 0))
if(context->conf.getOverWriteCCFiles()==true && (this->getFramedIp().length() > 0 || this->getFramedRoutes().length() > 0 || this->getFramedIp6().length() > 0 || this->getFramedRoutes6().length() > 0))
{
remove(filename.c_str());
}
Expand Down

0 comments on commit 1a660b7

Please sign in to comment.