diff options
author | Yves-Alexis Perez <corsac@corsac.net> | 2012-06-28 21:16:07 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@corsac.net> | 2012-06-28 21:16:07 +0200 |
commit | b34738ed08c2227300d554b139e2495ca5da97d6 (patch) | |
tree | 62f33b52820f2e49f0e53c0f8c636312037c8054 /src/dumm/ext | |
parent | 0a9d51a49042a68daa15b0c74a2b7f152f52606b (diff) | |
download | vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.tar.gz vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.zip |
Imported Upstream version 4.6.4
Diffstat (limited to 'src/dumm/ext')
-rw-r--r-- | src/dumm/ext/dumm.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dumm/ext/dumm.c b/src/dumm/ext/dumm.c index a9c7cb8bd..ca9b29388 100644 --- a/src/dumm/ext/dumm.c +++ b/src/dumm/ext/dumm.c @@ -594,21 +594,22 @@ static VALUE iface_add_addr(VALUE self, VALUE name) { iface_t *iface; host_t *addr; + int bits; - addr = host_create_from_string(StringValuePtr(name), 0); + addr = host_create_from_subnet(StringValuePtr(name), &bits); if (!addr) { rb_raise(rb_eArgError, "invalid IP address"); } Data_Get_Struct(self, iface_t, iface); - if (!iface->add_address(iface, addr)) + if (!iface->add_address(iface, addr, bits)) { addr->destroy(addr); rb_raise(rb_eRuntimeError, "adding address failed"); } if (rb_block_given_p()) { rb_yield(self); - iface->delete_address(iface, addr); + iface->delete_address(iface, addr, bits); } addr->destroy(addr); return self; @@ -647,21 +648,22 @@ static VALUE iface_del_addr(VALUE self, VALUE vaddr) { iface_t *iface; host_t *addr; + int bits; - addr = host_create_from_string(StringValuePtr(vaddr), 0); + addr = host_create_from_subnet(StringValuePtr(vaddr), &bits); if (!addr) { rb_raise(rb_eArgError, "invalid IP address"); } Data_Get_Struct(self, iface_t, iface); - if (!iface->delete_address(iface, addr)) + if (!iface->delete_address(iface, addr, bits)) { addr->destroy(addr); rb_raise(rb_eRuntimeError, "address not found"); } if (rb_block_given_p()) { rb_yield(self); - iface->add_address(iface, addr); + iface->add_address(iface, addr, bits); } addr->destroy(addr); return self; |