[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 04042) Add type two routing header through XFRM in NEPL
- To: usagi-users@xxxxxxxxxxxxxx
- Subject: (usagi-users 04042) Add type two routing header through XFRM in NEPL
- From: Matthew Jakeman <m.jakeman@xxxxxxxxxxxxxxx>
- Date: Fri, 25 Apr 2008 13:42:06 +0100
- Organization: Lancaster University
- Reply-to: m.jakeman@xxxxxxxxxxxxxxx
- User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)
Hi all,
I have been trying to add a type two routing header to all traffic forwarded
through a MR in xfrm.c in the NEPL code.
As XFRM seems to not be well documented, I have been piecing together bits and
pieces from xfrm.c to try and get this working.
The code I have so far is as follows (called in process_first_home_bu() in
mn.c):
void xfrm_rh2_add(struct bulentry *bul)
{
struct xfrm_selector sel;
struct xfrm_user_tmpl tmpl;
int prio = 2;
int update = 0;
struct in6_addr src ;
inet_pton(AF_INET6, "2001:db40::", &src) ;
set_selector(&in6addr_any, &src, 0, 0, 0, 0, &sel) ;
sel.prefixlen_s = 64;
create_rh_tmpl(&tmpl) ;
if(xfrm_mip_policy_add(&sel, 0, XFRM_POLICY_FWD, XFRM_POLICY_ALLOW,
MIP6_PRIO_RO_DATA_ANY, &tmpl, 1))
return -1;
if(xfrm_state_add(&sel, IPPROTO_ROUTING, &bul->coa, 0, 0))
printf("Failed to add XFRM State for RRH\n") ;
}
The policy and state are both being inserted, and if I change
XFRM_POLICY_ALLOW to XFRM_POLICY_BLOCK in xfrm_mip_policy_add() then it
effectively drops all packets from any 2001:db40::/64 address. From what I
have gathered I expected this function to add a type 2 routing header to any
packets from that prefix but it does not.
Any help on this would be hugely appreciated.
Cheers
Matthew Jakeman