|
|
@@ -24,27 +24,59 @@ use-host-decl-names off;
|
|
|
|
|
|
ping-check false;
|
|
|
|
|
|
+log-facility local5;
|
|
|
+
|
|
|
on commit {
|
|
|
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
|
|
|
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
|
|
|
set ClientHostName = pick-first-value(option host-name,"undef");
|
|
|
- execute("/opt/Eye/scripts/dhcp-hook.sh", "add", ClientIP, ClientMac, ClientHostName);
|
|
|
+ log (info, concat("add;", ClientIP,";", ClientMac, ";", ClientHostName,";",binary-to-ascii(10,8,"",suffix (option agent.circuit-id, 1)),";",binary-to-ascii(16,8,":",suffix(option agent.remote-id,6)),";;;"));
|
|
|
}
|
|
|
|
|
|
on release {
|
|
|
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
|
|
|
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
|
|
|
- execute("/opt/Eye/scripts/dhcp-hook.sh", "del", ClientIP, ClientMac);
|
|
|
- }
|
|
|
+ log (info, concat("del;", ClientIP,";", ClientMac, ";undef;;;;;;"));
|
|
|
+}
|
|
|
|
|
|
on expiry {
|
|
|
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
|
|
|
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
|
|
|
- execute("/opt/Eye/scripts/dhcp-hook.sh", "del", ClientIP, ClientMac);
|
|
|
- }
|
|
|
+ log (info, concat("del;", ClientIP,";", ClientMac, ";undef;;;;;;"));
|
|
|
+}
|
|
|
|
|
|
log (info, concat("DHCPDLOG - ",binary-to-ascii(10, 8, ".", leased-address)," - ",pick-first-value(option host-name,"undef")," - ",binary-to-ascii (16, 8, ":", substring(hardware, 1, 7))," - at switch - ",binary-to-ascii(16,8,":",suffix(option agent.remote-id,6))," - vlan - ",binary-to-ascii(10,16,"",substring(suffix(option agent.circuit-id,4),0,2))," - port - ",binary-to-ascii(10,8,"",suffix (option agent.circuit-id, 1))," - via - ",binary-to-ascii(10,8,".",packet (24,4))));
|
|
|
|
|
|
+if exists agent.remote-id and exists agent.circuit-id {
|
|
|
+ log(info,concat("DHCPCIRCUIT for lease of ",binary-to-ascii(10,8,".",leased-address),
|
|
|
+ " is connected to interface ",binary-to-ascii(10,8,"/",suffix(option agent.circuit-id,2)),
|
|
|
+ ", VLAN ",binary-to-ascii(10,16,"",substring(suffix(option agent.circuit-id,4),0,2)),
|
|
|
+ " on switch ",binary-to-ascii(16,8,":",suffix(option agent.remote-id,6))
|
|
|
+ ));
|
|
|
+ log(info,concat("DHCPOPT82 for lease of ",binary-to-ascii(10,8,".",leased-address),
|
|
|
+ " raw option-82 info is CID: ",binary-to-ascii(10,8,".",option agent.circuit-id),
|
|
|
+ " AID: ",binary-to-ascii(16,8,".",option agent.remote-id)
|
|
|
+ ));
|
|
|
+ } elsif exists agent.remote-id {
|
|
|
+ log(info,concat("DHCPAGENT for lease of ",binary-to-ascii(10,8,".",leased-address),
|
|
|
+ " on agent ",binary-to-ascii(16,8,":",substring(option agent.remote-id, 2, 6))
|
|
|
+ ));
|
|
|
+ } elsif exists agent.circuit-id {
|
|
|
+ log(info,concat("DHCPCIRCUITID on ",
|
|
|
+ suffix(concat("0",binary-to-ascii(16,8,"",substring(hardware,1,1))),2),":",
|
|
|
+ suffix(concat("0",binary-to-ascii(16,8,"",substring(hardware,2,1))),2),":",
|
|
|
+ suffix(concat("0",binary-to-ascii(16,8,"",substring(hardware,3,1))),2),":",
|
|
|
+ suffix(concat("0",binary-to-ascii(16,8,"",substring(hardware,4,1))),2),":",
|
|
|
+ suffix(concat("0",binary-to-ascii(16,8,"",substring(hardware,5,1))),2),":",
|
|
|
+ suffix(concat("0",binary-to-ascii(16,8,"",substring(hardware,6,1))),2),
|
|
|
+ " to ",binary-to-ascii(10,8,".",leased-address),
|
|
|
+ " via ",option agent.circuit-id
|
|
|
+ ));
|
|
|
+}
|
|
|
+
|
|
|
+option ms-classless-static-routes code 249 = array of unsigned integer 8;
|
|
|
+option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
|
|
|
+
|
|
|
# WPAD definition
|
|
|
option wpad code 252 = text;
|
|
|
# Suppress WPAD activity - no cache, no DNS.
|
|
|
@@ -69,13 +101,16 @@ vendor-option-space MSFT;
|
|
|
option MSFT.release-on-shutdown 1;
|
|
|
}
|
|
|
|
|
|
-shared-network "company" {
|
|
|
+class "default" {
|
|
|
+ match if (binary-to-ascii (10, 16, "", substring ( option agent.circuit-id, 2, 2 ) ) = "99");
|
|
|
+}
|
|
|
|
|
|
-#office
|
|
|
-subnet 192.168.1.0 netmask 255.255.255.0 {
|
|
|
- option routers 192.168.1.1;
|
|
|
- authoritative;
|
|
|
- include "/etc/dhcp/stat/192.168.1.0.conf";
|
|
|
- }
|
|
|
+class "any" {
|
|
|
+ match if (not exists agent.circuit-id);
|
|
|
+}
|
|
|
|
|
|
+class "direct" {
|
|
|
+ match if (binary-to-ascii(10,8,".",packet (24,4)) = "0.0.0.0");
|
|
|
}
|
|
|
+
|
|
|
+include "/etc/dhcp/eye.d/eye.conf";
|