[Pdns-users] Split Horizon Scripts

Erik Weber twiztar at gmail.com
Mon Nov 14 21:28:31 UTC 2011


On Mon, Nov 14, 2011 at 9:55 PM, Daniel L. Miller <dmiller at amfes.com> wrote:
> On 11/14/2011 11:55 AM, Daniel L. Miller wrote:
>>
>> Are any of these scripts, and instructions for their use, available?
>>
> Ok - further googling and examination of the wiki gave me a starting point.
>  I've got it working but for two of my domains - the others work correctly.
>  Can you tell me what's broken?  The two domains that don't seem to work are
> "lv-mircom.us" and "lv-firealarm.us".
>
> function preresolve ( requestorip, domain, qtype )
>    if string.find( domain, "amfes.com." ) and qtype == pdns.A then
>        return 0, { { qtype=pdns.A, content="192.168.0.2" } }
>    elseif string.find( domain, "amfire.us." ) and qtype == pdns.A then
>        return 0, { { qtype=pdns.A, content="192.168.0.2" } }
>    elseif string.find( domain, "lv-mircom.us." ) and qtype == pdns.A then
>        return 0, { { qtype=pdns.A, content="192.168.0.2" } }
>    elseif string.find( domain, "lv-firealarm.us." ) and qtype == pdns.A then
>        return 0, { { qtype=pdns.A, content="192.168.0.2" } }
>    elseif string.find( domain, "alarmsonline.us." ) and qtype == pdns.A then
>        return 0, { { qtype=pdns.A, content="192.168.0.2" } }
>    elseif string.find( domain, "lgma.us." ) and qtype == pdns.A then
>        return 0, { { qtype=pdns.A, content="192.168.0.2" } }
>    elseif string.find( domain, "poweredup.us." ) and qtype == pdns.A then
>        return 0, { { qtype=pdns.A, content="192.168.0.2" } }
>    else
>        return -1, {}
>    end
> end

In Lua you have to escape the dash in string.find with a %-sign.

if string.find(domain,"lv%-mircom.us.") ......

-- 
Erik



More information about the Pdns-users mailing list