mirror of
https://bitbucket.org/openhip/openhip/
synced 2023-12-14 05:52:53 +01:00
remove old support for i3 protocol
git-svn-id: svn://svn.code.sf.net/p/openhip/code/hip/branches/hipv2@144 4c5cb64f-9889-4596-9799-84b02dc3effa
This commit is contained in:
parent
2efb5da848
commit
a33a83edf4
|
@ -64,9 +64,6 @@ if test "x$ac_cv_lib_crypto_RSA_verify" != "xyes"; then
|
|||
fi
|
||||
|
||||
AC_CHECK_LIB([pthread], [pthread_create])
|
||||
# FIXME: Replace `main' with a function in `-li3', `-li3client':
|
||||
#AC_CHECK_LIB([i3], [main])
|
||||
#AC_CHECK_LIB([i3client], [main])
|
||||
# FIXME: Replace `main' with a function in `-liphlpapi':
|
||||
#AC_CHECK_LIB([iphlpapi], [])
|
||||
AC_CHECK_LIB([ipsec], [pfkey_send_hip_x1])
|
||||
|
|
|
@ -804,9 +804,6 @@ struct hip_opt {
|
|||
#ifdef MOBILE_ROUTER
|
||||
int mr;
|
||||
#endif
|
||||
#ifdef HIP_I3
|
||||
int i3;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef MOBILE_ROUTER
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Andrei Gurtov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* Authors: Andrei Gurtov, HIIT
|
||||
* Written: 3.4.2005
|
||||
*
|
||||
* \brief Interface with i3 and HIP for Hi3
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h> /* basic system data types */
|
||||
#include <sys/socket.h> /* basic socket definitions */
|
||||
#include <sys/time.h> /* timeval{} for select() */
|
||||
#include <errno.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <time.h> /* timespec{} for pselect() */
|
||||
#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include "i3_server/i3_matching.h"
|
||||
#include "i3/i3.h"
|
||||
#include "i3_client/i3_client_api.h"
|
||||
#include "i3_client/i3_client_id.h"
|
||||
#include "hip.h"
|
||||
|
||||
#define CFGFILE "i3-cfg-PL.xml"
|
||||
//#define HI3_DEBUG
|
||||
|
||||
int cl_register_callback(unsigned short, void (*)(), void*);
|
||||
int send_i3(__u8 *, int, hip_hit *, struct sockaddr*, struct sockaddr*);
|
||||
void hip_handle_packet(struct msghdr* , int, __u16);
|
||||
int i3_init(hip_hit*);
|
||||
void init_id_fromstr(ID *, char *);
|
||||
void print_hit(const hip_hit *);
|
||||
void clean_i3();
|
|
@ -379,7 +379,7 @@ int main (int argc, char **argv)
|
|||
*/
|
||||
argv++, argc--;
|
||||
while (argc > 0) {
|
||||
if (strstr("-v-q-d-r1-p-nr-o-a-t-u-i3-conf-mn-mr-g", *argv)) {
|
||||
if (strstr("-v-q-d-r1-p-nr-o-a-t-u-conf-mn-mr-g", *argv)) {
|
||||
argv--, argc++;
|
||||
goto start_hip;
|
||||
} else {
|
||||
|
|
|
@ -85,11 +85,6 @@
|
|||
#include <hip/hip_cfg_api.h>
|
||||
#endif
|
||||
|
||||
#ifdef HIP_I3
|
||||
#include "i3_hip.h"
|
||||
int (*select_func)(int, fd_set*, fd_set*, fd_set*, struct timeval *);
|
||||
#endif
|
||||
|
||||
#ifdef __MACOSX__
|
||||
extern void del_divert_rule(int);
|
||||
#endif
|
||||
|
@ -105,7 +100,6 @@ extern void del_divert_rule(int);
|
|||
int main(int argc, char *argv[]);
|
||||
|
||||
/* HIP packets */
|
||||
/*I3: static */
|
||||
#ifdef __WIN32__
|
||||
void hip_handle_packet(__u8* buff, int length, struct sockaddr *src);
|
||||
#else
|
||||
|
@ -199,9 +193,6 @@ int main_loop(int argc, char **argv)
|
|||
#ifdef MOBILE_ROUTER
|
||||
OPT.mr = FALSE;
|
||||
#endif
|
||||
#ifdef HIP_I3
|
||||
OPT.i3 = FALSE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set default configuration
|
||||
|
@ -317,17 +308,6 @@ int main_loop(int argc, char **argv)
|
|||
argv++, argc--;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(*argv, "-i3") == 0) {
|
||||
#ifndef HIP_I3
|
||||
log_(ERR, "Error: -i3 option specified but I3 support "
|
||||
"not enabled at compile time.\n");
|
||||
exit(1);
|
||||
#else
|
||||
OPT.i3 = TRUE;
|
||||
#endif /* HIP_I3 */
|
||||
argv++, argc--;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(*argv, "-conf") == 0) {
|
||||
argv++, argc--;
|
||||
strncpy(HCNF.conf_filename, *argv,
|
||||
|
@ -621,11 +601,6 @@ int main_loop(int argc, char **argv)
|
|||
|
||||
log_(NORMT, "Listening on HIP and PF_KEY sockets...\n");
|
||||
|
||||
#ifdef HIP_I3
|
||||
if (OPT.i3)
|
||||
i3_init((hip_hit *)get_preferred_hi(my_hi_head)->hit);
|
||||
#endif
|
||||
|
||||
/* main event loop */
|
||||
for (;;) {
|
||||
/* this line causes a performance hit, used for debugging... */
|
||||
|
@ -673,17 +648,9 @@ int main_loop(int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HIP_I3
|
||||
select_func = OPT.i3 ? &cl_select : &select;
|
||||
/* wait for I3 socket activity */
|
||||
if ((err = (*select_func)((highest_descriptor + 1), &read_fdset,
|
||||
NULL, NULL, &timeout)) < 0) {
|
||||
#else
|
||||
|
||||
/* wait for socket activity */
|
||||
if ((err = select((highest_descriptor + 1), &read_fdset,
|
||||
NULL, NULL, &timeout)) < 0) {
|
||||
#endif
|
||||
/* sometimes select receives interrupt in addition
|
||||
* to the hip_exit() signal handler */
|
||||
if (errno == EINTR)
|
||||
|
|
|
@ -68,10 +68,6 @@
|
|||
#include <hip/hip_globals.h>
|
||||
#include <hip/hip_funcs.h>
|
||||
|
||||
#ifdef HIP_I3
|
||||
#include "i3_hip.h"
|
||||
#endif
|
||||
|
||||
#ifdef HIP_VPLS
|
||||
#include <hip/hip_cfg_api.h>
|
||||
#endif /* HIP_VPLS */
|
||||
|
@ -201,11 +197,6 @@ int hip_send_I1(hip_hit *hit, hip_assoc *hip_a)
|
|||
hiph->checksum = checksum_packet(&buff[0], src, dst);
|
||||
|
||||
/* send the packet */
|
||||
#ifdef HIP_I3
|
||||
if (OPT.i3)
|
||||
return(send_i3(buff, location, hit, src, dst));
|
||||
else
|
||||
#endif
|
||||
return(hip_send(buff, location, src, dst, hip_a, do_retrans));
|
||||
}
|
||||
|
||||
|
@ -281,11 +272,6 @@ int hip_send_R1(struct sockaddr *src, struct sockaddr *dst, hip_hit *hiti,
|
|||
|
||||
/* send the packet */
|
||||
log_(NORMT, "Sending HIP_R1 packet (%d bytes)...\n", total_len);
|
||||
#ifdef HIP_I3
|
||||
if (OPT.i3)
|
||||
err = send_i3(data, r1_entry->len, hiti, src, dst);
|
||||
else
|
||||
#endif
|
||||
err = hip_send(data, total_len, src, dst, NULL, FALSE);
|
||||
|
||||
free(data); /* not retransmitted */
|
||||
|
@ -701,11 +687,6 @@ int hip_send_I2(hip_assoc *hip_a)
|
|||
|
||||
/* send the packet */
|
||||
log_(NORMT, "Sending HIP_I2 packet (%d bytes)...\n", location);
|
||||
#ifdef HIP_I3
|
||||
if (OPT.i3)
|
||||
return(send_i3(buff, location, &hip_a->peer_hi->hit, HIPA_SRC(hip_a), HIPA_DST(hip_a)));
|
||||
else
|
||||
#endif
|
||||
return(hip_send(buff, location, HIPA_SRC(hip_a), HIPA_DST(hip_a),
|
||||
hip_a, TRUE));
|
||||
}
|
||||
|
@ -798,12 +779,7 @@ int hip_send_R2(hip_assoc *hip_a)
|
|||
log_(NORMT, "Sending HIP_R2 packet (%d bytes)...\n", location);
|
||||
/* R2 packet is not scheduled for retrans., but saved for retrans. */
|
||||
|
||||
#ifdef HIP_I3
|
||||
if (OPT.i3)
|
||||
return(send_i3(buff, location, &hiph->hit_rcvr, HIPA_SRC(hip_a), HIPA_DST(hip_a)));
|
||||
else
|
||||
#endif
|
||||
return(hip_send(buff, location, HIPA_SRC(hip_a), HIPA_DST(hip_a),
|
||||
return(hip_send(buff, location, HIPA_SRC(hip_a), HIPA_DST(hip_a),
|
||||
hip_a, TRUE));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,219 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Andrei Gurtov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* Authors: Andrei Gurtov, HIIT
|
||||
* Written: 3.3.2005
|
||||
*
|
||||
* \brief Implementation of Hi3 receiver
|
||||
* Based on a modified example from UCB i3
|
||||
*/
|
||||
|
||||
#include <hip/i3_hip.h>
|
||||
|
||||
/*
|
||||
* Called from i3 when a data packet arrives to a trigger
|
||||
* Creates msg envelop and passes the packet to HIP
|
||||
*/
|
||||
void receive_payload(cl_trigger *t, void* data, void *fun_ctx) {
|
||||
#ifdef HI3_DEBUG
|
||||
int i;
|
||||
#endif
|
||||
struct msghdr msg;
|
||||
struct iovec iov;
|
||||
cl_buf* clb = (cl_buf *) data;
|
||||
|
||||
#if 0
|
||||
/* This is for the case when IP header is not tunneled through i3
|
||||
and needs to be reconstructed for interfacing with HIP at the receiver
|
||||
*/
|
||||
struct ip *iph;
|
||||
char buf[2000];
|
||||
hiphdr *hiph;
|
||||
int dglen;
|
||||
struct in_addr srcaddr, dstaddr;
|
||||
struct sockaddr_in src, dst;
|
||||
struct hostent *hptr;
|
||||
struct utsname myname;
|
||||
|
||||
srcaddr.s_addr = inet_addr("128.214.112.3");
|
||||
dstaddr.s_addr = inet_addr("128.214.112.2");
|
||||
uname(&myname);
|
||||
hptr = gethostbyname(myname.nodename);
|
||||
dstaddr.s_addr = *((in_addr_t *)hptr->h_addr_list[0]);
|
||||
|
||||
src.sin_addr = (struct in_addr) srcaddr;
|
||||
src.sin_family = AF_INET;
|
||||
dst.sin_addr = (struct in_addr) dstaddr;
|
||||
dst.sin_family = AF_INET;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
printf("Received %d bytes through I3\n", clb->data_len);
|
||||
for (i=0; i < clb->data_len; i++)
|
||||
printf("%.2x ", (unsigned char)clb->data[i]);
|
||||
printf("\n");
|
||||
|
||||
iph = (struct ip *) buf;
|
||||
hiph = (hiphdr *) ((char *)iph + sizeof(struct ip));
|
||||
|
||||
memcpy((char *)iph + sizeof(struct ip), clb->data, clb->data_len);
|
||||
dglen = sizeof(struct ip) + clb->data_len;
|
||||
|
||||
iph->ip_v = 4;
|
||||
iph->ip_hl = sizeof(struct ip) >> 2;
|
||||
iph->ip_tos = 0;
|
||||
iph->ip_len = htons(dglen); /* network byte order */
|
||||
iph->ip_id = 0; /* let IP set this */
|
||||
iph->ip_off = 0; /* frag offset, MF and DF flags */
|
||||
iph->ip_ttl = 200;
|
||||
iph->ip_p = 99;
|
||||
iph->ip_src = srcaddr;
|
||||
iph->ip_dst = dstaddr;
|
||||
iph->ip_sum = in_cksum((unsigned short *)iph, sizeof (struct ip));
|
||||
|
||||
hiph->checksum = 0;
|
||||
hiph->checksum = checksum_packet((char *)hiph,
|
||||
(struct sockaddr *) &src,
|
||||
(struct sockaddr *) &dst);
|
||||
#endif
|
||||
|
||||
#ifdef HI3_DEBUG
|
||||
printf("Passing following packet of %d to HIP\n", clb->data_len);
|
||||
for (i=0; i < clb->data_len; i++)
|
||||
printf("%.2x ", ((unsigned char *) clb->data)[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
//Construct message envelop as required by hip_handle_packet()
|
||||
msg.msg_name = NULL;
|
||||
msg.msg_namelen = 0;
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = NULL;
|
||||
msg.msg_controllen = 0;
|
||||
msg.msg_flags = 0;
|
||||
iov.iov_len = clb->data_len;
|
||||
iov.iov_base = clb->data;
|
||||
|
||||
hip_handle_packet(&msg, clb->data_len, AF_INET);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize i3 trigger from ascii string
|
||||
*/
|
||||
void init_id_fromstr(ID *id, char *name) {
|
||||
uint i;
|
||||
|
||||
for (i = 0; i < ID_LEN; i++)
|
||||
id->x[i] = name[i % strlen(name)];
|
||||
}
|
||||
|
||||
/*
|
||||
* i3 callbacks for trigger management
|
||||
*/
|
||||
void constraint_failed(cl_trigger *t, void *data, void *fun_ctx) {
|
||||
printf("Trigger constraint failed\n");
|
||||
}
|
||||
void trigger_inserted(cl_trigger *t, void *data, void *fun_ctx) {
|
||||
printf("Trigger inserted\n");
|
||||
}
|
||||
void trigger_failure(cl_trigger *t, void *data, void *fun_ctx) {
|
||||
printf("Trigger failed\n");
|
||||
|
||||
/* reinsert trigger */
|
||||
cl_insert_trigger(t, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize i3, insert trigger chain for host's HIT
|
||||
*/
|
||||
int i3_init(hip_hit *hit) {
|
||||
struct hostent *hptr;
|
||||
struct utsname myname;
|
||||
char str[INET6_ADDRSTRLEN];
|
||||
char **pptr;
|
||||
cl_trigger *t1, *t;
|
||||
ID id, ida;
|
||||
Key key;
|
||||
|
||||
if (uname(&myname) < 0) {
|
||||
err_sys("uname error.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((hptr = gethostbyname(myname.nodename)) == NULL) {
|
||||
err_sys("gethostbyname error\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
printf("name = %s\n", hptr->h_name);
|
||||
for (pptr = hptr->h_addr_list; *pptr != NULL; pptr++) {
|
||||
printf("address = %s\n", inet_ntop(hptr->h_addrtype,
|
||||
*pptr, str, sizeof(str)));
|
||||
}
|
||||
|
||||
/* initialize context */
|
||||
cl_init(CFGFILE);
|
||||
|
||||
/*
|
||||
* Create and insert triggers (id, ida), and (ida, R), respectively.
|
||||
* All triggers are r-constrained (right constrained)
|
||||
*/
|
||||
bzero(&id, ID_LEN);
|
||||
memcpy(&id, hit, HIT_SIZE);
|
||||
init_id_fromstr(&ida, "this is another test id");
|
||||
cl_set_private_id(&id);
|
||||
cl_set_private_id(&ida);
|
||||
|
||||
/* Note: ida will be updated as ida.key = h_r(id.key) */
|
||||
t1 = cl_create_trigger_id(&id, ID_LEN_BITS, &ida,
|
||||
CL_TRIGGER_CFLAG_R_CONSTRAINT);
|
||||
t = cl_create_trigger(&ida, ID_LEN_BITS, &key,
|
||||
CL_TRIGGER_CFLAG_R_CONSTRAINT);
|
||||
|
||||
/* associate callbacks with the inserted trigger */
|
||||
cl_register_trigger_callback(t, CL_CBK_TRIGGER_CONSTRAINT_FAILED,
|
||||
constraint_failed, NULL);
|
||||
cl_register_trigger_callback(t, CL_CBK_RECEIVE_PAYLOAD,
|
||||
receive_payload, NULL);
|
||||
cl_register_trigger_callback(t, CL_CBK_TRIGGER_INSERTED,
|
||||
trigger_inserted, NULL);
|
||||
cl_register_trigger_callback(t, CL_CBK_TRIGGER_REFRESH_FAILED,
|
||||
trigger_failure, NULL);
|
||||
|
||||
/* insert triggers */
|
||||
cl_insert_trigger(t, 0);
|
||||
cl_insert_trigger(t1, 0);
|
||||
|
||||
printf("Listening to HIT in I3: ");
|
||||
print_hit((const hip_hit*) hit);
|
||||
printf("\n");
|
||||
printf("Public trigger");
|
||||
printf_i3_id(&id, 2);
|
||||
printf("Private trigger");
|
||||
printf_i3_id(&ida, 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes i3 triggers
|
||||
*/
|
||||
void clean_i3(cl_trigger *t1, cl_trigger *t) {
|
||||
/* remove & destroy trigger */
|
||||
cl_destroy_trigger(t);
|
||||
cl_destroy_trigger(t1);
|
||||
|
||||
/* destroy context */
|
||||
cl_exit();
|
||||
}
|
|
@ -1,154 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Andrei Gurtov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* Authors: Andrei Gurtov, HIIT
|
||||
* Written: 10.2.2005
|
||||
*
|
||||
* \brief Implementation of Hi3 sender
|
||||
* Based on a modified example from UCB i3
|
||||
*/
|
||||
|
||||
#include <hip/i3_hip.h>
|
||||
|
||||
/*
|
||||
* Prints out HIT for debugging
|
||||
*/
|
||||
void print_hit(const hip_hit *hit) {
|
||||
int i;
|
||||
unsigned char *c;
|
||||
|
||||
c = (unsigned char*) hit;
|
||||
printf("0x");
|
||||
for (i=0; i < HIT_SIZE; i++) {
|
||||
printf("%.2x", c[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create i3 trigger id from ascii hex string
|
||||
*/
|
||||
void read_id(ID *id, char *hstr) {
|
||||
int i;
|
||||
char h[3];
|
||||
int dummy;
|
||||
|
||||
for (i = 0; i < ID_LEN; i++) {
|
||||
/* covert from string into hexa number */
|
||||
h[0] = hstr[2*i];
|
||||
h[1] = hstr[2*i + 1];
|
||||
h[2] = 0;
|
||||
sscanf(h, "%x", &dummy);
|
||||
id->x[i] = dummy;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate checksum for IP header, example from Stevens
|
||||
*/
|
||||
unsigned short in_cksum(unsigned short *addr, int len) {
|
||||
int nleft = len;
|
||||
int sum = 0;
|
||||
unsigned short *w = addr;
|
||||
unsigned short answer = 0;
|
||||
|
||||
/*
|
||||
* Our algorithm is simple, using a 32 bit accumulator (sum), we add
|
||||
* sequential 16 bit words to it, and at the end, fold back all the
|
||||
* carry bits from the top 16 bits into the lower 16 bits.
|
||||
*/
|
||||
while (nleft > 1) {
|
||||
sum += *w++;
|
||||
nleft -= 2;
|
||||
}
|
||||
|
||||
/* 4mop up an odd byte, if necessary */
|
||||
if (nleft == 1) {
|
||||
*(unsigned char *)(&answer) = *(unsigned char *)w ;
|
||||
sum += answer;
|
||||
}
|
||||
|
||||
/* 4add back carry outs from top 16 bits to low 16 bits */
|
||||
sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
|
||||
sum += (sum >> 16); /* add carry */
|
||||
answer = ~sum; /* truncate to 16 bits */
|
||||
return(answer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback for i3
|
||||
*/
|
||||
void no_matching_trigger(void *ctx_data, void *data, void *fun_ctx) {
|
||||
ID *id = (ID *) ctx_data;
|
||||
|
||||
printf("Following ID not found, ");
|
||||
printf_i3_id(id, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a packet to i3 assuming the responder's hit is inserted as a trigger
|
||||
*/
|
||||
int send_i3(__u8 *data, int size, hip_hit *hit, struct sockaddr* src,
|
||||
struct sockaddr* dst) {
|
||||
ID id;
|
||||
cl_buf *clb;
|
||||
struct ip *iph;
|
||||
int dglen;
|
||||
#ifdef HI3_DEBUG
|
||||
int i;
|
||||
#endif
|
||||
|
||||
dglen = size + sizeof(struct ip);
|
||||
clb = cl_alloc_buf(dglen);
|
||||
|
||||
iph = (struct ip *) clb->data;
|
||||
memcpy((char *)iph + sizeof(struct ip), data, size);
|
||||
|
||||
/* create IP header for tunneling HIP packet through i3 */
|
||||
iph->ip_v = 4;
|
||||
iph->ip_hl = sizeof(struct ip) >> 2;
|
||||
iph->ip_tos = 0;
|
||||
iph->ip_len = htons(dglen); /* network byte order */
|
||||
iph->ip_id = 0; /* let IP set this */
|
||||
iph->ip_off = 0; /* frag offset, MF and DF flags */
|
||||
iph->ip_ttl = 200;
|
||||
iph->ip_p = 99;
|
||||
iph->ip_src = ((struct sockaddr_in *)src)->sin_addr;
|
||||
iph->ip_dst = ((struct sockaddr_in *)dst)->sin_addr;
|
||||
iph->ip_sum = in_cksum((unsigned short *)iph, sizeof (struct ip));
|
||||
|
||||
clb->data_len = dglen;
|
||||
|
||||
bzero(&id, ID_LEN);
|
||||
memcpy(&id, hit, HIT_SIZE);
|
||||
cl_set_private_id(&id);
|
||||
|
||||
/* exception when matching trigger not found */
|
||||
cl_register_callback(CL_CBK_TRIGGER_NOT_FOUND, no_matching_trigger, NULL);
|
||||
|
||||
printf("Responder's HIT for I3: ");
|
||||
print_hit((const hip_hit*) hit);
|
||||
printf("\n");
|
||||
printf_i3_id(&id, 2);
|
||||
|
||||
#ifdef HI3_DEBUG
|
||||
printf("Passing following packet of %d to i3\n", clb->data_len);
|
||||
for (i=0; i < clb->data_len; i++)
|
||||
printf("%.2x ", ((unsigned char *) clb->data)[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
cl_send(&id, clb, 0);
|
||||
cl_free_buf(clb);
|
||||
|
||||
return size;
|
||||
}
|
|
@ -2120,9 +2120,6 @@ void print_usage()
|
|||
printf(" -nr\t no retransmit mode (for testing)\n");
|
||||
printf(" -t <addr> manually trigger a HIP exchange with the ");
|
||||
printf("given address\n");
|
||||
#ifdef HIP_I3
|
||||
printf(" -i3\t enable Hi3: use i3 overlay for control packets\n");
|
||||
#endif /* HIP_I3 */
|
||||
printf(" -rvs\t rendezvous server mode\n");
|
||||
#ifdef MOBILE_ROUTER
|
||||
printf(" -mr\t mobile router mode\n");
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<I3ConfigFile version="0.1">
|
||||
<I3ServerDetails
|
||||
UsePing="false"
|
||||
UseTCP="false"
|
||||
ServerListURL="http://infrahip.hiit.fi/hi3_status.txt"
|
||||
>
|
||||
<!-- If UsePing is false, you have to make sure that
|
||||
this first hop i3 server is running. You can
|
||||
check the status of the i3 servers at
|
||||
http://i3.cs.berkeley.edu
|
||||
-->
|
||||
<I3Server
|
||||
IPAddress="169.229.50.7"
|
||||
PortNum="6613"
|
||||
I3Id="64d78d472bdc0b990a4e8bc1ac480565b44cd7fa"
|
||||
/>
|
||||
</I3ServerDetails>
|
||||
</I3ConfigFile>
|
Loading…
Reference in a new issue