Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
336b9909
Commit
336b9909
authored
Nov 12, 2015
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: Add flags to run_ip_tool
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
18d91708
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
net.c
net.c
+10
-10
No files found.
net.c
View file @
336b9909
...
@@ -588,7 +588,7 @@ exit:
...
@@ -588,7 +588,7 @@ exit:
return
ret
;
return
ret
;
}
}
static
int
run_ip_tool
(
char
*
arg1
,
char
*
arg2
,
char
*
arg3
,
int
fdin
,
int
fdout
)
static
int
run_ip_tool
(
char
*
arg1
,
char
*
arg2
,
char
*
arg3
,
int
fdin
,
int
fdout
,
unsigned
flags
)
{
{
char
*
ip_tool_cmd
;
char
*
ip_tool_cmd
;
int
ret
;
int
ret
;
...
@@ -600,7 +600,7 @@ static int run_ip_tool(char *arg1, char *arg2, char *arg3, int fdin, int fdout)
...
@@ -600,7 +600,7 @@ static int run_ip_tool(char *arg1, char *arg2, char *arg3, int fdin, int fdout)
ip_tool_cmd
=
"ip"
;
ip_tool_cmd
=
"ip"
;
ret
=
cr_system
(
fdin
,
fdout
,
-
1
,
ip_tool_cmd
,
ret
=
cr_system
(
fdin
,
fdout
,
-
1
,
ip_tool_cmd
,
(
char
*
[])
{
"ip"
,
arg1
,
arg2
,
arg3
,
NULL
},
0
);
(
char
*
[])
{
"ip"
,
arg1
,
arg2
,
arg3
,
NULL
},
flags
);
if
(
ret
)
{
if
(
ret
)
{
pr_err
(
"IP tool failed on %s %s
\n
"
,
arg1
,
arg2
);
pr_err
(
"IP tool failed on %s %s
\n
"
,
arg1
,
arg2
);
return
-
1
;
return
-
1
;
...
@@ -628,7 +628,7 @@ static int run_iptables_tool(char *def_cmd, int fdin, int fdout)
...
@@ -628,7 +628,7 @@ static int run_iptables_tool(char *def_cmd, int fdin, int fdout)
static
inline
int
dump_ifaddr
(
struct
cr_imgset
*
fds
)
static
inline
int
dump_ifaddr
(
struct
cr_imgset
*
fds
)
{
{
struct
cr_img
*
img
=
img_from_set
(
fds
,
CR_FD_IFADDR
);
struct
cr_img
*
img
=
img_from_set
(
fds
,
CR_FD_IFADDR
);
return
run_ip_tool
(
"addr"
,
"save"
,
NULL
,
-
1
,
img_raw_fd
(
img
));
return
run_ip_tool
(
"addr"
,
"save"
,
NULL
,
-
1
,
img_raw_fd
(
img
)
,
0
);
}
}
static
inline
int
dump_route
(
struct
cr_imgset
*
fds
)
static
inline
int
dump_route
(
struct
cr_imgset
*
fds
)
...
@@ -636,7 +636,7 @@ static inline int dump_route(struct cr_imgset *fds)
...
@@ -636,7 +636,7 @@ static inline int dump_route(struct cr_imgset *fds)
struct
cr_img
*
img
;
struct
cr_img
*
img
;
img
=
img_from_set
(
fds
,
CR_FD_ROUTE
);
img
=
img_from_set
(
fds
,
CR_FD_ROUTE
);
if
(
run_ip_tool
(
"route"
,
"save"
,
NULL
,
-
1
,
img_raw_fd
(
img
)))
if
(
run_ip_tool
(
"route"
,
"save"
,
NULL
,
-
1
,
img_raw_fd
(
img
)
,
0
))
return
-
1
;
return
-
1
;
/* If ipv6 is disabled, "ip -6 route dump" dumps all routes */
/* If ipv6 is disabled, "ip -6 route dump" dumps all routes */
...
@@ -646,7 +646,7 @@ static inline int dump_route(struct cr_imgset *fds)
...
@@ -646,7 +646,7 @@ static inline int dump_route(struct cr_imgset *fds)
}
}
img
=
img_from_set
(
fds
,
CR_FD_ROUTE6
);
img
=
img_from_set
(
fds
,
CR_FD_ROUTE6
);
if
(
run_ip_tool
(
"-6"
,
"route"
,
"save"
,
-
1
,
img_raw_fd
(
img
)))
if
(
run_ip_tool
(
"-6"
,
"route"
,
"save"
,
-
1
,
img_raw_fd
(
img
)
,
0
))
return
-
1
;
return
-
1
;
return
0
;
return
0
;
...
@@ -663,7 +663,7 @@ static inline int dump_rule(struct cr_imgset *fds)
...
@@ -663,7 +663,7 @@ static inline int dump_rule(struct cr_imgset *fds)
if
(
!
path
)
if
(
!
path
)
return
-
1
;
return
-
1
;
if
(
run_ip_tool
(
"rule"
,
"save"
,
NULL
,
-
1
,
img_raw_fd
(
img
)))
{
if
(
run_ip_tool
(
"rule"
,
"save"
,
NULL
,
-
1
,
img_raw_fd
(
img
)
,
0
))
{
pr_warn
(
"Check if
\"
ip rule save
\"
is supported!
\n
"
);
pr_warn
(
"Check if
\"
ip rule save
\"
is supported!
\n
"
);
unlinkat
(
get_service_fd
(
IMG_FD_OFF
),
path
,
0
);
unlinkat
(
get_service_fd
(
IMG_FD_OFF
),
path
,
0
);
}
}
...
@@ -719,7 +719,7 @@ static int restore_ip_dump(int type, int pid, char *cmd)
...
@@ -719,7 +719,7 @@ static int restore_ip_dump(int type, int pid, char *cmd)
if
(
empty_image
(
img
))
if
(
empty_image
(
img
))
return
0
;
return
0
;
if
(
img
)
{
if
(
img
)
{
ret
=
run_ip_tool
(
cmd
,
"restore"
,
NULL
,
img_raw_fd
(
img
),
-
1
);
ret
=
run_ip_tool
(
cmd
,
"restore"
,
NULL
,
img_raw_fd
(
img
),
-
1
,
0
);
close_image
(
img
);
close_image
(
img
);
}
}
...
@@ -760,9 +760,9 @@ static inline int restore_rule(int pid)
...
@@ -760,9 +760,9 @@ static inline int restore_rule(int pid)
* Delete 3 default rules to prevent duplicates. See kernel's
* Delete 3 default rules to prevent duplicates. See kernel's
* function fib_default_rules_init() for the details.
* function fib_default_rules_init() for the details.
*/
*/
run_ip_tool
(
"rule"
,
"delete"
,
NULL
,
-
1
,
-
1
);
run_ip_tool
(
"rule"
,
"delete"
,
NULL
,
-
1
,
-
1
,
0
);
run_ip_tool
(
"rule"
,
"delete"
,
NULL
,
-
1
,
-
1
);
run_ip_tool
(
"rule"
,
"delete"
,
NULL
,
-
1
,
-
1
,
0
);
run_ip_tool
(
"rule"
,
"delete"
,
NULL
,
-
1
,
-
1
);
run_ip_tool
(
"rule"
,
"delete"
,
NULL
,
-
1
,
-
1
,
0
);
if
(
restore_ip_dump
(
CR_FD_RULE
,
pid
,
"rule"
))
if
(
restore_ip_dump
(
CR_FD_RULE
,
pid
,
"rule"
))
ret
=
-
1
;
ret
=
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment