Skip to content

Commit 6f22754

Browse files
Cris Fornodavem330
authored andcommitted
ibmveth: Detect unsupported packets before sending to the hypervisor
Currently, when ibmveth receive a loopback packet, it reports an ambiguous error message "tx: h_send_logical_lan failed with rc=-4" because the hypervisor rejects those types of packets. This fix detects loopback packet and assures the source packet's MAC address matches the driver's MAC address before transmitting to the hypervisor. Signed-off-by: Cris Forno <cforno12@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 01db923 commit 6f22754

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎drivers/net/ethernet/ibm/ibmveth.c‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,29 @@ static int ibmveth_send(struct ibmveth_adapter *adapter,
10111011
return 0;
10121012
}
10131013

1014+
static int ibmveth_is_packet_unsupported(struct sk_buff *skb,
1015+
struct net_device *netdev)
1016+
{
1017+
struct ethhdr *ether_header;
1018+
int ret = 0;
1019+
1020+
ether_header = eth_hdr(skb);
1021+
1022+
if (ether_addr_equal(ether_header->h_dest, netdev->dev_addr)) {
1023+
netdev_dbg(netdev, "veth doesn't support loopback packets, dropping packet.\n");
1024+
netdev->stats.tx_dropped++;
1025+
ret = -EOPNOTSUPP;
1026+
}
1027+
1028+
if (!ether_addr_equal(ether_header->h_source, netdev->dev_addr)) {
1029+
netdev_dbg(netdev, "source packet MAC address does not match veth device's, dropping packet.\n");
1030+
netdev->stats.tx_dropped++;
1031+
ret = -EOPNOTSUPP;
1032+
}
1033+
1034+
return ret;
1035+
}
1036+
10141037
static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
10151038
struct net_device *netdev)
10161039
{
@@ -1022,6 +1045,9 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
10221045
dma_addr_t dma_addr;
10231046
unsigned long mss = 0;
10241047

1048+
if (ibmveth_is_packet_unsupported(skb, netdev))
1049+
goto out;
1050+
10251051
/* veth doesn't handle frag_list, so linearize the skb.
10261052
* When GRO is enabled SKB's can have frag_list.
10271053
*/

0 commit comments

Comments
 (0)