Re: [exim] Decimal IP Calculation

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Phil White
Date:  
À: exim-users
Sujet: Re: [exim] Decimal IP Calculation
On Sun, 9 Dec 2007 05:45:10 -0800
Phil Pennock <exim-users@???> wrote:

> > 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.
>
> 32-bit arithmetic, signed. I suspect you knew that ...


Yep.

> > Is there another way I can achieve the desired effect?
>
> Use an embedded Perl interpreter, returning a string? I don't see
> that you'll be using the result directly within Exim, so a string
> should be fine, right? Math::BigInt, perhaps via Net::IP.
>
> A bit heavyweight though. What do you need this value in decimal for?


warn
  message       = X-Info: Return = \
                     ${lookup mysql { SELECT value FROM system WHERE \
                              ip_addr=$acl_c5 } \ {$value}{0} \
                      }


Database that I am trying to access stores as decimal IP, and it is
going to be a pain to change

Cheers.
Phil