Parcourir la source

Use the textual representation of DHCP type instead of integer code

Baptiste Jonglez il y a 7 ans
Parent
commit
e5894dd75f
2 fichiers modifiés avec 2 ajouts et 4 suppressions
  1. 0 2
      README.md
  2. 2 2
      src/callouts.cc

+ 0 - 2
README.md

@@ -4,8 +4,6 @@
 - handle DHCPv6 hook points
 - ask for a new `lease_expired` hook point
 - document environment variables
-- change some variables from integer to their textual representation
-  (e.g. `QUERY4_TYPE=3` → `QUERY4_TYPE=DHCPREQUEST`)
 - allow to configure which hook points will trigger the script
 - take into account the return code of the script to set the status
   of the callout.

+ 2 - 2
src/callouts.cc

@@ -20,7 +20,7 @@ extern "C" {
 void extract_query4(std::vector<std::string>& env, const Pkt4Ptr query)
 {
     /* General information */
-    env.push_back("QUERY4_TYPE=" + std::to_string(query->getType()));
+    env.push_back("QUERY4_TYPE=" + std::string(query->getName()));
     /* Hardware address */
     HWAddrPtr hwaddr = query->getHWAddr();
     env.push_back("QUERY4_HWADDR_TYPE=" + std::to_string(hwaddr->htype_));
@@ -33,7 +33,7 @@ void extract_query4(std::vector<std::string>& env, const Pkt4Ptr query)
 void extract_response4(std::vector<std::string>& env, const Pkt4Ptr response)
 {
     /* General information */
-    env.push_back("RESPONSE4_TYPE=" + std::to_string(response->getType()));
+    env.push_back("RESPONSE4_TYPE=" + std::string(response->getName()));
 }
 
 void extract_subnet4(std::vector<std::string>& env, const Subnet4Ptr subnet)