|
12 | 12 | #include <linux/compiler.h> |
13 | 13 | #include <linux/container_of.h> |
14 | 14 | #include <linux/crc16.h> |
| 15 | +#include <linux/err.h> |
15 | 16 | #include <linux/errno.h> |
16 | 17 | #include <linux/etherdevice.h> |
17 | 18 | #include <linux/gfp.h> |
|
38 | 39 | #include <net/arp.h> |
39 | 40 | #include <net/genetlink.h> |
40 | 41 | #include <net/netlink.h> |
41 | | -#include <net/sock.h> |
42 | 42 | #include <uapi/linux/batadv_packet.h> |
43 | 43 | #include <uapi/linux/batman_adv.h> |
44 | 44 |
|
|
47 | 47 | #include "log.h" |
48 | 48 | #include "netlink.h" |
49 | 49 | #include "originator.h" |
50 | | -#include "soft-interface.h" |
51 | 50 | #include "translation-table.h" |
52 | 51 |
|
53 | 52 | static const u8 batadv_announce_mac[4] = {0x43, 0x05, 0x43, 0x05}; |
@@ -2233,25 +2232,16 @@ int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb) |
2233 | 2232 | { |
2234 | 2233 | struct batadv_hard_iface *primary_if = NULL; |
2235 | 2234 | int portid = NETLINK_CB(cb->skb).portid; |
2236 | | - struct net *net = sock_net(cb->skb->sk); |
2237 | 2235 | struct net_device *soft_iface; |
2238 | 2236 | struct batadv_hashtable *hash; |
2239 | 2237 | struct batadv_priv *bat_priv; |
2240 | 2238 | int bucket = cb->args[0]; |
2241 | 2239 | int idx = cb->args[1]; |
2242 | | - int ifindex; |
2243 | 2240 | int ret = 0; |
2244 | 2241 |
|
2245 | | - ifindex = batadv_netlink_get_ifindex(cb->nlh, |
2246 | | - BATADV_ATTR_MESH_IFINDEX); |
2247 | | - if (!ifindex) |
2248 | | - return -EINVAL; |
2249 | | - |
2250 | | - soft_iface = dev_get_by_index(net, ifindex); |
2251 | | - if (!soft_iface || !batadv_softif_is_valid(soft_iface)) { |
2252 | | - ret = -ENODEV; |
2253 | | - goto out; |
2254 | | - } |
| 2242 | + soft_iface = batadv_netlink_get_softif(cb); |
| 2243 | + if (IS_ERR(soft_iface)) |
| 2244 | + return PTR_ERR(soft_iface); |
2255 | 2245 |
|
2256 | 2246 | bat_priv = netdev_priv(soft_iface); |
2257 | 2247 | hash = bat_priv->bla.claim_hash; |
@@ -2403,25 +2393,16 @@ int batadv_bla_backbone_dump(struct sk_buff *msg, struct netlink_callback *cb) |
2403 | 2393 | { |
2404 | 2394 | struct batadv_hard_iface *primary_if = NULL; |
2405 | 2395 | int portid = NETLINK_CB(cb->skb).portid; |
2406 | | - struct net *net = sock_net(cb->skb->sk); |
2407 | 2396 | struct net_device *soft_iface; |
2408 | 2397 | struct batadv_hashtable *hash; |
2409 | 2398 | struct batadv_priv *bat_priv; |
2410 | 2399 | int bucket = cb->args[0]; |
2411 | 2400 | int idx = cb->args[1]; |
2412 | | - int ifindex; |
2413 | 2401 | int ret = 0; |
2414 | 2402 |
|
2415 | | - ifindex = batadv_netlink_get_ifindex(cb->nlh, |
2416 | | - BATADV_ATTR_MESH_IFINDEX); |
2417 | | - if (!ifindex) |
2418 | | - return -EINVAL; |
2419 | | - |
2420 | | - soft_iface = dev_get_by_index(net, ifindex); |
2421 | | - if (!soft_iface || !batadv_softif_is_valid(soft_iface)) { |
2422 | | - ret = -ENODEV; |
2423 | | - goto out; |
2424 | | - } |
| 2403 | + soft_iface = batadv_netlink_get_softif(cb); |
| 2404 | + if (IS_ERR(soft_iface)) |
| 2405 | + return PTR_ERR(soft_iface); |
2425 | 2406 |
|
2426 | 2407 | bat_priv = netdev_priv(soft_iface); |
2427 | 2408 | hash = bat_priv->bla.backbone_hash; |
|
0 commit comments