]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1546] examples for option 43 and 125
authorWlodek Wencel <wlodek@isc.org>
Mon, 25 Jan 2021 11:28:14 +0000 (12:28 +0100)
committerWlodek Wencel <wlodek@isc.org>
Mon, 25 Jan 2021 12:54:28 +0000 (13:54 +0100)
doc/Makefile.am
doc/examples/kea4/vendor-specific.json [new file with mode: 0644]
doc/examples/kea4/vivso.json [new file with mode: 0644]
src/bin/dhcp4/tests/parser_unittest.cc

index f153e2b68cc455238f618c91ffda95d102ed55ab..89d5e0fad10bcc71180ff88fc7eaf545ee9967f7 100644 (file)
@@ -34,6 +34,8 @@ nobase_dist_doc_DATA += examples/kea4/several-subnets.json
 nobase_dist_doc_DATA += examples/kea4/shared-network.json
 nobase_dist_doc_DATA += examples/kea4/single-subnet.json
 nobase_dist_doc_DATA += examples/kea4/with-ddns.json
+nobase_dist_doc_DATA += examples/kea4/vivso.json
+nobase_dist_doc_DATA += examples/kea4/vendor-specific.json
 nobase_dist_doc_DATA += examples/kea6/advanced.json
 nobase_dist_doc_DATA += examples/kea6/all-keys.json
 nobase_dist_doc_DATA += examples/kea6/all-keys-netconf.json
