allow_trusted() function of permissions module doesn't work right with ipv6 addresses - it treats IP addresses as strings and doesn't take into account variations aaa:bbb::0 vs aaa:bbb:0:0:0:0:0:0.
Hello,
trusted does string comparison for the address field, it is not considered an ip address.
You should use address table instead if you just need matching on any ip address or subnet.
Cheers, Daniel
On 23/02/15 03:49, Sergey Okhapkin wrote:
allow_trusted() function of permissions module doesn't work right with ipv6 addresses - it treats IP addresses as strings and doesn't take into account variations aaa:bbb::0 vs aaa:bbb:0:0:0:0:0:0.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Address() functions are incompatible with mysql views/casts, reload_address_table() expects columns grp, mask and port to be type DB1_INT (mysql LONG) but views and casts always return column type LONGLONG (DB1_BIGINT). reload_address_table() always fail because of that.
On Monday 23 February 2015 09:53:08 Daniel-Constantin Mierla wrote:
Hello,
trusted does string comparison for the address field, it is not considered an ip address.
You should use address table instead if you just need matching on any ip address or subnet.
Cheers, Daniel
On 23/02/15 03:49, Sergey Okhapkin wrote:
allow_trusted() function of permissions module doesn't work right with ipv6 addresses - it treats IP addresses as strings and doesn't take into account variations aaa:bbb::0 vs aaa:bbb:0:0:0:0:0:0.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Interesting to learn that mysql views are not using same type as the source column...
I guess we should handle this case internally, doing views is quite common out there.
Cheers, Daniel
On 23/02/15 21:23, Sergey Okhapkin wrote:
Address() functions are incompatible with mysql views/casts, reload_address_table() expects columns grp, mask and port to be type DB1_INT (mysql LONG) but views and casts always return column type LONGLONG (DB1_BIGINT). reload_address_table() always fail because of that.
On Monday 23 February 2015 09:53:08 Daniel-Constantin Mierla wrote:
Hello,
trusted does string comparison for the address field, it is not considered an ip address.
You should use address table instead if you just need matching on any ip address or subnet.
Cheers, Daniel
On 23/02/15 03:49, Sergey Okhapkin wrote:
allow_trusted() function of permissions module doesn't work right with ipv6 addresses - it treats IP addresses as strings and doesn't take into account variations aaa:bbb::0 vs aaa:bbb:0:0:0:0:0:0.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
I think the problem is not in the source column type, but in casts. I found no way to create a view using existing table with "select cast(1 as unsigned) as grp" to return LONG. It always returns LONGLONG. I don't have concept of group in my DB schema and I don't need one, I just need to emulate the table structure kamailio expects.
On Monday 23 February 2015 23:34:12 you wrote:
Interesting to learn that mysql views are not using same type as the source column...
I guess we should handle this case internally, doing views is quite common out there.
Cheers, Daniel
On 23/02/15 21:23, Sergey Okhapkin wrote:
Address() functions are incompatible with mysql views/casts, reload_address_table() expects columns grp, mask and port to be type DB1_INT (mysql LONG) but views and casts always return column type LONGLONG (DB1_BIGINT). reload_address_table() always fail because of that.
On Monday 23 February 2015 09:53:08 Daniel-Constantin Mierla wrote:
Hello,
trusted does string comparison for the address field, it is not considered an ip address.
You should use address table instead if you just need matching on any ip address or subnet.
Cheers, Daniel
On 23/02/15 03:49, Sergey Okhapkin wrote:
allow_trusted() function of permissions module doesn't work right with ipv6 addresses - it treats IP addresses as strings and doesn't take into account variations aaa:bbb::0 vs aaa:bbb:0:0:0:0:0:0.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Looks like I found a solution:
create function toint(num int) returns int NO SQL begin return num; end;
select toint(1) as grp
returns LONG datatype.
On Monday 23 February 2015 17:42:30 Sergey Okhapkin wrote:
I think the problem is not in the source column type, but in casts. I found no way to create a view using existing table with "select cast(1 as unsigned) as grp" to return LONG. It always returns LONGLONG. I don't have concept of group in my DB schema and I don't need one, I just need to emulate the table structure kamailio expects.
On Monday 23 February 2015 23:34:12 you wrote:
Interesting to learn that mysql views are not using same type as the source column...
I guess we should handle this case internally, doing views is quite common out there.
Cheers, Daniel
On 23/02/15 21:23, Sergey Okhapkin wrote:
Address() functions are incompatible with mysql views/casts, reload_address_table() expects columns grp, mask and port to be type DB1_INT (mysql LONG) but views and casts always return column type LONGLONG (DB1_BIGINT). reload_address_table() always fail because of that.
On Monday 23 February 2015 09:53:08 Daniel-Constantin Mierla wrote:
Hello,
trusted does string comparison for the address field, it is not considered an ip address.
You should use address table instead if you just need matching on any ip address or subnet.
Cheers, Daniel
On 23/02/15 03:49, Sergey Okhapkin wrote:
allow_trusted() function of permissions module doesn't work right with ipv6 addresses - it treats IP addresses as strings and doesn't take into account variations aaa:bbb::0 vs aaa:bbb:0:0:0:0:0:0.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hi,
On Mon, Feb 23, 2015 at 11:34 PM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
Interesting to learn that mysql views are not using same type as the source column...
I guess we should handle this case internally, doing views is quite common out there.
Interesting to read that. And it reminds me, that we stumbled upon this years ago already. Back then we wanted to do avp_db_load from the usr_preferences table, which was a view in our scenario. Kamailio threw a type error in that case, too.
Best Regards, Sebastian
On Monday, February 23, 2015 09:53:08 AM Daniel-Constantin Mierla wrote:
trusted does string comparison for the address field, it is not considered an ip address.
You should use address table instead if you just need matching on any ip address or subnet.
That's interesting. Is there a reason for the string comparison? Reading the README, trusted and address functions look incredibly similar, except trusted can match proto, and the address commands can match ports. What would be the advantage or use case of using either trusted or address?
On 23/02/15 03:49, Sergey Okhapkin wrote:
allow_trusted() function of permissions module doesn't work right with ipv6 addresses - it treats IP addresses as strings and doesn't take into account variations aaa:bbb::0 vs aaa:bbb:0:0:0:0:0:0.
On 24/02/15 00:05, Anthony Messina wrote:
On Monday, February 23, 2015 09:53:08 AM Daniel-Constantin Mierla wrote:
trusted does string comparison for the address field, it is not considered an ip address.
You should use address table instead if you just need matching on any ip address or subnet.
That's interesting. Is there a reason for the string comparison? Reading the README, trusted and address functions look incredibly similar, except trusted can match proto, and the address commands can match ports. What would be the advantage or use case of using either trusted or address?
I am not the developer of that function and haven't used it for a while. IIRC, it was added like 2003-2004 and kept being so. I use address table as it has more features in matching subnets and does pre-compilation of ip addresses, thus is fast.
If someone provides a patch for doing ip-based comparison for trusted table, it will be accepted. The C helper functions are available, so the patch should not be big (ipops module can be used as example of C code for comparing ip addresses). Cheers, Daniel
On Tuesday, February 24, 2015 12:35:54 Daniel-Constantin Mierla wrote:
On 24/02/15 00:05, Anthony Messina wrote:
On Monday, February 23, 2015 09:53:08 AM Daniel-Constantin Mierla wrote:
trusted does string comparison for the address field, it is not considered an ip address.
You should use address table instead if you just need matching on any ip address or subnet.
That's interesting. Is there a reason for the string comparison? Reading the README, trusted and address functions look incredibly similar, except trusted can match proto, and the address commands can match ports. What would be the advantage or use case of using either trusted or address?
I am not the developer of that function and haven't used it for a while. IIRC, it was added like 2003-2004 and kept being so. I use address table as it has more features in matching subnets and does pre-compilation of ip addresses, thus is fast.
If someone provides a patch for doing ip-based comparison for trusted table, it will be accepted. The C helper functions are available, so the patch should not be big (ipops module can be used as example of C code for comparing ip addresses). Cheers, Daniel
Understood. I am using the address table as well for that very reason. I just didn't know if it was an *intentional* difference. Thanks. -A