Jasver Singh(deleted)
|
How do i determine Ethertype in PFIL filter
|
Jasver Singh(deleted)
10/24/2017 10:28 AM
post118146
|
How do i determine Ethertype in PFIL filter
Hi,
I replacing an io-net filter with a PFIL filter. Previously we would look at the Ethertype field to determine the filter
action. This was to support filtering of IEC GOOSE message which use their own Ethernet frame types. I'm struggling to
determine how I can get to the same field in the PFIL interface. The mbuf data starts at the payload which is too far in
the frame. Is the Ethertype available somewhere else in the mbuf chain?
I've included io-net code snippet for info:-
int goose_rx_up(
npkt_t *npkt,
void *func_hdl,
int off,
int framlen_sub,
uint16_t cell, // 1 = "en"
uint16_t endpoint, // endpoint gives us the originating ethernet port; 0=en0, 1=en1
uint16_t iface
)
{
net_buf_t *buf;
net_iov_t *iov;
buf = TAILQ_FIRST(&npkt->buffers);
iov = buf->net_iov;
// check to see if this is a ETHERTYPE_VLAN goose message; if so, filter it away to the goose app if connected
ptr16 = (uint16_t *)(iov->iov_base);
/*
* Check for ether VLAN 0x8100 AND goose type 0x88b8 or goose type 0x88b9 or Goose Types on their own...
*/
if ( ( ptr16[ETH_VLAN_WORD_POS] == ETH_TYPE_IEC61850_GOOSE ) || ( ptr16[ETH_VLAN_WORD_POS] ==
ETH_TYPE_IEC61850_GSE_MGMNT )
|| ( ptr16[ETH_VLAN_WORD_POS] == ETHERTYPE_VLAN && (ptr16[ETH_GOOSE_TYPE_WORD_POS] == ETH_TYPE_IEC61850_GOOSE || ptr16[ETH_GOOSE_TYPE_WORD_POS] == ETH_TYPE_IEC61850_GSE_MGMNT) ) )
{
#ifdef DEBUG
fprintf(stderr, "Incoming subscriber goose msg rxd, len=%d\n", npkt->framelen);
#endif
}
}
|
|
|