Skip to content

Commit

Permalink
ovpn-dco: address checkpatch style complaints
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
  • Loading branch information
ordex committed Jul 19, 2022
1 parent b03e3f0 commit 4088343
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 13 deletions.
1 change: 1 addition & 0 deletions drivers/net/ovpn-dco/bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct ovpn_bind *ovpn_bind_from_sockaddr(const struct sockaddr_storage *ss)
static void ovpn_bind_release_rcu(struct rcu_head *head)
{
struct ovpn_bind *bind = container_of(head, struct ovpn_bind, rcu);

kfree(bind);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ovpn-dco/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static void ovpn_dellink(struct net_device *dev, struct list_head *head)
{
struct ovpn_struct *ovpn = netdev_priv(dev);

switch(ovpn->mode) {
switch (ovpn->mode) {
case OVPN_MODE_P2P:
ovpn_peer_release_p2p(ovpn);
break;
Expand Down
10 changes: 4 additions & 6 deletions drivers/net/ovpn-dco/netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ static int ovpn_netlink_new_peer(struct sk_buff *skb, struct genl_info *info)
struct sockaddr_storage *ss = NULL;
struct sockaddr_in mapped;
struct sockaddr_in6 *in6;
uint8_t *local_ip = NULL;
struct ovpn_peer *peer;
size_t sa_len, ip_len;
struct socket *sock;
u8 *local_ip = NULL;
u32 sockfd, id;
int ret;

Expand Down Expand Up @@ -438,7 +438,7 @@ static int ovpn_netlink_new_peer(struct sk_buff *skb, struct genl_info *info)
ip_len = nla_len(attrs[OVPN_NEW_PEER_ATTR_LOCAL_IP]);
local_ip = nla_data(attrs[OVPN_NEW_PEER_ATTR_LOCAL_IP]);

if (ip_len == sizeof(struct in_addr)){
if (ip_len == sizeof(struct in_addr)) {
if (ss->ss_family != AF_INET) {
pr_debug("%s: the specified local IP is IPv4, but the peer endpoint is not\n", __func__);
goto sockfd_release;
Expand All @@ -461,7 +461,6 @@ static int ovpn_netlink_new_peer(struct sk_buff *skb, struct genl_info *info)
pr_debug("%s: invalid length %zu for local IP\n", __func__, ip_len);
goto sockfd_release;
}

}

/* sanity checks passed */
Expand Down Expand Up @@ -714,7 +713,7 @@ static int ovpn_netlink_dump_prepare(struct netlink_callback *cb)
goto err;
}

cb->args[0] = (long int)netdev_priv(dev);
cb->args[0] = (long)netdev_priv(dev);
ret = 0;
err:
kfree(attrbuf);
Expand Down Expand Up @@ -762,7 +761,6 @@ static int ovpn_netlink_dump_peers(struct sk_buff *skb, struct netlink_callback
return skb->len;
}


static int ovpn_netlink_del_peer(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr *attrs[OVPN_SET_PEER_ATTR_MAX + 1];
Expand Down Expand Up @@ -996,7 +994,7 @@ int ovpn_netlink_notify_del_peer(struct ovpn_peer *peer)
}

int ovpn_netlink_send_packet(struct ovpn_struct *ovpn, const struct ovpn_peer *peer,
const uint8_t *buf, size_t len)
const u8 *buf, size_t len)
{
struct nlattr *attr;
struct sk_buff *msg;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ovpn-dco/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int ovpn_netlink_init(struct ovpn_struct *ovpn);
int ovpn_netlink_register(void);
void ovpn_netlink_unregister(void);
int ovpn_netlink_send_packet(struct ovpn_struct *ovpn, const struct ovpn_peer *peer,
const uint8_t *buf, size_t len);
const u8 *buf, size_t len);
int ovpn_netlink_notify_del_peer(struct ovpn_peer *peer);

#endif /* _NET_OVPN_DCO_NETLINK_H_ */
2 changes: 1 addition & 1 deletion drivers/net/ovpn-dco/ovpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev)

/* verify IP header size in network packet */
proto = ovpn_ip_check_protocol(skb);
if (unlikely(!proto || (skb->protocol != proto))) {
if (unlikely(!proto || skb->protocol != proto)) {
net_dbg_ratelimited("%s: dropping malformed payload packet\n",
dev->name);
goto drop;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ovpn-dco/peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ void ovpn_peer_float(struct ovpn_peer *peer, struct sk_buff *skb)
rcu_read_unlock();
}


static void ovpn_peer_timer_delete_all(struct ovpn_peer *peer)
{
del_timer_sync(&peer->keepalive_xmit);
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ovpn-dco/skb.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <linux/socket.h>
#include <linux/types.h>


#define OVPN_SKB_CB(skb) ((struct ovpn_skb_cb *)&((skb)->cb))

struct ovpn_skb_cb {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ovpn-dco/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static struct ovpn_socket *ovpn_socket_get(struct socket *sock)
/* Finalize release of socket, called after RCU grace period */
static int ovpn_socket_attach(struct socket *sock, struct ovpn_peer *peer)
{
int ret = -ENOTSUPP;
int ret = -EOPNOTSUPP;

if (!sock || !peer)
return -EINVAL;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ovpn-dco/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ static int ovpn_udp6_output(struct ovpn_struct *ovpn, struct ovpn_bind *bind,
.flowi6_oif = bind->sa.in6.sin6_scope_id,
};


local_bh_disable();
dst = dst_cache_get_ip6(cache, &fl.saddr);
if (dst)
Expand Down

0 comments on commit 4088343

Please sign in to comment.