Skip to content

Commit d3fe1c2

Browse files
author
Pravin B Shelar
committed
datapath: Remove compat support for NLA_NUL_STRING
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
1 parent 053fe54 commit d3fe1c2

3 files changed

Lines changed: 0 additions & 82 deletions

File tree

acinclude.m4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
274274
OVS_GREP_IFELSE([$KSRC/include/net/checksum.h], [csum_unfold])
275275
276276
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [parallel_ops])
277-
OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [NLA_NUL_STRING])
278277
OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16])
279278
OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be16])
280279
OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be32])

datapath/compat.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,6 @@
2525
#include <net/route.h>
2626
#include <net/xfrm.h>
2727

28-
29-
#ifndef HAVE_NLA_NUL_STRING
30-
static inline int CHECK_NUL_STRING(struct nlattr *attr, int maxlen)
31-
{
32-
char *s;
33-
int len;
34-
if (!attr)
35-
return 0;
36-
37-
len = nla_len(attr);
38-
if (len >= maxlen)
39-
return -EINVAL;
40-
41-
s = nla_data(attr);
42-
if (s[len - 1] != '\0')
43-
return -EINVAL;
44-
45-
return 0;
46-
}
47-
#else
48-
static inline int CHECK_NUL_STRING(struct nlattr *attr, int maxlen)
49-
{
50-
return 0;
51-
}
52-
#endif /* !HAVE_NLA_NUL_STRING */
53-
5428
static inline void skb_clear_rxhash(struct sk_buff *skb)
5529
{
5630
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)

datapath/datapath.c

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -947,11 +947,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
947947
}
948948

949949
static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
950-
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
951950
[OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN },
952-
#else
953-
[OVS_PACKET_ATTR_PACKET] = { .minlen = ETH_HLEN },
954-
#endif
955951
[OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
956952
[OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
957953
};
@@ -1571,9 +1567,7 @@ static struct genl_ops dp_flow_genl_ops[] = {
15711567
};
15721568

15731569
static const struct nla_policy datapath_policy[OVS_DP_ATTR_MAX + 1] = {
1574-
#ifdef HAVE_NLA_NUL_STRING
15751570
[OVS_DP_ATTR_NAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
1576-
#endif
15771571
[OVS_DP_ATTR_UPCALL_PID] = { .type = NLA_U32 },
15781572
};
15791573

@@ -1651,11 +1645,6 @@ static struct sk_buff *ovs_dp_cmd_build_info(struct datapath *dp, u32 portid,
16511645
return skb;
16521646
}
16531647

1654-
static int ovs_dp_cmd_validate(struct nlattr *a[OVS_DP_ATTR_MAX + 1])
1655-
{
1656-
return CHECK_NUL_STRING(a[OVS_DP_ATTR_NAME], IFNAMSIZ - 1);
1657-
}
1658-
16591648
/* Called with ovs_mutex. */
16601649
static struct datapath *lookup_datapath(struct net *net,
16611650
struct ovs_header *ovs_header,
@@ -1690,10 +1679,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
16901679
if (!a[OVS_DP_ATTR_NAME] || !a[OVS_DP_ATTR_UPCALL_PID])
16911680
goto err;
16921681

1693-
err = ovs_dp_cmd_validate(a);
1694-
if (err)
1695-
goto err;
1696-
16971682
ovs_lock();
16981683

16991684
err = -ENOMEM;
@@ -1803,10 +1788,6 @@ static int ovs_dp_cmd_del(struct sk_buff *skb, struct genl_info *info)
18031788
struct datapath *dp;
18041789
int err;
18051790

1806-
err = ovs_dp_cmd_validate(info->attrs);
1807-
if (err)
1808-
return err;
1809-
18101791
ovs_lock();
18111792
dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs);
18121793
err = PTR_ERR(dp);
@@ -1836,10 +1817,6 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
18361817
struct datapath *dp;
18371818
int err;
18381819

1839-
err = ovs_dp_cmd_validate(info->attrs);
1840-
if (err)
1841-
return err;
1842-
18431820
ovs_lock();
18441821
dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs);
18451822
err = PTR_ERR(dp);
@@ -1871,10 +1848,6 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
18711848
struct datapath *dp;
18721849
int err;
18731850

1874-
err = ovs_dp_cmd_validate(info->attrs);
1875-
if (err)
1876-
return err;
1877-
18781851
ovs_lock();
18791852
dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs);
18801853
if (IS_ERR(dp)) {
@@ -1945,12 +1918,8 @@ static struct genl_ops dp_datapath_genl_ops[] = {
19451918
};
19461919

19471920
static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
1948-
#ifdef HAVE_NLA_NUL_STRING
19491921
[OVS_VPORT_ATTR_NAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
19501922
[OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct ovs_vport_stats) },
1951-
#else
1952-
[OVS_VPORT_ATTR_STATS] = { .minlen = sizeof(struct ovs_vport_stats) },
1953-
#endif
19541923
[OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
19551924
[OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
19561925
[OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_U32 },
@@ -2027,11 +1996,6 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid,
20271996
return skb;
20281997
}
20291998

2030-
static int ovs_vport_cmd_validate(struct nlattr *a[OVS_VPORT_ATTR_MAX + 1])
2031-
{
2032-
return CHECK_NUL_STRING(a[OVS_VPORT_ATTR_NAME], IFNAMSIZ - 1);
2033-
}
2034-
20351999
/* Called with ovs_mutex or RCU read lock. */
20362000
static struct vport *lookup_vport(struct net *net,
20372001
struct ovs_header *ovs_header,
@@ -2082,10 +2046,6 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
20822046
!a[OVS_VPORT_ATTR_UPCALL_PID])
20832047
goto exit;
20842048

2085-
err = ovs_vport_cmd_validate(a);
2086-
if (err)
2087-
goto exit;
2088-
20892049
ovs_lock();
20902050
dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex);
20912051
err = -ENODEV;
@@ -2154,10 +2114,6 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
21542114
struct vport *vport;
21552115
int err;
21562116

2157-
err = ovs_vport_cmd_validate(a);
2158-
if (err)
2159-
goto exit;
2160-
21612117
ovs_lock();
21622118
vport = lookup_vport(sock_net(skb->sk), info->userhdr, a);
21632119
err = PTR_ERR(vport);
@@ -2200,7 +2156,6 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
22002156
kfree_skb(reply);
22012157
exit_unlock:
22022158
ovs_unlock();
2203-
exit:
22042159
return err;
22052160
}
22062161

@@ -2211,10 +2166,6 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
22112166
struct vport *vport;
22122167
int err;
22132168

2214-
err = ovs_vport_cmd_validate(a);
2215-
if (err)
2216-
goto exit;
2217-
22182169
ovs_lock();
22192170
vport = lookup_vport(sock_net(skb->sk), info->userhdr, a);
22202171
err = PTR_ERR(vport);
@@ -2239,7 +2190,6 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
22392190

22402191
exit_unlock:
22412192
ovs_unlock();
2242-
exit:
22432193
return err;
22442194
}
22452195

@@ -2251,10 +2201,6 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
22512201
struct vport *vport;
22522202
int err;
22532203

2254-
err = ovs_vport_cmd_validate(a);
2255-
if (err)
2256-
goto exit;
2257-
22582204
rcu_read_lock();
22592205
vport = lookup_vport(sock_net(skb->sk), ovs_header, a);
22602206
err = PTR_ERR(vport);
@@ -2273,7 +2219,6 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
22732219

22742220
exit_unlock:
22752221
rcu_read_unlock();
2276-
exit:
22772222
return err;
22782223
}
22792224

0 commit comments

Comments
 (0)