@@ -820,8 +820,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags,
820
820
goto nla_put_failure ;
821
821
822
822
#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
823
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
824
+ goto out ;
825
+
823
826
if (nl802154_get_llsec_params (msg , rdev , wpan_dev ) < 0 )
824
827
goto nla_put_failure ;
828
+
829
+ out :
825
830
#endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
826
831
827
832
genlmsg_end (msg , hdr );
@@ -1384,6 +1389,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb,
1384
1389
u32 changed = 0 ;
1385
1390
int ret ;
1386
1391
1392
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
1393
+ return - EOPNOTSUPP ;
1394
+
1387
1395
if (info -> attrs [NL802154_ATTR_SEC_ENABLED ]) {
1388
1396
u8 enabled ;
1389
1397
@@ -1490,6 +1498,11 @@ nl802154_dump_llsec_key(struct sk_buff *skb, struct netlink_callback *cb)
1490
1498
if (err )
1491
1499
return err ;
1492
1500
1501
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR ) {
1502
+ err = skb -> len ;
1503
+ goto out_err ;
1504
+ }
1505
+
1493
1506
if (!wpan_dev -> netdev ) {
1494
1507
err = - EINVAL ;
1495
1508
goto out_err ;
@@ -1544,7 +1557,11 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info)
1544
1557
struct ieee802154_llsec_key_id id = { };
1545
1558
u32 commands [NL802154_CMD_FRAME_NR_IDS / 32 ] = { };
1546
1559
1547
- if (nla_parse_nested_deprecated (attrs , NL802154_KEY_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_KEY ], nl802154_key_policy , info -> extack ))
1560
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
1561
+ return - EOPNOTSUPP ;
1562
+
1563
+ if (!info -> attrs [NL802154_ATTR_SEC_KEY ] ||
1564
+ nla_parse_nested_deprecated (attrs , NL802154_KEY_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_KEY ], nl802154_key_policy , info -> extack ))
1548
1565
return - EINVAL ;
1549
1566
1550
1567
if (!attrs [NL802154_KEY_ATTR_USAGE_FRAMES ] ||
@@ -1592,7 +1609,11 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info)
1592
1609
struct nlattr * attrs [NL802154_KEY_ATTR_MAX + 1 ];
1593
1610
struct ieee802154_llsec_key_id id ;
1594
1611
1595
- if (nla_parse_nested_deprecated (attrs , NL802154_KEY_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_KEY ], nl802154_key_policy , info -> extack ))
1612
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
1613
+ return - EOPNOTSUPP ;
1614
+
1615
+ if (!info -> attrs [NL802154_ATTR_SEC_KEY ] ||
1616
+ nla_parse_nested_deprecated (attrs , NL802154_KEY_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_KEY ], nl802154_key_policy , info -> extack ))
1596
1617
return - EINVAL ;
1597
1618
1598
1619
if (ieee802154_llsec_parse_key_id (attrs [NL802154_KEY_ATTR_ID ], & id ) < 0 )
@@ -1656,6 +1677,11 @@ nl802154_dump_llsec_dev(struct sk_buff *skb, struct netlink_callback *cb)
1656
1677
if (err )
1657
1678
return err ;
1658
1679
1680
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR ) {
1681
+ err = skb -> len ;
1682
+ goto out_err ;
1683
+ }
1684
+
1659
1685
if (!wpan_dev -> netdev ) {
1660
1686
err = - EINVAL ;
1661
1687
goto out_err ;
@@ -1742,6 +1768,9 @@ static int nl802154_add_llsec_dev(struct sk_buff *skb, struct genl_info *info)
1742
1768
struct wpan_dev * wpan_dev = dev -> ieee802154_ptr ;
1743
1769
struct ieee802154_llsec_device dev_desc ;
1744
1770
1771
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
1772
+ return - EOPNOTSUPP ;
1773
+
1745
1774
if (ieee802154_llsec_parse_device (info -> attrs [NL802154_ATTR_SEC_DEVICE ],
1746
1775
& dev_desc ) < 0 )
1747
1776
return - EINVAL ;
@@ -1757,7 +1786,11 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info)
1757
1786
struct nlattr * attrs [NL802154_DEV_ATTR_MAX + 1 ];
1758
1787
__le64 extended_addr ;
1759
1788
1760
- if (nla_parse_nested_deprecated (attrs , NL802154_DEV_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_DEVICE ], nl802154_dev_policy , info -> extack ))
1789
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
1790
+ return - EOPNOTSUPP ;
1791
+
1792
+ if (!info -> attrs [NL802154_ATTR_SEC_DEVICE ] ||
1793
+ nla_parse_nested_deprecated (attrs , NL802154_DEV_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_DEVICE ], nl802154_dev_policy , info -> extack ))
1761
1794
return - EINVAL ;
1762
1795
1763
1796
if (!attrs [NL802154_DEV_ATTR_EXTENDED_ADDR ])
@@ -1825,6 +1858,11 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb)
1825
1858
if (err )
1826
1859
return err ;
1827
1860
1861
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR ) {
1862
+ err = skb -> len ;
1863
+ goto out_err ;
1864
+ }
1865
+
1828
1866
if (!wpan_dev -> netdev ) {
1829
1867
err = - EINVAL ;
1830
1868
goto out_err ;
@@ -1882,6 +1920,9 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *info
1882
1920
struct ieee802154_llsec_device_key key ;
1883
1921
__le64 extended_addr ;
1884
1922
1923
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
1924
+ return - EOPNOTSUPP ;
1925
+
1885
1926
if (!info -> attrs [NL802154_ATTR_SEC_DEVKEY ] ||
1886
1927
nla_parse_nested_deprecated (attrs , NL802154_DEVKEY_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_DEVKEY ], nl802154_devkey_policy , info -> extack ) < 0 )
1887
1928
return - EINVAL ;
@@ -1913,7 +1954,11 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info
1913
1954
struct ieee802154_llsec_device_key key ;
1914
1955
__le64 extended_addr ;
1915
1956
1916
- if (nla_parse_nested_deprecated (attrs , NL802154_DEVKEY_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_DEVKEY ], nl802154_devkey_policy , info -> extack ))
1957
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
1958
+ return - EOPNOTSUPP ;
1959
+
1960
+ if (!info -> attrs [NL802154_ATTR_SEC_DEVKEY ] ||
1961
+ nla_parse_nested_deprecated (attrs , NL802154_DEVKEY_ATTR_MAX , info -> attrs [NL802154_ATTR_SEC_DEVKEY ], nl802154_devkey_policy , info -> extack ))
1917
1962
return - EINVAL ;
1918
1963
1919
1964
if (!attrs [NL802154_DEVKEY_ATTR_EXTENDED_ADDR ])
@@ -1986,6 +2031,11 @@ nl802154_dump_llsec_seclevel(struct sk_buff *skb, struct netlink_callback *cb)
1986
2031
if (err )
1987
2032
return err ;
1988
2033
2034
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR ) {
2035
+ err = skb -> len ;
2036
+ goto out_err ;
2037
+ }
2038
+
1989
2039
if (!wpan_dev -> netdev ) {
1990
2040
err = - EINVAL ;
1991
2041
goto out_err ;
@@ -2070,6 +2120,9 @@ static int nl802154_add_llsec_seclevel(struct sk_buff *skb,
2070
2120
struct wpan_dev * wpan_dev = dev -> ieee802154_ptr ;
2071
2121
struct ieee802154_llsec_seclevel sl ;
2072
2122
2123
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
2124
+ return - EOPNOTSUPP ;
2125
+
2073
2126
if (llsec_parse_seclevel (info -> attrs [NL802154_ATTR_SEC_LEVEL ],
2074
2127
& sl ) < 0 )
2075
2128
return - EINVAL ;
@@ -2085,6 +2138,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb,
2085
2138
struct wpan_dev * wpan_dev = dev -> ieee802154_ptr ;
2086
2139
struct ieee802154_llsec_seclevel sl ;
2087
2140
2141
+ if (wpan_dev -> iftype == NL802154_IFTYPE_MONITOR )
2142
+ return - EOPNOTSUPP ;
2143
+
2088
2144
if (!info -> attrs [NL802154_ATTR_SEC_LEVEL ] ||
2089
2145
llsec_parse_seclevel (info -> attrs [NL802154_ATTR_SEC_LEVEL ],
2090
2146
& sl ) < 0 )
@@ -2098,11 +2154,7 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb,
2098
2154
#define NL802154_FLAG_NEED_NETDEV 0x02
2099
2155
#define NL802154_FLAG_NEED_RTNL 0x04
2100
2156
#define NL802154_FLAG_CHECK_NETDEV_UP 0x08
2101
- #define NL802154_FLAG_NEED_NETDEV_UP (NL802154_FLAG_NEED_NETDEV |\
2102
- NL802154_FLAG_CHECK_NETDEV_UP)
2103
2157
#define NL802154_FLAG_NEED_WPAN_DEV 0x10
2104
- #define NL802154_FLAG_NEED_WPAN_DEV_UP (NL802154_FLAG_NEED_WPAN_DEV |\
2105
- NL802154_FLAG_CHECK_NETDEV_UP)
2106
2158
2107
2159
static int nl802154_pre_doit (const struct genl_ops * ops , struct sk_buff * skb ,
2108
2160
struct genl_info * info )
0 commit comments