diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-19 14:17:16 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-19 14:17:16 +0000 |
commit | ebd3af43fbc272034e175e362f843236f4ccd8e9 (patch) | |
tree | bcdc61e834bd23afa2615d4822441ca26b65b4f8 /include | |
parent | e544867c9a1eaf871452b73c088793d188fc8faf (diff) |
Make ACLs IPv6-capable.
ACLs can now be configured to match IPv6 networks. This is only
relevant for ACLs in chan_sip for now since other channel drivers
do not support IPv6 addressing. However, once those channel drivers
are outfitted to support IPv6 addressing, the ACLs will already be
ready for IPv6 support.
https://reviewboard.asterisk.org/r/791
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@277814 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/acl.h | 16 | ||||
-rw-r--r-- | include/asterisk/netsock2.h | 14 |
2 files changed, 22 insertions, 8 deletions
diff --git a/include/asterisk/acl.h b/include/asterisk/acl.h index 2c4f62051..a8c311cb2 100644 --- a/include/asterisk/acl.h +++ b/include/asterisk/acl.h @@ -46,11 +46,11 @@ extern "C" { * thing public and let users play with them. */ struct ast_ha { - /* Host access rule */ - struct in_addr netaddr; - struct in_addr netmask; - int sense; - struct ast_ha *next; + /* Host access rule */ + struct ast_sockaddr addr; + struct ast_sockaddr netmask; + int sense; + struct ast_ha *next; }; /*! @@ -111,11 +111,11 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha * the one whose sense will be returned. * * \param ha The head of the list of host access rules to follow - * \param sin A sockaddr_in whose address is considered when matching rules + * \param addr An ast_sockaddr whose address is considered when matching rules * \retval AST_SENSE_ALLOW The IP address passes our ACL * \retval AST_SENSE_DENY The IP address fails our ACL */ -int ast_apply_ha(struct ast_ha *ha, struct sockaddr_in *sin); +int ast_apply_ha(const struct ast_ha *ha, const struct ast_sockaddr *addr); /*! * \brief Get the IP address given a hostname @@ -186,7 +186,7 @@ int ast_ouraddrfor(const struct ast_sockaddr *them, struct ast_sockaddr *us); * \retval -1 Failure. address is filled with 0s * \retval 0 Success */ -int ast_lookup_iface(char *iface, struct in_addr *address); +int ast_lookup_iface(char *iface, struct ast_sockaddr *address); /*! * \brief Duplicate the contents of a list of host access rules diff --git a/include/asterisk/netsock2.h b/include/asterisk/netsock2.h index e7121cb94..b73d848a0 100644 --- a/include/asterisk/netsock2.h +++ b/include/asterisk/netsock2.h @@ -56,6 +56,20 @@ struct ast_sockaddr { }; /*! + * \brief + * Convert an IPv4-mapped IPv6 address into an IPv4 address. + * + * \warning You should rarely need this function. Only call this + * if you know what you're doing. + * + * \param addr The IPv4-mapped address to convert + * \param mapped_addr The resulting IPv4 address + * \retval 0 Unable to make the conversion + * \retval 1 Successful conversion + */ +int ast_sockaddr_ipv4_mapped(const struct ast_sockaddr *addr, struct ast_sockaddr *ast_mapped); + +/*! * \since 1.8 * * \brief |