diff options
author | Tobias Brunner <tobias@strongswan.org> | 2010-07-12 10:35:19 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2010-09-02 19:01:25 +0200 |
commit | 9f166d9ac20e493e772a384cecdf8badcabf35cb (patch) | |
tree | c8e003bde4ba27e3fe4848ad2c1cebda20c8a5e3 /src/libcharon/kernel/kernel_handler.c | |
parent | 9d94174242ad267429a46eda5d055ba450480a40 (diff) | |
download | strongswan-9f166d9ac20e493e772a384cecdf8badcabf35cb.tar.bz2 strongswan-9f166d9ac20e493e772a384cecdf8badcabf35cb.tar.xz |
Removed references to protocol_id_t from kernel interface.
Instead we use the actual IP protocol identifier (the conversion now happens in
child_sa_t and kernel_handler_t).
Diffstat (limited to 'src/libcharon/kernel/kernel_handler.c')
-rw-r--r-- | src/libcharon/kernel/kernel_handler.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/libcharon/kernel/kernel_handler.c b/src/libcharon/kernel/kernel_handler.c index 482f1494c..d863ca504 100644 --- a/src/libcharon/kernel/kernel_handler.c +++ b/src/libcharon/kernel/kernel_handler.c @@ -38,6 +38,22 @@ struct private_kernel_handler_t { }; +/** + * convert an IP protocol identifier to the IKEv2 specific protocol identifier. + */ +static inline protocol_id_t proto_ip2ike(u_int8_t protocol) +{ + switch (protocol) + { + case IPPROTO_ESP: + return PROTO_ESP; + case IPPROTO_AH: + return PROTO_AH; + default: + return protocol; + } +} + METHOD(kernel_listener_t, acquire, bool, private_kernel_handler_t *this, u_int32_t reqid, traffic_selector_t *src_ts, traffic_selector_t *dst_ts) @@ -58,20 +74,21 @@ METHOD(kernel_listener_t, acquire, bool, } METHOD(kernel_listener_t, expire, bool, - private_kernel_handler_t *this, u_int32_t reqid, protocol_id_t protocol, + private_kernel_handler_t *this, u_int32_t reqid, u_int8_t protocol, u_int32_t spi, bool hard) { job_t *job; + protocol_id_t proto = proto_ip2ike(protocol); DBG1(DBG_KNL, "creating %s job for %N CHILD_SA with SPI %.8x " "and reqid {%u}", hard ? "delete" : "rekey", - protocol_id_names, protocol, ntohl(spi), reqid); + protocol_id_names, proto, ntohl(spi), reqid); if (hard) { - job = (job_t*)delete_child_sa_job_create(reqid, protocol, spi); + job = (job_t*)delete_child_sa_job_create(reqid, proto, spi); } else { - job = (job_t*)rekey_child_sa_job_create(reqid, protocol, spi); + job = (job_t*)rekey_child_sa_job_create(reqid, proto, spi); } hydra->processor->queue_job(hydra->processor, job); return TRUE; |