[asterisk-bugs] [JIRA] (ASTERISK-23971) In pjsip.conf, match property of identify section does not allow subnet masks

Akinori Takigawa (JIRA) noreply at issues.asterisk.org
Tue Jul 1 02:27:56 CDT 2014


     [ https://issues.asterisk.org/jira/browse/ASTERISK-23971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Akinori Takigawa updated ASTERISK-23971:
----------------------------------------

    Description: 
When specifying any ip address with a subnet mask prepended on "match" property of identify section in pjsip.conf, asterisk logs on start up that it is not a valid ip address, thus failing to create identify object.

The document 
(https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Configuration_res_pjsip_endpoint_identifier_ip)
says "match" can have a subnet mask, 

but by briefly scanning the source code, 
(http://svn.asterisk.org/svn/asterisk/branches/12/res/res_pjsip_endpoint_identifier_ip.c)
ip_identify_match_handler() first checks the string provided by "match" by ast_sockaddr_resolve(), which does not accept ip addresses with subnet masks.

If the document is right, res_pjsip_endpoint_identifier_ip.c should be fixed to accept ip address(es) with subnet mask prepended.

Thanks in advance.

pjsip.conf sample -------------------------------
[mytrunk]
type=identify
endpoint=mytrunk
match=61.114.160.0/20

/var/log/asterisk/messages log on startup -------------------------------
[2014-07-01 14:58:41] ERROR[11999] netsock2.c: getaddrinfo("61.114.160.0/20", "(null)", ...): Name or service not known[2014-07-01 14:58:41] ERROR[11999] res_pjsip_endpoint_identifier_ip.c: Address '61.114.160.0/20' provided on ip endpoint identifier 'mytrunk' did not resolve to any address[2014-07-01 14:58:41] ERROR[11999] config_options.c: Error parsing match=61.114.160.0/20 at line 340 of
[2014-07-01 14:58:41] ERROR[11999] res_sorcery_config.c: Could not create an object of type 'identify' with id 'mytrunk' from configuration file 'pjsip.conf

  was:
When specifying any ip address with a subnet mask prepended on "match" property of identify section in pjsip.conf, asterisk logs on start up that it is not a valid ip address, thus failing to create identify object.

The document 
(https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Configuration_res_pjsip_endpoint_identifier_ip)
says "match" can have a subnet mask, 

but by briefly scanning the source code, 
(http://svn.asterisk.org/svn/asterisk/branches/12/res/res_pjsip_endpoint_identifier_ip.c)
ip_identify_match_handler() first checks the string provided by "match" by ast_sockaddr_resolve(), which does not accept ip addresses with subnet masks.

If the document is right, res_pjsip_endpoint_identifier_ip.c should be fixed to accept ip address(es) with subnet mask prepended.

Thanks in advance.

pjsip.conf sample -------------------------------
[mytrunk]
type=identify
endpoint=mytrunk
match=61.114.160.0/20

/var/log/asterisk/messages log on startup -------------------------------
[2014-07-01 14:58:41] ERROR[11999] netsock2.c: getaddrinfo("61.114.160.0/20,61.117.213.0/24,61.203.144.0/20,61.213.224.0/20,202.176.16.0/20,202.176.32.0/19,210.253.135.0/24,219.105.160.0/20", "(null)", ...): Name or service not known
[2014-07-01 14:58:41] ERROR[11999] res_pjsip_endpoint_identifier_ip.c: Address '61.114.160.0/20,61.117.213.0/24,61.203.144.0/20,61.213.224.0/20,202.176.16.0/20,202.176.32.0/19,210.253.135.0/24,219.105.160.0/20' provided on ip endpoint identifier 'mytrunk' did not resolve to any address
[2014-07-01 14:58:41] ERROR[11999] config_options.c: Error parsing match=61.114.160.0/20,61.117.213.0/24,61.203.144.0/20,61.213.224.0/20,202.176.16.0/20,202.176.32.0/19,210.253.135.0/24,219.105.160.0/20 at line 340 of
[2014-07-01 14:58:41] ERROR[11999] res_sorcery_config.c: Could not create an object of type 'identify' with id 'mytrunk' from configuration file 'pjsip.conf'


> In pjsip.conf, match property of identify section does not allow subnet masks
> -----------------------------------------------------------------------------
>
>                 Key: ASTERISK-23971
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23971
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip_endpoint_identifier_ip
>    Affects Versions: 12.2.0, 12.3.2
>         Environment: CentOS release 6.5
> 64bit
>            Reporter: Akinori Takigawa
>            Severity: Minor
>
> When specifying any ip address with a subnet mask prepended on "match" property of identify section in pjsip.conf, asterisk logs on start up that it is not a valid ip address, thus failing to create identify object.
> The document 
> (https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Configuration_res_pjsip_endpoint_identifier_ip)
> says "match" can have a subnet mask, 
> but by briefly scanning the source code, 
> (http://svn.asterisk.org/svn/asterisk/branches/12/res/res_pjsip_endpoint_identifier_ip.c)
> ip_identify_match_handler() first checks the string provided by "match" by ast_sockaddr_resolve(), which does not accept ip addresses with subnet masks.
> If the document is right, res_pjsip_endpoint_identifier_ip.c should be fixed to accept ip address(es) with subnet mask prepended.
> Thanks in advance.
> pjsip.conf sample -------------------------------
> [mytrunk]
> type=identify
> endpoint=mytrunk
> match=61.114.160.0/20
> /var/log/asterisk/messages log on startup -------------------------------
> [2014-07-01 14:58:41] ERROR[11999] netsock2.c: getaddrinfo("61.114.160.0/20", "(null)", ...): Name or service not known[2014-07-01 14:58:41] ERROR[11999] res_pjsip_endpoint_identifier_ip.c: Address '61.114.160.0/20' provided on ip endpoint identifier 'mytrunk' did not resolve to any address[2014-07-01 14:58:41] ERROR[11999] config_options.c: Error parsing match=61.114.160.0/20 at line 340 of
> [2014-07-01 14:58:41] ERROR[11999] res_sorcery_config.c: Could not create an object of type 'identify' with id 'mytrunk' from configuration file 'pjsip.conf



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list