cp
do_encrypt((vpn_packet_t*)packet, &rp, cl->key);
rp.from = htonl(myself->vpn_ip);
- rp.data->len = htons(rp.data->len);
- rp.len = htons(rp.data->len);
+ rp.data.len = htons(rp.data.len);
+ rp.len = htons(rp.len);
if(debug_lvl > 3)
syslog(LOG_ERR, "Sent %d bytes to %lx", ntohs(rp.len), cl->vpn_ip);
return 0;
}
-int xrecv(conn_list_t *cl, void *packet)
+int xrecv(conn_list_t *cl, real_packet_t *packet)
{
vpn_packet_t vp;
int lenin;
cp
- packet->data->len = ntohs(packet->data->len);
- packet->len = ntohs(packet->len);
- packet->from = ntohl(packet->from);
-
do_decrypt((real_packet_t*)packet, &vp, cl->key);
add_mac_addresses(&vp);
return -1;
}
total_socket_in += lenin;
+
+ rp.data.len = ntohs(rp.data.len);
+ rp.len = ntohs(rp.len);
+ rp.from = ntohl(rp.from);
+
if(rp.len >= 0)
{
f = lookup_conn(rp.from);
int handle_incoming_meta_data(conn_list_t *cl)
{
int x, l = sizeof(x);
- int request, oldlen, p, i;
+ int request, oldlen, i;
int lenin = 0;
cp
if(getsockopt(cl->meta_socket, SOL_SOCKET, SO_ERROR, &x, &l) < 0)
if(debug_lvl > 2)
syslog(LOG_DEBUG, "Send ACK to %s", cl->hostname);
- buflen = snprintf(buffer, MAXBUFLEN, "%d\n", ACK);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d\n", ACK);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Send TERMREQ to " IP_ADDR_S,
IP_ADDR_V(cl->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %lx\n", TERMREQ, myself->vpn_ip);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %lx\n", TERMREQ, myself->vpn_ip);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Send TIMEOUT to " IP_ADDR_S,
IP_ADDR_V(cl->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %lx\n", PINGTIMEOUT, myself->vpn_ip);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %lx\n", PINGTIMEOUT, myself->vpn_ip);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Sending delete host " IP_ADDR_S " to " IP_ADDR_S,
IP_ADDR_V(new_host->vpn_ip), IP_ADDR_V(cl->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %lx\n", DEL_HOST, new_host->vpn_ip);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %lx\n", DEL_HOST, new_host->vpn_ip);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
if(debug_lvl > 3)
syslog(LOG_DEBUG, "pinging " IP_ADDR_S, IP_ADDR_V(cl->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d\n", PING);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d\n", PING);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
int send_pong(conn_list_t *cl)
{
cp
- buflen = snprintf(buffer, MAXBUFLEN, "%d\n", PONG);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d\n", PONG);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Sending add host to " IP_ADDR_S,
IP_ADDR_V(cl->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %lx %lx/%lx:%x\n", ADD_HOST, new_host->real_ip, new_host->vpn_ip, new_host->vpn_mask, new_host->port);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %lx %lx/%lx:%x\n", ADD_HOST, new_host->real_ip, new_host->vpn_ip, new_host->vpn_mask, new_host->port);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Sending KEY_CHANGED to " IP_ADDR_S,
IP_ADDR_V(cl->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %lx\n", KEY_CHANGED, src->vpn_ip);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %lx\n", KEY_CHANGED, src->vpn_ip);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Send BASIC_INFO to " IP_ADDR_S,
IP_ADDR_V(cl->real_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %d %lx/%lx:%x\n", BASIC_INFO, PROT_CURRENT, myself->vpn_ip, myself->vpn_mask, myself->port);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %d %lx/%lx:%x\n", BASIC_INFO, PROT_CURRENT, myself->vpn_ip, myself->vpn_mask, myself->port);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Send PUBLIC_KEY %s to " IP_ADDR_S,
my_public_key_base36, IP_ADDR_V(cl->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %s\n", PUBLIC_KEY, my_public_key_base36);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %s\n", PUBLIC_KEY, my_public_key_base36);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
int send_calculate(conn_list_t *cl, char *k)
{
cp
- buflen = snprintf(buffer, MAXBUFLEN, "%d %s\n", CALCULATE, k);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %s\n", CALCULATE, k);
if((write(cl->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Sending out request for public key to " IP_ADDR_S,
IP_ADDR_V(fw->nexthop->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %lx %lx\n", REQ_KEY, to, myself->vpn_ip);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %lx %lx\n", REQ_KEY, to, myself->vpn_ip);
if((write(fw->nexthop->meta_socket, buffer, buflen)) < 0)
{
syslog(LOG_DEBUG, "Sending public key to " IP_ADDR_S,
IP_ADDR_V(fw->nexthop->vpn_ip));
- buflen = snprintf(buffer, MAXBUFLEN, "%d %lx %lx %d %s\n", ANS_KEY, to, myself->vpn_ip, my_key_expiry, my_public_key_base36);
+ buflen = snprintf(buffer, MAXBUFSIZE, "%d %lx %lx %d %s\n", ANS_KEY, to, myself->vpn_ip, my_key_expiry, my_public_key_base36);
if((write(fw->nexthop->meta_socket, buffer, buflen)) < 0)
{