Commit 8f05162b authored by Pavel Emelyanov's avatar Pavel Emelyanov

libcriu: Add add_veth_pair call

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1a5a0344
......@@ -205,6 +205,41 @@ er:
return -ENOMEM;
}
int criu_add_veth_pair(char *in, char *out)
{
int nr;
CriuVethPair **a, *p;
p = malloc(sizeof(*p));
if (!p)
goto er;
p->if_in = strdup(in);
if (!p->if_in)
goto er_p;
p->if_out = strdup(out);
if (!p->if_out)
goto er_i;
nr = opts->n_veths + 1;
a = realloc(opts->veths, nr * sizeof(p));
if (!a)
goto er_o;
a[nr - 1] = p;
opts->veths = a;
opts->n_veths = nr;
return 0;
er_o:
free(p->if_out);
er_i:
free(p->if_in);
er_p:
free(p);
er:
return -ENOMEM;
}
static CriuResp *recv_resp(int socket_fd)
{
unsigned char buf[CR_MAX_MSG_SIZE];
......
......@@ -49,6 +49,7 @@ void criu_set_cpu_cap(unsigned int cap);
void criu_set_root(char *root);
int criu_set_exec_cmd(int argc, char *argv[]);
int criu_add_ext_mount(char *key, char *val);
int criu_add_veth_pair(char *in, char *out);
/* Here is a table of return values and errno's of functions
* from the list down below.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment