ChorusOS 5.0 System Administrator's Guide

Creating Devices

Ethernet connections only require corresponding devices if you configure Ethernet interfaces using the dhclient(1M) or rarp(1M) utility. Both of these utilities require a Berkeley Packet Filter (BPF).

It is also possible that your applications require a BPF device for raw access to network packets.

In order to create the BPF device, you can include commands of the following form in the sysadm.ini file that you build into the system image for your target:

# Create the BPF device
mkdev bpf unit
# Create the associated special file
mknod /dev/bpfunit c 23 unit

where unit is the number that makes the interface unique. Note that mknod(1M) is used to create special files. The c refers to the fact that BPF devices are character devices, and 23 is, by convention, the major number used for BPF devices.


Example 10-2 BPF Device Creation

The following example sysadm.ini fragment creates an interface for an Ethernet device and the loopback interface needed for IP communication. It then creates a BPF device needed by dhclient(1M) and rarp(1M).

umask 0
mkdev ifeth 0
mkdev lo 0

#
# Create a Berkeley Packet Filter device and special file
#
# The BPF device is used by either the rarp or dhclient command to
# configure the Ethernet interface
#
mkdev bpf 0
mknod /dev/bpf c 23 0