diff --git a/doc/examples/kea4/vendor-specific.json b/doc/examples/kea4/vendor-specific.json
new file mode 100644 (file)
index 0000000..26a6c5a
--- /dev/null
@@ -0,0 +1,92 @@
+// This is an example configuration file for the DHCPv4 server in Kea.
+// The purpose of this example is to showcase how configure
+// Vendor Specific Information (code 43) RFC 2132 section 8.4
+{
+    "Dhcp4": {
+        "option-def": [
+            {
+// Two options that we are planning to include in option 43 as suboptions
+// should be defined on global level
+                "array": false,
+                "code": 2,
+                "name": "vlanid",
+// suboptions should have space configured and it can't start with 'vendor-'
+// otherwise those will be included in 125 option not 43
+                "space": "339",
+                "type": "uint32"
+            },
+            {
+                "array": false,
+                "code": 3,
+                "name": "dls",
+                "space": "339",
+                "type": "string"
+            }
+        ],
+        "client-classes": [
+            {
+
+// Kea needs classification based on option 60, you can either use name:
+// VENDOR_CLASS_ + option 60 content (test parameter is not required than)
+// or use any name and add "test" parameter accordingly e.g.
+// "test": "substring(option[60].hex,0,9) == 'partial-content-of-option-60'"
+                "name": "VENDOR_CLASS_339",
+                "option-def": [
+                    {
+// vendor specific option have to be defined on class level, if we planing
+// to send single value define it's type accordingly, if this option
+// should encapsulate other suboptions "space" parameter should be the same
+// as included suboptions and "type" set to empty
+                        "code": 43,
+                        "encapsulate": "339",
+                        "name": "vendor-encapsulated-options",
+                        "type": "empty"
+                    }
+                ],
+                "option-data": [
+                    {
+// vendor-encapsulated-options and defined option on global level should
+// be also configured  with proper "data" parameters in "option-data" list.
+// Because Kea will send only option that client ask for, and there is no way
+// to ask for suboptions, parameter "always-send" with value set
+// to true has also be included in all custom suboptions
+                        "name": "vendor-encapsulated-options"
+                    },
+                    {
+                        "always-send": true,
+                        "data": "123",
+                        "name": "vlanid",
+                        "space": "339"
+                    },
+                    {
+                        "always-send": true,
+                        "data": "sdlp://11.11.11.11:18443",
+                        "name": "dls",
+                        "space": "339"
+                    }
+                ]
+            }
+        ],
+// Kea is told to listen on ethX interface only.
+        "interfaces-config": {
+            "interfaces": ["ethX"]
+        },
+// We need to specify the the database used to store leases.
+        "lease-database": {
+            "type": "memfile"
+        },
+// The following list defines subnets. We have only one subnet
+// here. We tell Kea that it is directly available over local interface.
+        "subnet4": [
+            {
+                "interface": "ethX",
+                "pools": [
+                    {
+                        "pool": "192.168.50.50-192.168.50.50"
+                    }
+                ],
+                "subnet": "192.168.50.0/24"
+            }
+        ]
+    }
+}
diff --git a/doc/examples/kea4/vivso.json b/doc/examples/kea4/vivso.json
new file mode 100644 (file)
index 0000000..0b2b110
--- /dev/null
@@ -0,0 +1,88 @@
+// This is an example configuration file for the DHCPv4 server in Kea.
+// The purpose of this example is to showcase how configure
+// Vendor-Identifying Vendor-specific Information option
+// (code 125) RFC 3925
+
+
+{
+    "Dhcp4": {
+// If we want to send suboptions in option 125 first those have to be defined
+// on global level
+        "option-def": [
+            {
+                "array": false,
+                "code": 2,
+                "name": "vlanid",
+// In case of suboption of option 125 space has to start with prefix "vendor-"
+// in this case it's "vendor-" + vendor id from option 60 send by client
+// 339 is Siemens Industry Inc.
+                "space": "vendor-339",
+                "type": "uint32"
+            },
+            {
+                "array": false,
+                "code": 3,
+                "name": "dls",
+                "space": "vendor-339",
+                "type": "string"
+            }
+        ],
+        "client-classes": [
+            {
+// Kea needs classification based on option 60, you can either use name:
+// VENDOR_CLASS_ + option 60 content (test parameter is not required than)
+// or use any name and add "test" parameter accordingly e.g.
+// "test": "substring(option[60].hex,0,9) == 'partial-content-of-option-60'"
+                "name": "VENDOR_CLASS_339",
+                "option-data": [
+                    {
+// In "option-data" list we have to configure option 125 with data parameter equal
+// to vendor-id we are expecting
+                        "data": "339",
+                        "name": "vivso-suboptions"
+                    },
+                    {
+// And additionally we have to configure all previously defined suboptions
+// with "space" parameter same as in option-def.
+// Because Kea will send only option that client ask for, and there is no way
+// to ask for suboptions parameter "always-send" with value set
+// to true has also be included in all custom suboptions.
+                        "always-send": true,
+                        "data": "123",
+                        "name": "vlanid",
+                        "space": "vendor-339"
+                    },
+                    {
+                        "always-send": true,
+                        "data": "sdlp://11.11.11.11:18443",
+                        "name": "dls",
+                        "space": "vendor-339"
+                    }
+                ]
+            }
+        ],
+// Kea is told to listen on ethX interface only.
+        "interfaces-config": {
+            "interfaces": [
+                "ethX"
+            ]
+        },
+// We need to specify the the database used to store leases.
+        "lease-database": {
+            "type": "memfile"
+        },
+// The following list defines subnets. We have only one subnet
+// here. We tell Kea that it is directly available over local interface.
+        "subnet4": [
+            {
+                "interface": "ethX",
+                "pools": [
+                    {
+                        "pool": "192.168.50.50-192.168.50.50"
+                    }
+                ],
+                "subnet": "192.168.50.0/24"
+            }
+        ]
+    }
+}
index 2e64da9ac127805e2ac2be5319d068ca81b767cc..1e55eff60eade669c999380f6d77d2991b3aca4e 100644 (file)
@@ -285,6 +285,8 @@ TEST(ParserTest, file) {
                                "several-subnets.json",
                                "shared-network.json",
                                "single-subnet.json",
+                               "vendor-specific.json",
+                               "vivso.json",
                                "with-ddns.json" };
 
     for (int i = 0; i<configs.size(); i++) {