Asterisk - The Open Source Telephony Project
18.5.0
|
Various sorts of access control. More...
#include "asterisk.h"
#include "asterisk/network.h"
#include <ifaddrs.h>
#include "asterisk/acl.h"
#include "asterisk/channel.h"
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/srv.h"
#include "asterisk/cli.h"
Go to the source code of this file.
Data Structures | |
struct | dscp_codepoint |
Functions | |
static int | acl_new (struct ast_acl **pointer, const char *name) |
static struct ast_ha * | append_ha_core (const char *sense, const char *stuff, struct ast_ha *path, int *error, int port_flags) |
int | ast_acl_list_is_empty (struct ast_acl_list *acl_list) |
Determines if an ACL is empty or if it contains entries. More... | |
void | ast_acl_output (int fd, struct ast_acl_list *acl_list, const char *prefix) |
output an ACL to the provided fd More... | |
void | ast_append_acl (const char *sense, const char *stuff, struct ast_acl_list **path, int *error, int *named_acl_flag) |
Add a rule to an ACL struct. More... | |
struct ast_ha * | ast_append_ha (const char *sense, const char *stuff, struct ast_ha *path, int *error) |
Add a new rule to a list of HAs. More... | |
struct ast_ha * | ast_append_ha_with_port (const char *sense, const char *stuff, struct ast_ha *path, int *error) |
Add a new rule with optional port to a list of HAs. More... | |
enum ast_acl_sense | ast_apply_acl (struct ast_acl_list *acl_list, const struct ast_sockaddr *addr, const char *purpose) |
Apply a set of rules to a given IP address. More... | |
static enum ast_acl_sense | ast_apply_acl_internal (struct ast_acl_list *acl_list, const struct ast_sockaddr *addr, const char *log_prefix) |
enum ast_acl_sense | ast_apply_acl_nolog (struct ast_acl_list *acl_list, const struct ast_sockaddr *addr) |
Apply a set of rules to a given IP address, don't log failure. More... | |
enum ast_acl_sense | ast_apply_ha (const struct ast_ha *ha, const struct ast_sockaddr *addr) |
Apply a set of rules to a given IP address. More... | |
void | ast_copy_ha (const struct ast_ha *from, struct ast_ha *to) |
Copy the contents of one HA to another. More... | |
struct ast_acl_list * | ast_duplicate_acl_list (struct ast_acl_list *original) |
Duplicates the contests of a list of lists of host access rules. More... | |
static struct ast_ha * | ast_duplicate_ha (struct ast_ha *original) |
struct ast_ha * | ast_duplicate_ha_list (struct ast_ha *original) |
Duplicate the contents of a list of host access rules. More... | |
int | ast_find_ourip (struct ast_sockaddr *ourip, const struct ast_sockaddr *bindaddr, int family) |
Find our IP address. More... | |
struct ast_acl_list * | ast_free_acl_list (struct ast_acl_list *acl_list) |
Free a list of ACLs. More... | |
void | ast_free_ha (struct ast_ha *ha) |
Free a list of HAs. More... | |
int | ast_get_ip (struct ast_sockaddr *addr, const char *hostname) |
Get the IP address given a hostname. More... | |
int | ast_get_ip_or_srv (struct ast_sockaddr *addr, const char *hostname, const char *service) |
Get the IP address given a hostname and optional service. More... | |
void | ast_ha_join (const struct ast_ha *ha, struct ast_str **buf) |
Convert HAs to a comma separated string value. More... | |
void | ast_ha_join_cidr (const struct ast_ha *ha, struct ast_str **buf) |
Convert HAs to a comma separated string value using CIDR notation. More... | |
void | ast_ha_output (int fd, const struct ast_ha *ha, const char *prefix) |
output an HA to the provided fd More... | |
int | ast_ouraddrfor (const struct ast_sockaddr *them, struct ast_sockaddr *us) |
Get our local IP address when contacting a remote host. More... | |
int | ast_str2cos (const char *value, unsigned int *cos) |
Convert a string to the appropriate COS value. More... | |
int | ast_str2tos (const char *value, unsigned int *tos) |
Convert a string to the appropriate TOS value. More... | |
const char * | ast_tos2str (unsigned int tos) |
Convert a TOS value into its string representation. More... | |
static void | debug_ha_sense_appended (struct ast_ha *ha) |
static int | get_local_address (struct ast_sockaddr *ourip) |
static int | parse_cidr_mask (struct ast_sockaddr *addr, int is_v4, const char *mask_str) |
Parse a netmask in CIDR notation. More... | |
static int | resolve_first (struct ast_sockaddr *addr, const char *name, int flag, int family) |
static void | score_address (const struct sockaddr_in *sin, struct in_addr *best_addr, int *best_score) |
Variables | |
static const struct dscp_codepoint | dscp_pool1 [] |
Various sorts of access control.
Definition in file acl.c.
|
static |
Definition at line 305 of file acl.c.
References ast_acl::acl, ACL_NAME_LENGTH, ast_calloc, ast_copy_string(), and ast_acl::name.
Referenced by ast_append_acl(), and ast_duplicate_acl_list().
|
static |
Definition at line 576 of file acl.c.
References ast_ha::addr, ast_calloc, ast_free_ha(), ast_log, AST_SENSE_ALLOW, AST_SENSE_DENY, ast_sockaddr_apply_netmask(), ast_sockaddr_ipv4_mapped(), ast_sockaddr_is_ipv4(), ast_sockaddr_parse(), ast_sockaddr_port, ast_sockaddr_set_port, ast_sockaddr_stringify(), ast_strdupa, DEBUG_ATLEAST, debug_ha_sense_appended(), LOG_NOTICE, LOG_WARNING, ast_ha::netmask, ast_ha::next, NULL, parse_cidr_mask(), PARSE_PORT_FORBID, PARSE_PORT_MASK, ast_ha::sense, strsep(), and tmp().
Referenced by ast_append_ha(), and ast_append_ha_with_port().
int ast_acl_list_is_empty | ( | struct ast_acl_list * | acl_list | ) |
Determines if an ACL is empty or if it contains entries.
acl_list | The ACL list being checked |
0 | - the list is not empty |
1 | - the list is empty |
Definition at line 541 of file acl.c.
References AST_LIST_FIRST, AST_LIST_LOCK, and AST_LIST_UNLOCK.
Referenced by _sip_show_peer(), _sip_show_peers_one(), acl_to_str(), apply_acl(), apply_contact_acl(), apply_endpoint_acl(), apply_endpoint_contact_acl(), contact_acl_to_str(), handle_cli_iax2_show_peer(), handle_cli_iax2_show_users(), handle_showmanager(), sip_show_user(), and sip_show_users().
void ast_acl_output | ( | int | fd, |
struct ast_acl_list * | acl, | ||
const char * | prefix | ||
) |
output an ACL to the provided fd
This function can be used centrally to output HAs as used in ACLs from other modules. It follows the format as originally used for named ACLs in named_acl.c.
fd | The file-descriptor to which to output the ACL. |
acl | The ACL to output. |
prefix | If you need a specific prefix output on each line, give it here, may be NULL. |
Definition at line 1099 of file acl.c.
References ast_acl::acl, ast_cli(), ast_ha_output(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero, ast_acl::is_realtime, ast_acl::list, and ast_acl::name.
Referenced by handle_showmanager().
void ast_append_acl | ( | const char * | sense, |
const char * | stuff, | ||
struct ast_acl_list ** | path, | ||
int * | error, | ||
int * | named_acl_flag | ||
) |
Add a rule to an ACL struct.
This adds a named ACL or an ACL rule to an ast_acl container. It works in a similar way to ast_append_ha.
sense | Can be any among "permit", "deny", or "acl" this controls whether the rule being added will simply modify the unnamed ACL at the head of the list or if a new named ACL will be added to that ast_acl. | |
stuff | If sense is 'permit'/'deny', this is the ip address and subnet mask separated with a '/' like in ast_append ha. If it sense is 'acl', then this will be the name of the ACL being appended to the container. | |
path | Address of the ACL list being appended | |
[out] | error | The int that error points to will be set to 1 if an error occurs. |
[out] | named_acl_flag | This will raise a flag under certain conditions to indicate that a named ACL has been added by this operation. This may be used to indicate that an event subscription should be made against the named ACL subsystem. Note: This flag may be raised by this function, but it will never be lowered by it. |
Definition at line 430 of file acl.c.
References ast_acl::acl, acl_new(), ast_append_ha(), ast_calloc, AST_LIST_FIRST, AST_LIST_HEAD_INIT, AST_LIST_INSERT_HEAD, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_named_acl_find(), ast_skip_blanks(), ast_strdupa, ast_strlen_zero, ast_acl::is_invalid, ast_acl::is_realtime, LOG_ERROR, ast_acl::name, NULL, strsep(), and tmp().
Referenced by __init_manager(), acl_handler(), build_peer(), build_user(), endpoint_acl_handler(), reload_config(), and rtp_reload().
struct ast_ha* ast_append_ha | ( | const char * | sense, |
const char * | stuff, | ||
struct ast_ha * | path, | ||
int * | error | ||
) |
Add a new rule to a list of HAs.
This adds the new host access rule to the end of the list whose head is specified by the path parameter. Rules are evaluated in a way such that if multiple rules apply to a single IP address/subnet mask, then the rule latest in the list will be used.
sense | Either "permit" or "deny" (Actually any 'p' word will result in permission, and any other word will result in denial) | |
stuff | The IP address and subnet mask, separated with a '/'. The subnet mask can either be in dotted-decimal format or in CIDR notation (i.e. 0-32). | |
path | The head of the HA list to which we wish to append our new rule. If NULL is passed, then the new rule will become the head of the list | |
[out] | error | The integer error points to will be set non-zero if an error occurs |
Definition at line 713 of file acl.c.
References append_ha_core(), and PARSE_PORT_FORBID.
Referenced by acl_handler_fn(), add_calltoken_ignore(), ast_append_acl(), AST_TEST_DEFINE(), build_callno_limits(), build_device(), build_gateway(), build_ha(), config_parse_variables(), named_acl_find_realtime(), reload_config(), and transport_localnet_handler().
struct ast_ha* ast_append_ha_with_port | ( | const char * | sense, |
const char * | stuff, | ||
struct ast_ha * | path, | ||
int * | error | ||
) |
Add a new rule with optional port to a list of HAs.
This adds the new host access rule to the end of the list whose head is specified by the path parameter. Rules are evaluated in a way such that if multiple rules apply to a single IP address/subnet mask, then the rule latest in the list will be used.
sense | Either "permit" or "deny" (Actually any 'p' word will result in permission, and any other word will result in denial) | |
stuff | The IP address and subnet mask, separated with a '/'. The subnet mask can either be in dotted-decimal format or in CIDR notation (i.e. 0-32). A port can be provided by placing it after the IP address, separated with a ':'. | |
path | The head of the HA list to which we wish to append our new rule. If NULL is passed, then the new rule will become the head of the list | |
[out] | error | The integer error points to will be set non-zero if an error occurs |
Definition at line 718 of file acl.c.
References append_ha_core().
Referenced by ip_identify_match_handler(), ip_identify_match_host_lookup(), and pjsip_enable_logger_host().
enum ast_acl_sense ast_apply_acl | ( | struct ast_acl_list * | acl_list, |
const struct ast_sockaddr * | addr, | ||
const char * | purpose | ||
) |
Apply a set of rules to a given IP address.
Similar to the above, only uses an acl container, which is a whole slew of ast_ha lists. It runs ast_apply_ha on each of the ast_ha structs contained in the acl container. It will deny if any of the ast_ha lists fail, and it will pass only if all of the rules pass.
acl_list | The head of the list of ACLs to evaluate |
addr | An ast_sockaddr whose address is considered when matching rules |
purpose | Context for which the ACL is being applied - Establishes purpose of a notice when rejected |
AST_SENSE_ALLOW | The IP address passes our ACLs |
AST_SENSE_DENY | The IP address fails our ACLs |
Definition at line 800 of file acl.c.
References ast_apply_acl_internal().
Referenced by apply_acl(), apply_contact_acl(), apply_endpoint_acl(), apply_endpoint_contact_acl(), auth_http_callback(), authenticate(), check_access(), check_peer_ok(), parse_register_contact(), register_verify(), and sip_allow_anyrtp_remote().
|
static |
Definition at line 758 of file acl.c.
References ast_acl::acl, ast_apply_ha(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, AST_SENSE_ALLOW, AST_SENSE_DENY, ast_sockaddr_stringify_addr(), ast_strlen_zero, ast_acl::is_invalid, ast_acl::list, LOG_NOTICE, LOG_WARNING, and ast_acl::name.
Referenced by ast_apply_acl(), and ast_apply_acl_nolog().
enum ast_acl_sense ast_apply_acl_nolog | ( | struct ast_acl_list * | acl_list, |
const struct ast_sockaddr * | addr | ||
) |
Apply a set of rules to a given IP address, don't log failure.
Exactly like ast_apply_acl, except that it will never log anything.
acl_list | The head of the list of ACLs to evaluate |
addr | An ast_sockaddr whose address is considered when matching rules |
AST_SENSE_ALLOW | The IP address passes our ACLs |
AST_SENSE_DENY | The IP address fails our ACLs |
Definition at line 804 of file acl.c.
References ast_apply_acl_internal(), and NULL.
Referenced by rtp_address_is_ice_blacklisted(), and stun_address_is_blacklisted().
enum ast_acl_sense ast_apply_ha | ( | const struct ast_ha * | ha, |
const struct ast_sockaddr * | addr | ||
) |
Apply a set of rules to a given IP address.
The list of host access rules is traversed, beginning with the input rule. If the IP address given matches a rule, the "sense" of that rule is used as the return value. Note that if an IP address matches multiple rules that the last one matched will be the one whose sense will be returned.
ha | The head of the list of host access rules to follow |
addr | An ast_sockaddr whose address is considered when matching rules |
AST_SENSE_ALLOW | The IP address passes our ACL |
AST_SENSE_DENY | The IP address fails our ACL |
Definition at line 808 of file acl.c.
References ast_ha::addr, ast_copy_string(), ast_debug, ast_log, AST_SENSE_ALLOW, ast_sockaddr_apply_netmask(), ast_sockaddr_cmp_addr(), ast_sockaddr_ipv4_mapped(), ast_sockaddr_is_ipv4(), ast_sockaddr_is_ipv4_mapped(), ast_sockaddr_is_ipv6(), ast_sockaddr_port, ast_sockaddr_set_port, ast_sockaddr_stringify(), LOG_ERROR, ast_ha::netmask, ast_ha::next, and ast_ha::sense.
Referenced by ast_apply_acl_internal(), ast_sip_ouraddrfor(), AST_TEST_DEFINE(), ip_identify_match_check(), ip_identify_match_host_lookup(), pjsip_log_test_addr(), and skinny_register().
Copy the contents of one HA to another.
This copies the internals of the 'from' HA to the 'to' HA. It is important that the 'to' HA has been allocated prior to calling this function
from | Source HA to copy |
to | Destination HA to copy to |
void |
Definition at line 255 of file acl.c.
References ast_ha::addr, ast_sockaddr_copy(), ast_ha::netmask, and ast_ha::sense.
Referenced by add_calltoken_ignore(), ast_duplicate_ha(), and build_callno_limits().
struct ast_acl_list* ast_duplicate_acl_list | ( | struct ast_acl_list * | original | ) |
Duplicates the contests of a list of lists of host access rules.
A deep copy of an ast_acl list is made (which in turn means a deep copy of each of the ast_ha structs contained within). The returned value is allocated on the heap and must be freed independently of the input paramater when finished.
original | The ast_acl_list to copy |
The | new duplicated ast_acl_list |
Definition at line 316 of file acl.c.
References ast_acl::acl, acl_new(), ast_calloc, ast_duplicate_ha_list(), ast_free_acl_list(), AST_LIST_HEAD_INIT, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_acl::is_invalid, ast_acl::is_realtime, ast_acl::list, LOG_ERROR, ast_acl::name, and NULL.
Referenced by create_addr_from_peer(), and sip_allow_anyrtp_remote().
Definition at line 263 of file acl.c.
References ast_calloc, and ast_copy_ha().
Referenced by ast_duplicate_ha_list().
Duplicate the contents of a list of host access rules.
A deep copy of all ast_has in the list is made. The returned value is allocated on the heap and must be freed independently of the input parameter when finished.
original | The ast_ha to copy |
The | head of the list of duplicated ast_has |
Definition at line 277 of file acl.c.
References ast_duplicate_ha(), ast_free_ha(), ast_ha::next, and NULL.
Referenced by ast_duplicate_acl_list(), and ast_named_acl_find().
int ast_find_ourip | ( | struct ast_sockaddr * | ourip, |
const struct ast_sockaddr * | bindaddr, | ||
int | family | ||
) |
Find our IP address.
This function goes through many iterations in an attempt to find our IP address. If any step along the way should fail, we move to the next item in the list. Here are the steps taken:
[out] | ourip | Our IP address is written here when it is found |
bindaddr | A hint used for finding our IP. See the steps above for more details | |
family | Only addresses of the given family will be returned. Use 0 or AST_SOCKADDR_UNSPEC to get addresses of all families. |
0 | Success |
-1 | Failure |
Definition at line 1052 of file acl.c.
References ast_debug, ast_log, ast_ouraddrfor(), ast_sockaddr_copy(), ast_sockaddr_is_any(), ast_sockaddr_port, ast_sockaddr_set_port, get_local_address(), LOG_WARNING, MAXHOSTNAMELEN, ourhost, PARSE_PORT_FORBID, and resolve_first().
Referenced by ast_rtp_prop_set(), and reload_config().
struct ast_acl_list* ast_free_acl_list | ( | struct ast_acl_list * | acl | ) |
Free a list of ACLs.
Given the head of a list of ast_acl structs, it and all appended acl structs will be freed. This includes the ast_ha structs within the individual nodes.
acl | The list of ACLs to free |
NULL |
Definition at line 233 of file acl.c.
References ast_acl::acl, ast_free, ast_free_ha(), AST_LIST_HEAD_DESTROY, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_acl::list, and NULL.
Referenced by __init_manager(), acl_destroy(), ast_duplicate_acl_list(), build_peer(), build_user(), endpoint_destructor(), manager_free_user(), peer_destructor(), reload_config(), rtp_reload(), rtp_unload_acl(), sip_allow_anyrtp_remote(), sip_destroy_peer(), sip_pvt_dtor(), unload_module(), and user_destructor().
void ast_free_ha | ( | struct ast_ha * | ha | ) |
Free a list of HAs.
Given the head of a list of HAs, it and all appended HAs are freed
ha | The head of the list of HAs to free |
void |
Definition at line 222 of file acl.c.
References ast_free, and ast_ha::next.
Referenced by add_calltoken_ignore(), append_ha_core(), ast_duplicate_ha_list(), ast_free_acl_list(), AST_TEST_DEFINE(), build_callno_limits(), destroy_gateway(), destroy_named_acl(), destroy_sip_transport_state(), ip_identify_destroy(), named_acl_find_realtime(), pjsip_disable_logger(), pjsip_enable_logger_host(), pjsip_logger_session_destroy(), reload_config(), test_item_destructor(), transport_localnet_handler(), and unload_module().
int ast_get_ip | ( | struct ast_sockaddr * | addr, |
const char * | hostname | ||
) |
Get the IP address given a hostname.
Similar in nature to ast_gethostbyname, except that instead of getting an entire hostent structure, you instead are given only the IP address inserted into a ast_sockaddr structure.
addr | The IP address found. The address family is used as an input parameter to filter the returned addresses. If it is AST_AF_UNSPEC, both IPv4 and IPv6 addresses can be returned. |
hostname | The hostname to look up |
0 | Success |
-1 | Failure |
Definition at line 1000 of file acl.c.
References ast_get_ip_or_srv(), and NULL.
Referenced by build_gateway(), build_peer(), config_parse_variables(), peer_set_srcaddr(), setup_stunaddr(), and stun_monitor_request().
int ast_get_ip_or_srv | ( | struct ast_sockaddr * | addr, |
const char * | hostname, | ||
const char * | service | ||
) |
Get the IP address given a hostname and optional service.
If the service parameter is non-NULL, then an SRV lookup will be made by prepending the service to the hostname parameter, separated by a '.' For example, if hostname is "example.com" and service is "_sip._udp" then an SRV lookup will be done for "_sip._udp.example.com". If service is NULL, then this function acts exactly like a call to ast_get_ip.
addr | The IP address found. The address family is used as an input parameter to filter the returned addresses. If it is 0, both IPv4 and IPv6 addresses can be returned. |
hostname | The hostname to look up |
service | A specific service provided by the host. A NULL service results in an A-record lookup instead of an SRV lookup |
0 | Success |
-1 | Failure |
Definition at line 897 of file acl.c.
References ast_get_srv(), ast_sockaddr_set_port, host, NULL, PARSE_PORT_FORBID, resolve_first(), and ast_sockaddr::ss.
Referenced by ast_get_ip(), create_addr(), dnsmgr_refresh(), internal_dnsmgr_lookup(), and proxy_update().
Convert HAs to a comma separated string value.
ha | the starting ha head |
buf | string buffer to convert data to |
Definition at line 723 of file acl.c.
References ast_ha::addr, AST_SENSE_ALLOW, ast_sockaddr_port, ast_sockaddr_stringify(), ast_sockaddr_stringify_addr(), ast_str_append(), ast_ha::netmask, ast_ha::next, and ast_ha::sense.
Referenced by localnet_to_str(), and match_to_str().
Convert HAs to a comma separated string value using CIDR notation.
ha | the starting ha head |
buf | string buffer to convert data to |
Definition at line 745 of file acl.c.
References ast_ha::addr, AST_SENSE_ALLOW, ast_sockaddr_cidr_bits(), ast_sockaddr_stringify_addr(), ast_str_append(), ast_ha::netmask, ast_ha::next, and ast_ha::sense.
void ast_ha_output | ( | int | fd, |
const struct ast_ha * | ha, | ||
const char * | prefix | ||
) |
output an HA to the provided fd
This function can be used centrally to output HAs as used in ACLs from other modules. It follows the format as originally used for named ACLs in named_acl.c.
fd | The file-descriptor to which to output the HA. |
ha | The HA to output. |
prefix | If you need a specific prefix output on each line, give it here, may be NULL. |
Definition at line 1087 of file acl.c.
References ast_ha::addr, ast_cli(), AST_SENSE_ALLOW, AST_SOCKADDR_BUFLEN, ast_sockaddr_stringify_addr(), ast_ha::netmask, ast_ha::next, and ast_ha::sense.
Referenced by ast_acl_output(), and cli_display_named_acl().
int ast_ouraddrfor | ( | const struct ast_sockaddr * | them, |
struct ast_sockaddr * | us | ||
) |
Get our local IP address when contacting a remote host.
This function will attempt to connect(2) to them over UDP using a source port of 5060. If the connect(2) call is successful, then we inspect the sockaddr_in output parameter of connect(2) to determine the IP address used to connect to them. This IP address is then copied into us.
them | The IP address to which we wish to attempt to connect | |
[out] | us | The source IP address used to connect to them |
-1 | Failure |
0 | Success |
Definition at line 1005 of file acl.c.
References ast_connect(), ast_debug, ast_getsockname(), ast_log, ast_sockaddr_is_ipv6(), ast_sockaddr_port, ast_sockaddr_set_port, ast_sockaddr_stringify_addr(), ast_strdupa, errno, LOG_ERROR, and LOG_WARNING.
Referenced by ast_find_ourip(), ast_rtp_remote_address_set(), ast_sip_ouraddrfor(), build_gateway(), find_subchannel_and_lock(), sip_acf_channel_read(), and unicast_rtp_request().
int ast_str2cos | ( | const char * | value, |
unsigned int * | cos | ||
) |
Convert a string to the appropriate COS value.
value | The COS string to convert | |
[out] | cos | The integer representation of that COS value |
-1 | Failure |
0 | Success |
Definition at line 953 of file acl.c.
Referenced by config_parse_variables(), reload_config(), and set_config().
int ast_str2tos | ( | const char * | value, |
unsigned int * | tos | ||
) |
Convert a string to the appropriate TOS value.
value | The TOS string to convert | |
[out] | tos | The integer representation of that TOS value |
-1 | Failure |
0 | Success |
Definition at line 967 of file acl.c.
References ARRAY_LEN, dscp_codepoint::name, and dscp_codepoint::space.
Referenced by config_parse_variables(), iax_template_parse(), reload_config(), set_config(), tos_handler(), and transport_tos_handler().
const char* ast_tos2str | ( | unsigned int | tos | ) |
Convert a TOS value into its string representation.
tos | The TOS value to look up |
Definition at line 987 of file acl.c.
References ARRAY_LEN, dscp_codepoint::name, and dscp_codepoint::space.
Referenced by sip_show_settings().
|
static |
Definition at line 566 of file acl.c.
References ast_ha::addr, ast_log, ast_sockaddr_stringify(), ast_strdupa, LOG_DEBUG, ast_ha::netmask, and ast_ha::sense.
Referenced by append_ha_core().
|
static |
Definition at line 118 of file acl.c.
References ast_free, ast_malloc, ast_sockaddr_setnull(), buf, NULL, score_address(), and ast_sockaddr::ss.
Referenced by ast_find_ourip().
|
static |
Parse a netmask in CIDR notation.
For a mask of an IPv4 address, this should be a number between 0 and 32. For a mask of an IPv6 address, this should be a number between 0 and 128. This function creates an IPv6 ast_sockaddr from the given netmask. For masks of IPv4 addresses, this is accomplished by adding 96 to the original netmask.
[out] | addr | The ast_sockaddr produced from the CIDR netmask |
is_v4 | Tells if the address we are masking is IPv4. | |
mask_str | The CIDR mask to convert |
-1 | Failure |
0 | Success |
Definition at line 382 of file acl.c.
References ast_sockaddr_from_sin, ast_sockaddr::len, ast_sockaddr::ss, and V6_WORD.
Referenced by append_ha_core().
|
static |
Definition at line 876 of file acl.c.
References ast_debug, ast_free, ast_log, ast_sockaddr_copy(), ast_sockaddr_resolve(), and LOG_WARNING.
Referenced by ast_find_ourip(), and ast_get_ip_or_srv().
|
static |
Definition at line 59 of file acl.c.
References ast_inet_ntoa().
Referenced by get_local_address().
|
static |