summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-03-08 21:22:29 -0700
committerDavid S. Miller <davem@davemloft.net>2020-03-08 21:22:29 -0700
commit1033a215fee57a941f2620d143d2aad012e9f6bb (patch)
tree54bb67e486613dbd525297cfb46b0c8912ca394b
parent31de3f562f52ada96f3a003989fe6501609e3975 (diff)
parent2baecda37f4ef4414be15452a333fe4fd13c0df3 (diff)
Merge branch 'bareudp-several-code-cleanup-for-bareudp-module'
Taehee Yoo says: ==================== bareudp: several code cleanup for bareudp module This patchset is to cleanup bareudp module code. 1. The first patch is to add module alias In the current bareudp code, there is no module alias. So, RTNL couldn't load bareudp module automatically. 2. The second patch is to add extack message. The extack error message is useful for noticing specific errors when command is failed. 3. The third patch is to remove unnecessary udp_encap_enable(). In the bareudp_socket_create(), udp_encap_enable() is called. But, the it's already called in the setup_udp_tunnel_sock(). So, it could be removed. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bareudp.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index 15337e9d4fad..71a2f480f70e 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -250,9 +250,6 @@ static int bareudp_socket_create(struct bareudp_dev *bareudp, __be16 port)
tunnel_cfg.encap_destroy = NULL;
setup_udp_tunnel_sock(bareudp->net, sock, &tunnel_cfg);
- if (sock->sk->sk_family == AF_INET6)
- udp_encap_enable();
-
rcu_assign_pointer(bareudp->sock, sock);
return 0;
}
@@ -556,10 +553,17 @@ static int bareudp_validate(struct nlattr *tb[], struct nlattr *data[],
return 0;
}
-static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf)
+static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf,
+ struct netlink_ext_ack *extack)
{
- if (!data[IFLA_BAREUDP_PORT] || !data[IFLA_BAREUDP_ETHERTYPE])
+ if (!data[IFLA_BAREUDP_PORT]) {
+ NL_SET_ERR_MSG(extack, "port not specified");
+ return -EINVAL;
+ }
+ if (!data[IFLA_BAREUDP_ETHERTYPE]) {
+ NL_SET_ERR_MSG(extack, "ethertype not specified");
return -EINVAL;
+ }
if (data[IFLA_BAREUDP_PORT])
conf->port = nla_get_u16(data[IFLA_BAREUDP_PORT]);
@@ -635,7 +639,7 @@ static int bareudp_newlink(struct net *net, struct net_device *dev,
struct bareudp_conf conf;
int err;
- err = bareudp2info(data, &conf);
+ err = bareudp2info(data, &conf, extack);
if (err)
return err;
@@ -801,6 +805,7 @@ static void __exit bareudp_cleanup_module(void)
}
module_exit(bareudp_cleanup_module);
+MODULE_ALIAS_RTNL_LINK("bareudp");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Martin Varghese <martin.varghese@nokia.com>");
MODULE_DESCRIPTION("Interface driver for UDP encapsulated traffic");