提交 cca04b28 编写于 作者: R Richard Cochran 提交者: David S. Miller

net: ptp: fix time stamp matching logic for VLAN packets.

Commit ae5c6c6d "ptp: Classify ptp over ip over vlan packets" changed the
code in two drivers that matches time stamps with PTP frames, with the goal
of allowing VLAN tagged PTP packets to receive hardware time stamps.

However, that commit failed to account for the VLAN header when parsing
IPv4 packets. This patch fixes those two drivers to correctly match VLAN
tagged IPv4/UDP PTP messages with their time stamps.

This patch should also be applied to v3.17.
Signed-off-by: NRichard Cochran <richardcochran@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ee7bc3cd
...@@ -264,7 +264,7 @@ static int cpts_match(struct sk_buff *skb, unsigned int ptp_class, ...@@ -264,7 +264,7 @@ static int cpts_match(struct sk_buff *skb, unsigned int ptp_class,
switch (ptp_class & PTP_CLASS_PMASK) { switch (ptp_class & PTP_CLASS_PMASK) {
case PTP_CLASS_IPV4: case PTP_CLASS_IPV4:
offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN;
break; break;
case PTP_CLASS_IPV6: case PTP_CLASS_IPV6:
offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; offset += ETH_HLEN + IP6_HLEN + UDP_HLEN;
......
...@@ -791,7 +791,7 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts) ...@@ -791,7 +791,7 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts)
switch (type & PTP_CLASS_PMASK) { switch (type & PTP_CLASS_PMASK) {
case PTP_CLASS_IPV4: case PTP_CLASS_IPV4:
offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN;
break; break;
case PTP_CLASS_IPV6: case PTP_CLASS_IPV6:
offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; offset += ETH_HLEN + IP6_HLEN + UDP_HLEN;
...@@ -934,7 +934,7 @@ static int is_sync(struct sk_buff *skb, int type) ...@@ -934,7 +934,7 @@ static int is_sync(struct sk_buff *skb, int type)
switch (type & PTP_CLASS_PMASK) { switch (type & PTP_CLASS_PMASK) {
case PTP_CLASS_IPV4: case PTP_CLASS_IPV4:
offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN;
break; break;
case PTP_CLASS_IPV6: case PTP_CLASS_IPV6:
offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; offset += ETH_HLEN + IP6_HLEN + UDP_HLEN;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册