Re: [exim] Decimal IP Calculation

Top Page
Delete this message
Reply to this message
Author: W B Hacker
Date:  
To: exim users
Subject: Re: [exim] Decimal IP Calculation
Phil White wrote:
> Hi.
>
> I'm trying to store the DECIMAL IP address of a connecting host in
> $acl_c*. Do do this, I'm using the following:
>
> set acl_c5    = ${eval10: \
>                         (${extract {1}{.}{$sender_host_address}}<<24) \
>                       + (${extract {2}{.}{$sender_host_address}}<<16) \
>                       + (${extract {3}{.}{$sender_host_address}}<<8) \
>                       +  ${extract {4}{.}{$sender_host_address}} \
>                    }

>
> Which, sadly, doesn't work quite as expected:
> dotquad addr = 131.111.8.192
> decimal addr = -2089875264
> which means approximately 50% of my mail is not being flagged correctly.
>
> Is there another way I can achieve the desired effect?
>
> Cheers,
>
> Phil
>

You are aware that Exim has expansion variables that natively handle IP, AND
search/lookup types that are specific to such as well?

Not to mention similar features in - to name one - PostgreSQL.

What is it that is driving you to need to do conversion *at all*?

Bill