diff options
| author | Martin Willi <martin@revosec.ch> | 2011-12-05 16:14:52 +0100 |
|---|---|---|
| committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:31:12 +0100 |
| commit | caa6f772c817cffce3ee5128a9e675bb873a5c73 (patch) | |
| tree | 480d6fc7bea45d00100d7c7e2cd14951b98dfedd /src/libcharon/encoding | |
| parent | bd8700f0553e23f9301e1d13e2a21166dde65a88 (diff) | |
| download | strongswan-caa6f772c817cffce3ee5128a9e675bb873a5c73.tar.bz2 strongswan-caa6f772c817cffce3ee5128a9e675bb873a5c73.tar.xz | |
Added missing break;s when converting ID_IP_ADDRESS types to ts, extracted function
Diffstat (limited to 'src/libcharon/encoding')
| -rwxr-xr-x | src/libcharon/encoding/payloads/id_payload.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libcharon/encoding/payloads/id_payload.c b/src/libcharon/encoding/payloads/id_payload.c index fe8918861..2d27021a3 100755 --- a/src/libcharon/encoding/payloads/id_payload.c +++ b/src/libcharon/encoding/payloads/id_payload.c @@ -270,6 +270,16 @@ static traffic_selector_t *get_ts_from_subnet(private_id_payload_t *this, net, this->port, netmask, this->port ?: 65535); } +/** + * Create a traffic selector from an IP ID + */ +static traffic_selector_t *get_ts_from_ip(private_id_payload_t *this, + ts_type_t type) +{ + return traffic_selector_create_from_bytes(this->protocol_id, type, + this->id_data, this->port, this->id_data, this->port ?: 65535); +} + METHOD(id_payload_t, get_ts, traffic_selector_t*, private_id_payload_t *this) { @@ -300,23 +310,17 @@ METHOD(id_payload_t, get_ts, traffic_selector_t*, } break; case ID_IPV4_ADDR: - { if (this->id_data.len == 4) { - return traffic_selector_create_from_bytes(this->protocol_id, - TS_IPV4_ADDR_RANGE, this->id_data, this->port, - this->id_data, this->port ?: 65535); + return get_ts_from_ip(this, TS_IPV4_ADDR_RANGE); } - } + break; case ID_IPV6_ADDR: - { if (this->id_data.len == 16) { - return traffic_selector_create_from_bytes(this->protocol_id, - TS_IPV4_ADDR_RANGE, this->id_data, this->port, - this->id_data, this->port ?: 65535); + return get_ts_from_ip(this, TS_IPV6_ADDR_RANGE); } - } + break; default: break; } |
