#include "vlog.h"
#define THIS_MODULE VLM_flow
-struct ip_header *
+static struct ip_header *
pull_ip(struct buffer *packet)
{
if (packet->size >= IP_HEADER_LEN) {
return NULL;
}
-struct tcp_header *
+static struct tcp_header *
pull_tcp(struct buffer *packet)
{
if (packet->size >= TCP_HEADER_LEN) {
return NULL;
}
-struct udp_header *
+static struct udp_header *
pull_udp(struct buffer *packet)
{
return buffer_try_pull(packet, UDP_HEADER_LEN);
}
-struct eth_header *
+static struct eth_header *
pull_eth(struct buffer *packet)
{
return buffer_try_pull(packet, ETH_HEADER_LEN);
return buffer_try_pull(packet, VLAN_HEADER_LEN);
}
-void
+/* Returns 1 if 'packet' is an IP fragment, 0 otherwise. */
+int
flow_extract(struct buffer *packet, uint16_t in_port, struct flow *flow)
{
struct buffer b = *packet;
struct eth_header *eth;
+ int retval = 0;
if (b.size < ETH_TOTAL_MIN) {
/* This message is not too useful since there are various ways that we
/* This is an 802.2 frame */
struct llc_snap_header *h = buffer_at(&b, 0, sizeof *h);
if (h == NULL) {
- return;
+ return 0;
}
if (h->llc.llc_dsap == LLC_DSAP_SNAP
&& h->llc.llc_ssap == LLC_SSAP_SNAP
flow->nw_proto = 0;
}
}
+ } else {
+ retval = 1;
}
}
}
}
+ return retval;
}
void