flow->dl_type = eth->eth_type;
} else {
/* This is an 802.2 frame */
- struct llc_snap_header *h = ofpbuf_at(&b, 0, sizeof *h);
- if (h == NULL) {
+ struct llc_header *llc = ofpbuf_at(&b, 0, sizeof *llc);
+ struct snap_header *snap = ofpbuf_at(&b, sizeof *llc,
+ sizeof *snap);
+ if (llc == NULL) {
return 0;
}
- if (h->llc.llc_dsap == LLC_DSAP_SNAP
- && h->llc.llc_ssap == LLC_SSAP_SNAP
- && h->llc.llc_cntl == LLC_CNTL_SNAP
- && !memcmp(h->snap.snap_org, SNAP_ORG_ETHERNET,
- sizeof h->snap.snap_org)) {
- flow->dl_type = h->snap.snap_type;
- ofpbuf_pull(&b, sizeof *h);
+ if (snap
+ && llc->llc_dsap == LLC_DSAP_SNAP
+ && llc->llc_ssap == LLC_SSAP_SNAP
+ && llc->llc_cntl == LLC_CNTL_SNAP
+ && !memcmp(snap->snap_org, SNAP_ORG_ETHERNET,
+ sizeof snap->snap_org)) {
+ flow->dl_type = snap->snap_type;
+ ofpbuf_pull(&b, LLC_SNAP_HEADER_LEN);
} else {
flow->dl_type = htons(OFP_DL_TYPE_NOT_ETH_TYPE);
ofpbuf_pull(&b, sizeof(struct llc_header));