Skip to content

Future Work

Joe Antony edited this page Dec 1, 2017 · 27 revisions

Proposed Changes To Make The Code Scalable

Modifications required in DHCP Server Configuration

  • The current server configuration assigns IP addresses to incoming clients from a single address pool. This pool consists of IP addresses from only the server's subnet.

  • The function : ApplicationContainer InstallDhcpServer (Ptr<NetDevice> netDevice, Ipv4Address serverAddr, Ipv4Address poolAddr, Ipv4Mask poolMask, Ipv4Address minAddr, Ipv4Address maxAddr, Ipv4Address gateway = Ipv4Address ()) in src/internet-apps/helper/dhcp-helper.h sets all the attributes of the server including its own IP address.

  • This should be split into 2 separate functions :

    • ApplicationContainer InstallDhcpServer(Ptr<NetDevice> netDevice, Ipv4Address serverAddr, Ipv4Mask Mask)

      This function allocates the server IP address to the Ptr argument passed, installs a default traffic control configuration, creates a DHCP server app and returns that pointer.

    • void AddAddressPool(ApplicationContainer dhcpServerApp, Ipv4Address minAddr, Ipv4Address maxAddr, Ipv4Address gateway)

      This function adds the IP addresses in the given range i.e., between minAddr and maxAddr (both inclusive), as a pair along with the given gateway to m_availableAddresses (a map consisting of gateway and IP addresses allocatable in a subnet).

  • We need to modify void StartApplication (void) in src/internet-apps/model/dhcp-server.h to map the gateway address of the incoming client subnet and the corresponding pool address.

  • We modify void SendOffer (Ptr<NetDevice> iDev, DhcpHeader header, InetSocketAddress from) in src/internet-apps/model/dhcp-server.h to extract the gateway IP address (giaddr) of the client subnet from the header using header.GetGiaddr().

    This value of giaddr is compared with the giaddr values in the map to retrieve the corresponding pool's IP address to be allocated. A new packet is made and send to the DHCP relay agent.

Modifications required in DHCP Relay Agent Configuration

  • Our current implementation supports only two subnets - one having the DHCP server and the other for incoming clients.

  • We have two functions in src/internet-apps/helper/dhcp-helper.h to initialize client and server side :

    • Ipv4InterfaceContainer InstallFixedAddress (Ptr<NetDevice> netDevice, Ipv4Address addr, Ipv4Mask mask)
    • ApplicationContainer InstallDhcpRelay (Ptr<NetDevice> netDevice, Ipv4Address relayAddr, Ipv4Mask subMask, Ipv4Address dhcps)
  • To support clients from multiple subnets :

    • We need to modify void SendDiscover(Ptr<NetDevice> iDev,DhcpHeader header) function in src/internet-apps/model/dhcp-relay.cc.
    • This is done so that for each incoming packet header, we set the gateway IP address attribute (giaddr) to be the IP address of the incoming NetDevice (iDev).
  • void NetHandlerServer (Ptr<Socket> socket) in src/internet-apps/model/dhcp-relay.h compares the Ipv4 address of the interface receiving the incoming packet. If this is equal to the relay's server side address, then we don't forward the DHCP DISCOVER message.

Clone this wiki locally