Documentation
¶
Overview ¶
Package dhcp reads an ISC dhcpd configuration.
The host declarations are parsed rather than grepped. Reading a fixed number of lines after a match, which the shell tools did, breaks as soon as a declaration is one line longer or the options are in another order, and it silently reports a neighbour's address.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GUIDFromMAC ¶
GUIDFromMAC derives the InfiniBand port GUID of a Mellanox adapter from its hardware address, which is what the fabric tools are asked about.
The address is split in the middle and 0300 is inserted, which is the mapping Mellanox firmware uses between the two.
Types ¶
type Config ¶
type Config struct {
Hosts []Host `json:"hosts" yaml:"hosts"`
}
Config is a parsed dhcpd configuration.
type Host ¶
type Host struct {
// Name is the name the declaration carries.
Name string `json:"name" yaml:"name"`
// MACs are the hardware addresses it matches.
MACs []string `json:"macs,omitempty" yaml:"macs,omitempty"`
// Address is the fixed address it hands out.
Address string `json:"address,omitempty" yaml:"address,omitempty"`
// Filename is the boot file it offers.
Filename string `json:"filename,omitempty" yaml:"filename,omitempty"`
// ClientIdentifier is the dhcp-client-identifier option it matches.
ClientIdentifier string `json:"clientIdentifier,omitempty" yaml:"clientIdentifier,omitempty"`
// Options holds every other option of the declaration.
Options map[string]string `json:"options,omitempty" yaml:"options,omitempty"`
// Comments are the comment lines directly above the declaration, which
// is where sites often write the node name.
Comments []string `json:"comments,omitempty" yaml:"comments,omitempty"`
}
Host is one host declaration.