Selective logging of Option82 markets

Peter Rathlev peter at rathlev.dk
Thu Oct 13 10:29:57 UTC 2016


On Wed, 2016-10-12 at 09:28 -0500, project722 wrote:
> I'm using a global statement which allows me to log all data that
> comes into the server with Option82 in it. Here is what I am using:
> 
> if((option dhcp-message-type = 3 or option dhcp-message-type = 5) and
>       exists agent.circuit-id) {
> 
>     log(info, concat( "OPTION-82 | IP =",
...
> We have about 25 markets, or "pools", subnet declarations, whatever
> you want to call it. Some of which are test markets we are using for
> internal use. I need the ability to enable/disable option82 logging
> for these markets. I'd rather keep the logging statement global then
> disable only the few internal use markets that I need to. Is there a
> way to accomplish this.

We use "config-option" selectors in class-statements, you might be able
to do the same with your log statement. An example:

   option X-Siedle-Options code 253 = string;

   class "Siedle" {
       match if substring(hardware, 1, 3) = d4:e3:2c;
       if (config-option X-Siedle-Options = "LOCATOR-ID") {
           set X-Siedle-Options-served = "LOCATOR-ID";
           option time-servers 192.0.2.234;
           option log-servers 192.0.2.234;
           option ntp-servers 192.0.2.234;
           option tftp-server-name "192.0.2.234";
           option bootfile-name "SSS/Axxx/locator.xml";
       }
   }
   
   group {
       option X-Siedle-Options "LOCATOR-ID";
       subnet 198.51.100.0 netmask 255.255.255.0 {
           option routers 198.51.100.1;
           pool {
               failover peer "rmnet-failover"; 
               range 198.51.100.50 198.51.100.239;
           }
       }
   }

You might be able to attach a custom option to the subnets that
shouldn't be logged and then add

  ... and not (pick-first-value(config-option OPTION-NAME, "") = "SOMETHING")

to your existing "if" statement.

I'm not certain it will work though. It might depend on how much state
is present when the log statement is called. But for message type
REQUEST (3) and ACK (5) the subnet has probably already been parsed.

-- 
Peter



More information about the dhcp-users mailing list