Commit c385d8aa authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Adam Wujek

arch-unix: fix a problem with ppsi vlans

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent a5a85d39
...@@ -108,7 +108,7 @@ void unix_main_loop(struct pp_globals *ppg) ...@@ -108,7 +108,7 @@ void unix_main_loop(struct pp_globals *ppg)
&ppi->last_rcv_time); &ppi->last_rcv_time);
if (i == -2) { if (i == -2) {
continue; /* dropped */ continue; /* dropped or not for us */
} }
if (i == -1) { if (i == -1) {
pp_diag(ppi, frames, 1, pp_diag(ppi, frames, 1,
......
...@@ -149,7 +149,7 @@ void wrs_main_loop(struct pp_globals *ppg) ...@@ -149,7 +149,7 @@ void wrs_main_loop(struct pp_globals *ppg)
&ppi->last_rcv_time); &ppi->last_rcv_time);
if (i == -2) { if (i == -2) {
continue; /* dropped */ continue; /* dropped or not for us */
} }
if (i == -1) { if (i == -1) {
pp_diag(ppi, frames, 1, pp_diag(ppi, frames, 1,
......
...@@ -63,8 +63,10 @@ static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len, ...@@ -63,8 +63,10 @@ static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
return ret; return ret;
} }
if (msg.msg_flags & MSG_TRUNC) { if (msg.msg_flags & MSG_TRUNC) {
pp_error("%s: truncated message\n", __func__); /* If we are in VLAN mode, we get everything. This is ok */
return 0; if (ppi->proto != PPSI_PROTO_VLAN)
pp_error("%s: truncated message\n", __func__);
return -2; /* like "dropped" */
} }
/* get time stamp of packet */ /* get time stamp of packet */
if (msg.msg_flags & MSG_CTRUNC) { if (msg.msg_flags & MSG_CTRUNC) {
...@@ -141,7 +143,7 @@ static int unix_net_recv(struct pp_instance *ppi, void *pkt, int len, ...@@ -141,7 +143,7 @@ static int unix_net_recv(struct pp_instance *ppi, void *pkt, int len,
if (ret <= 0) if (ret <= 0)
return ret; return ret;
if (hdr->h_proto != htons(ETH_P_1588)) if (hdr->h_proto != htons(ETH_P_1588))
return 0; return -2; /* like "dropped", so no error message */
memcpy(ppi->peer, hdr->h_source, ETH_ALEN); memcpy(ppi->peer, hdr->h_source, ETH_ALEN);
if (pp_diag_allow(ppi, frames, 2)) { if (pp_diag_allow(ppi, frames, 2)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment