*/
skb_orphan(skb);
+ if (skb->pkt_type == PACKET_OUTGOING)
+ skb->pkt_type = PACKET_LOOPBACK;
+
/* ensure we have enough data for a header and a type */
if (skb->len < sizeof(struct mctp_hdr) + 1)
goto out;
return -EMSGSIZE;
}
- if (cb->ifindex) {
+ /* If we're forwarding, we don't want to use the input path's cb,
+ * as it holds the *source* hardware addressing information.
+ *
+ * We will have a PACKET_HOST skb from the dev, or PACKET_OUTGOING
+ * from a socket; only use cb in the latter case.
+ */
+ if (skb->pkt_type == PACKET_OUTGOING && cb->ifindex) {
/* direct route; use the hwaddr we stashed in sendmsg */
if (cb->halen != skb->dev->addr_len) {
/* sanity check, sendmsg should have already caught this */
}
daddr = cb->haddr;
} else {
+ skb->pkt_type = PACKET_OUTGOING;
/* If lookup fails let the device handle daddr==NULL */
if (mctp_neigh_lookup(route->dev, hdr->dest, daddr_buf) == 0)
daddr = daddr_buf;
tag = req_tag & MCTP_TAG_MASK;
}
+ skb->pkt_type = PACKET_OUTGOING;
skb->protocol = htons(ETH_P_MCTP);
skb->priority = 0;
skb_reset_transport_header(skb);