This document provides a brief description of the DHCP Snooping OpEN APIs. It provides the following services:
- Get whether DHCP snooping is enabled or not.
- Get whether DHCP snooping verifies source MAC addresses.
- Given a VLAN ID, return the endpoints of the next range of VLANs enabled for DHCP snooping.
- Determine whether DHCP snooping is enabled on an interface.
- Determine whether DHCP snooping considers an enabled interface as trusted.
- Determine whether DHCP snooping logs invalid packets on an enabled interface.
- Get the remote DHCP snooping database file name.
- Get the remote DHCP snooping database IP Address.
- Get the DHCP snooping database write delay.
Example C Application dhcp_snooping_example
Initialization
In the main function, the sample application initializes the OpEN API RPC service by calling openapiClientRegister() and waits for the RPC service in switchdrvr to start. A Client Handle is returned by openapiClientRegister() which is used while invoking the OpEN APIs. The application then exercises the associated OpEN APIs and logs informational and/or error messages on the console. The example application runs to its completion and exits.
dhcp_snooping_example
dhcp_snooping_example.c is a sample application that demonstrates the use of OpEN's DHCP Snooping APIs. dhcp_snooping_example is started from the command line and can be used to exercise the various APIs by specifying arguments on the command line.
Sample Output
- Usage: ./dhcp_snooping_example <test#> <arg1> <arg2> ...
- Note: in following, family is either 1 for AF_INET, or 2 for AF_INET6
- Test 1: Get whether DHCP snooping is enabled not: ./dhcp_snooping_example 1 family
- Test 2: Get whether DHCP snooping verifies source MAC addresses: ./dhcp_snooping_example 2 family
- Test 3: Display VLANs enabled for DHCP snooping: ./dhcp_snooping_example 3 family
- Test 4: Get whether DHCP snooping is enabled on a port: ./dhcp_snooping_example 4 family ifnum
- Test 5: Get whether DHCP snooping considers an interface trusted: ./dhcp_snooping_example 5 family ifnum
- Test 6: Get whether DHCP snooping logs invalid packets on an interface: ./dhcp_snooping_example 6 family ifnum
- Test 7: Get the remote DHCP snooping database file name: ./dhcp_snooping_example 7 family.
- Test 8: Get the remote DHCP snooping database IP Address: ./dhcp_snooping_example 8 family.
- Test 9: Get the DHCP snooping database write delay: ./dhcp_snooping_example 9 family.
- Test 10: Test DHCP snooping OpEN API Sanity: ./dhcp_snooping_example 10