[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Iptables+Ulog




> Hello debian-russian,
>      Не подскажите как заставить писать Ulog в MySQL ip_saddr и
>      ip_daddr  в нормальном виде, а не в фиг поймешь чем.
>      Т.е. что ы реаьно было видно ip-adress.
>      При сборке, ulog выловил интересную опцию,
>      --with-mysql-log-ip-as-string           log IPs as string rather than
as
>                                         unsigned long-integer.
>
>      Но собрать с ней не могу:
>
> gate:/tmp/ulogd-1.02#
./configure --with-mysql=/usr/local/mysql --with-mysql-log-ip-as-string
> [..skeep]
> checking for MySQL files... found mysql in /usr/local/mysql
> checking for mysql_real_escape_string support... found new MySQL
> configure: warning: the use of --with-mysql-log-ip-as-string is
discouraged
> creating ./config.status
> [..end]
>

Зачем оно тебе ? В MySQL есть такие функции, они тебе помогут в своей
программе получить адрес в нужном тебе виде. А работает поиск с integer
быстрее чем с char.

INET_NTOA(expr)

Given a numeric network address (4 or 8 byte), returns the dotted-quad
representation of the address as a string:


mysql> SELECT INET_NTOA(3520061480);
       ->  "209.207.224.40"

INET_ATON(expr)

Given the dotted-quad representation of a network address as a string,
returns an integer that represents the numeric value of the address.
Addresses may be 4 or 8 byte addresses:


mysql> SELECT INET_ATON("209.207.224.40");
       ->  3520061480

The generated number is always in network byte order; for example the above
number is calculated as 209*256^3 + 207*256^2 + 224*256 +40.

MySQL Reference Manual (C) 2002 MySQL AB

P.S. Сорри, дока у меня на английском, на сайте MySQL можешь найти то самое
на русском.



Reply to: