net: ieee802154: Handle limited devices with only datagram support
[sfrench/cifs-2.6.git] / net / ieee802154 / nl802154.c
index a20ac4bb48a45c761c0898c968c1393b582a593c..cd688b51d97782224fd00c175fbfbe59e348a349 100644 (file)
@@ -1417,6 +1417,11 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
                return -EINVAL;
        }
 
+       if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) {
+               NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams");
+               return -EOPNOTSUPP;
+       }
+
        request = kzalloc(sizeof(*request), GFP_KERNEL);
        if (!request)
                return -ENOMEM;
@@ -1584,6 +1589,11 @@ nl802154_send_beacons(struct sk_buff *skb, struct genl_info *info)
                return -EPERM;
        }
 
+       if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) {
+               NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams");
+               return -EOPNOTSUPP;
+       }
+
        request = kzalloc(sizeof(*request), GFP_KERNEL);
        if (!request)
                return -ENOMEM;