added possibility to route CHILD_SAs, without to set them up
support for auto=route parameter support for ipsec route and ipsec unroute initiating of CHILD and/or IKE_SAs based on kernel acquires
This commit is contained in:
@@ -169,6 +169,26 @@ static int terminate_connection(char *name)
|
||||
return send_stroke_msg(&msg);
|
||||
}
|
||||
|
||||
static int route_connection(char *name)
|
||||
{
|
||||
stroke_msg_t msg;
|
||||
|
||||
msg.type = STR_ROUTE;
|
||||
msg.length = offsetof(stroke_msg_t, buffer);
|
||||
msg.route.name = push_string(&msg, name);
|
||||
return send_stroke_msg(&msg);
|
||||
}
|
||||
|
||||
static int unroute_connection(char *name)
|
||||
{
|
||||
stroke_msg_t msg;
|
||||
|
||||
msg.type = STR_UNROUTE;
|
||||
msg.length = offsetof(stroke_msg_t, buffer);
|
||||
msg.unroute.name = push_string(&msg, name);
|
||||
return send_stroke_msg(&msg);
|
||||
}
|
||||
|
||||
static int show_status(stroke_keyword_t kw, char *connection)
|
||||
{
|
||||
stroke_msg_t msg;
|
||||
@@ -336,6 +356,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
res = terminate_connection(argv[2]);
|
||||
break;
|
||||
case STROKE_ROUTE:
|
||||
if (argc < 3)
|
||||
{
|
||||
exit_usage("\"route\" needs a connection name");
|
||||
}
|
||||
res = route_connection(argv[2]);
|
||||
break;
|
||||
case STROKE_UNROUTE:
|
||||
if (argc < 3)
|
||||
{
|
||||
exit_usage("\"unroute\" needs a connection name");
|
||||
}
|
||||
res = unroute_connection(argv[2]);
|
||||
break;
|
||||
case STROKE_LOGTYPE:
|
||||
if (argc < 5)
|
||||
{
|
||||
|
||||
+6
-4
@@ -99,8 +99,10 @@ struct stroke_msg_t {
|
||||
enum {
|
||||
/* initiate a connection */
|
||||
STR_INITIATE,
|
||||
/* install SPD entries for a connection */
|
||||
STR_INSTALL,
|
||||
/* install SPD entries for a policy */
|
||||
STR_ROUTE,
|
||||
/* uninstall SPD entries for a policy */
|
||||
STR_UNROUTE,
|
||||
/* add a connection */
|
||||
STR_ADD_CONN,
|
||||
/* delete a connection */
|
||||
@@ -123,10 +125,10 @@ struct stroke_msg_t {
|
||||
} type;
|
||||
|
||||
union {
|
||||
/* data for STR_INITIATE, STR_INSTALL, STR_UP, STR_DOWN, ... */
|
||||
/* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */
|
||||
struct {
|
||||
char *name;
|
||||
} initiate, install, terminate, status, del_conn;
|
||||
} initiate, route, unroute, terminate, status, del_conn;
|
||||
|
||||
/* data for STR_ADD_CONN */
|
||||
struct {
|
||||
|
||||
@@ -23,6 +23,7 @@ typedef enum {
|
||||
STROKE_DEL,
|
||||
STROKE_DELETE,
|
||||
STROKE_ROUTE,
|
||||
STROKE_UNROUTE,
|
||||
STROKE_UP,
|
||||
STROKE_DOWN,
|
||||
STROKE_LOGTYPE,
|
||||
|
||||
@@ -30,6 +30,7 @@ add, STROKE_ADD
|
||||
del, STROKE_DEL
|
||||
delete, STROKE_DELETE
|
||||
route, STROKE_ROUTE
|
||||
unroute, STROKE_UNROUTE
|
||||
up, STROKE_UP
|
||||
down, STROKE_DOWN
|
||||
logtype, STROKE_LOGTYPE
|
||||
|
||||
Reference in New Issue
Block a user