I have very simple config file and trying to implement the same with DAVICI APIs. Please find attached file for config and its implementation. Not sure what is wrong, any insight would help me. Tester.c file is also compiled with cmd.c.
Thanks, Rajeev
/*
* Copyright (C) 2015 CloudGuard Software AG
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#include "tester.h"
#include <assert.h>
#include <unistd.h>
#include <string.h>
#include <stdint.h>
static char huge[4096];
static void echocb(struct tester *t, int fd)
{
char buf[sizeof(huge) * 2];
uint32_t len;
len = tester_read_cmdreq(fd, "load-conns");
assert(len < sizeof(buf));
assert(read(fd, buf, len) == len);
tester_write_cmdres(fd, buf, len);
}
static void reqcb(struct davici_conn *c, int err, const char *name,
struct davici_response *res, void *user)
{
struct tester *t = user;
char buf[64];
const char *h;
unsigned int len;
const void *v;
int ret, i, j;
assert(err >= 0);
assert(davici_get_level(res) == 0);
tester_complete(t);
}
int main(int argc, char *argv[])
{
struct tester *t;
struct davici_conn *c;
struct davici_request *r;
int err = 0;
t = tester_create(echocb);
assert(davici_connect_unix(tester_getpath(t),
tester_davici_iocb, t, &c) >= 0);
assert(davici_new_cmd("load-conns", &r) >= 0);
davici_section_start(r, "home");
davici_kvf(r, "version", "%s", "2");
davici_kvf(r, "local_addrs", "%s", "10.13.199.185");
davici_kvf(r, "remote_addrs", "%s", "10.13.199.130");
davici_kvf(r, "local_port", "%s", "500");
davici_kvf(r, "remote_port", "%s", "500");
davici_kvf(r, "proposals", "%s", "aes128-sha256-ecp256");
davici_section_start(r, "local");
davici_kvf(r,"certs","%s", "peerCert.der");
davici_kvf(r,"auth", "%s", "psk");
davici_kvf(r,"id", "%s", "10.13.199.185");
davici_section_end(r); /* end local section*/
davici_section_start(r, "remote");
davici_kvf(r,"id", "%s", "10.13.199.130");
davici_kvf(r, "auth", "%s", "psk");
davici_section_end(r); /* end remote section*/
davici_section_start(r, "children");
davici_section_start(r, "home");
davici_kvf(r, "esp_proposals", "%s", "aes128-sha256-ecp256");
davici_kvf(r, "remote_ts", "%s", "dynamic");
davici_kvf(r, "mode", "%s", "transport");
davici_section_end(r); /* children */
davici_section_end(r);/* home */
davici_section_start(r, "secrets");
davici_section_start(r, "ike-initiator");
davici_kvf(r, "secret", "%s", "0sFpZAZqEN6Ti9sqt4ZP5EWcqx");
davici_kvf(r, "id", "%s", "10.13.199.185");
davici_section_end(r);/* home */
err=davici_queue(c, r, reqcb, t);
printf(" Err is %d \n" , err);
assert(err >= 0);
tester_runio(t, c);
davici_disconnect(c);
assert(davici_connect_unix(tester_getpath(t),
tester_davici_iocb, t, &c) >= 0);
assert(davici_new_cmd("initiate", &r) >= 0);
davici_kvf(r, "child", "%%", "home");
assert(davici_queue(c, r, reqcb, t) >= 0);
tester_runio(t, c);
davici_disconnect(c);
tester_cleanup(t);
return 0;
}
swanctl.conf
Description: Binary data
_______________________________________________ Users mailing list [email protected] https://lists.strongswan.org/mailman/listinfo/users
