Skip to content

Commit

Permalink
scsi: libcxgbi: return error if interface is not up
Browse files Browse the repository at this point in the history
Do not post hw active open cmd if IFF_UP is not set or link is down on
the interface, return -ENETDOWN in this case.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Varun Prakash authored and martinkpetersen committed Dec 14, 2016
1 parent 1fe1fdb commit 165ae50
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/scsi/cxgbi/libcxgbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,12 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
n->dev->name, ndev->name, mtu);
}

if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
pr_info("%s interface not up.\n", ndev->name);
err = -ENETDOWN;
goto rel_neigh;
}

cdev = cxgbi_device_find_by_netdev(ndev, &port);
if (!cdev) {
pr_info("dst %pI4, %s, NOT cxgbi device.\n",
Expand Down Expand Up @@ -736,6 +742,12 @@ static struct cxgbi_sock *cxgbi_check_route6(struct sockaddr *dst_addr)
}
ndev = n->dev;

if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
pr_info("%s interface not up.\n", ndev->name);
err = -ENETDOWN;
goto rel_rt;
}

if (ipv6_addr_is_multicast(&daddr6->sin6_addr)) {
pr_info("multi-cast route %pI6 port %u, dev %s.\n",
daddr6->sin6_addr.s6_addr,
Expand Down

0 comments on commit 165ae50

Please sign in to comment.