Technical data

SunOS 5.5 STREAMS Modules pfmod(7M)
will route received packets upstream. Refer to theDLPI Version 2 specification for details
on this interface.
The reverseARP daemon program may use code similar to the following fragment to
construct a filter that rejects all butRARP packets. That is, is accepts only packets whose
Ethernet type field has the valueETHERTYPE_REVARP.
struct ether_header eh; /used only for offset values /
struct packetfilt pf;
register u_short fwp = pf.Pf_Filter;
u_short offset;
int fd;
/
Push packet filter streams module.
/
if (ioctl(fd, I_PUSH, "pfmod") < 0)
syserr("pfmod");
/
Set up filter. Offset is the displacement of the Ethernet
type field from the beginning of the packet in units of
u_shorts.
/
offset = ((u_int) &eh.ether_type - (u_int) &eh.ether_dhost) /
sizeof (u_short);
fwp++ = ENF_PUSHWORD + offset;
fwp++ = ENF_PUSHLIT;
fwp++ = htons(ETHERTYPE_REVARP);
fwp++ = ENF_EQ;
pf.Pf_FilterLen = fwp - &pf.Pf_Filter[0];
This filter can be abbreviated by taking advantage of the ability to combine actions and
operations:
fwp++ = ENF_PUSHWORD + offset;
fwp++ = ENF_PUSHLIT | ENF_EQ;
fwp++ = htons(ETHERTYPE_REVARP);
SEE ALSO bufmod(7M), dlpi(7P), ie(7D), le(7D), pullupmsg(9F)
modified 18 Sep 1992 7M-257