2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

libcriu: Add add_veth_pair call

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2014-06-25 17:37:50 +04:00
parent 1a5a034413
commit 8f05162bb4
2 changed files with 36 additions and 0 deletions

View File

@@ -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];