Skip to content

Commit

Permalink
defrag - take protocol into account during re-assembly
Browse files Browse the repository at this point in the history
The IP protocol was not being used to match fragments with
their packets allowing a carefully constructed packet
with a different protocol to be matched, allowing re-assembly
to complete, creating a packet that would not be re-assembled
by the destination host.
  • Loading branch information
jasonish authored and victorjulien committed Feb 14, 2017
1 parent 4b6e804 commit 5c34a87
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 68 deletions.
2 changes: 2 additions & 0 deletions src/defrag-hash.c
Expand Up @@ -92,6 +92,7 @@ static void DefragTrackerInit(DefragTracker *dt, Packet *p)
dt->id = (int32_t)IPV6_EXTHDR_GET_FH_ID(p);
dt->af = AF_INET6;
}
dt->proto = IP_GET_IPPROTO(p);
dt->vlan_id[0] = p->vlan_id[0];
dt->vlan_id[1] = p->vlan_id[1];
dt->policy = DefragGetOsPolicy(p);
Expand Down Expand Up @@ -406,6 +407,7 @@ static inline uint32_t DefragHashGetKey(Packet *p)
CMP_ADDR(&(d1)->dst_addr, &(d2)->dst)) || \
(CMP_ADDR(&(d1)->src_addr, &(d2)->dst) && \
CMP_ADDR(&(d1)->dst_addr, &(d2)->src))) && \
(d1)->proto == IP_GET_IPPROTO(p) && \
(d1)->id == (id) && \
(d1)->vlan_id[0] == (d2)->vlan_id[0] && \
(d1)->vlan_id[1] == (d2)->vlan_id[1])
Expand Down

0 comments on commit 5c34a87

Please sign in to comment.