* [PATCH net-next 0/2] neigh get support
@ 2018-12-19 16:27 Roopa Prabhu
2018-12-19 16:27 ` [PATCH net-next 1/2] neighbour: register rtnl doit handler Roopa Prabhu
2018-12-19 16:27 ` [PATCH net-next 2/2] selftests: rtnetlink.sh: add testcase for neigh get Roopa Prabhu
0 siblings, 2 replies; 7+ messages in thread
From: Roopa Prabhu @ 2018-12-19 16:27 UTC (permalink / raw)
To: davem; +Cc: netdev, dsa
From: Roopa Prabhu <roopa@cumulusnetworks.com>
This series adds support for neigh get similar
to route and recently added fdb get.
Roopa Prabhu (2):
neighbour: register rtnl doit handler
selftests: rtnetlink.sh: add testcase for neigh get
net/core/neighbour.c | 200 +++++++++++++++++++++++++++++--
tools/testing/selftests/net/rtnetlink.sh | 54 +++++++++
2 files changed, 243 insertions(+), 11 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/2] neighbour: register rtnl doit handler
2018-12-19 16:27 [PATCH net-next 0/2] neigh get support Roopa Prabhu
@ 2018-12-19 16:27 ` Roopa Prabhu
2018-12-19 16:39 ` David Ahern
2018-12-19 16:27 ` [PATCH net-next 2/2] selftests: rtnetlink.sh: add testcase for neigh get Roopa Prabhu
1 sibling, 1 reply; 7+ messages in thread
From: Roopa Prabhu @ 2018-12-19 16:27 UTC (permalink / raw)
To: davem; +Cc: netdev, dsa
From: Roopa Prabhu <roopa@cumulusnetworks.com>
this patch registers neigh doit handler. The doit handler
returns a neigh entry given dst and dev. This is similar
to route and fdb doit (get) handlers. Also moves nda_policy
declaration from rtnetlink.c to neighbour.c
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
include/net/neighbour.h | 1 +
net/core/neighbour.c | 199 +++++++++++++++++++++++++++++++++++++++++++++---
net/core/rtnetlink.c | 12 ---
3 files changed, 189 insertions(+), 23 deletions(-)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 66221f1..7c1ab9e 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -255,6 +255,7 @@ static inline void *neighbour_priv(const struct neighbour *n)
#define NEIGH_UPDATE_F_ISROUTER 0x40000000
#define NEIGH_UPDATE_F_ADMIN 0x80000000
+extern const struct nla_policy nda_policy[];
static inline bool neigh_key_eq16(const struct neighbour *n, const void *pkey)
{
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index fb4372c..3642852 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1751,6 +1751,18 @@ static struct neigh_table *neigh_find_table(int family)
return tbl;
}
+const struct nla_policy nda_policy[NDA_MAX+1] = {
+ [NDA_DST] = { .type = NLA_BINARY, .len = MAX_ADDR_LEN },
+ [NDA_LLADDR] = { .type = NLA_BINARY, .len = MAX_ADDR_LEN },
+ [NDA_CACHEINFO] = { .len = sizeof(struct nda_cacheinfo) },
+ [NDA_PROBES] = { .type = NLA_U32 },
+ [NDA_VLAN] = { .type = NLA_U16 },
+ [NDA_PORT] = { .type = NLA_U16 },
+ [NDA_VNI] = { .type = NLA_U32 },
+ [NDA_IFINDEX] = { .type = NLA_U32 },
+ [NDA_MASTER] = { .type = NLA_U32 },
+};
+
static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh,
struct netlink_ext_ack *extack)
{
@@ -2711,6 +2723,181 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
return skb->len;
}
+static int neigh_valid_get_req(const struct nlmsghdr *nlh,
+ struct neigh_table **tbl,
+ void **dst, int *dev_idx, u8 *ndm_flags,
+ struct netlink_ext_ack *extack)
+{
+ struct nlattr *tb[NDA_MAX + 1];
+ struct ndmsg *ndm;
+ int err, i;
+
+ if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ndm))) {
+ NL_SET_ERR_MSG(extack, "Invalid header for neighbor get request");
+ return -EINVAL;
+ }
+
+ ndm = nlmsg_data(nlh);
+ if (ndm->ndm_pad1 || ndm->ndm_pad2 || ndm->ndm_state ||
+ ndm->ndm_type) {
+ NL_SET_ERR_MSG(extack, "Invalid values in header for neighbor get request");
+ return -EINVAL;
+ }
+
+ if (ndm->ndm_flags & ~NTF_PROXY) {
+ NL_SET_ERR_MSG(extack, "Invalid flags in header for neighbor get request");
+ return -EINVAL;
+ }
+
+ err = nlmsg_parse_strict(nlh, sizeof(struct ndmsg), tb, NDA_MAX,
+ nda_policy, extack);
+ if (err < 0)
+ return err;
+
+ *ndm_flags = ndm->ndm_flags;
+ *dev_idx = ndm->ndm_ifindex;
+ *tbl = neigh_find_table(ndm->ndm_family);
+ if (*tbl == NULL) {
+ NL_SET_ERR_MSG(extack, "Unsupported family in header for neighbor get request");
+ return -EAFNOSUPPORT;
+ }
+
+ for (i = 0; i <= NDA_MAX; ++i) {
+ if (!tb[i])
+ continue;
+
+ switch (i) {
+ case NDA_DST:
+ if (nla_len(tb[NDA_DST]) < (int)(*tbl)->key_len) {
+ NL_SET_ERR_MSG(extack, "Invalid NDA_DST attribute in neighbor get request");
+ return -EINVAL;
+ }
+ *dst = nla_data(tb[NDA_DST]);
+ break;
+ default:
+ NL_SET_ERR_MSG(extack, "Unsupported attribute in neighbor get request");
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+}
+
+static inline size_t neigh_nlmsg_size(void)
+{
+ return NLMSG_ALIGN(sizeof(struct ndmsg))
+ + nla_total_size(MAX_ADDR_LEN) /* NDA_DST */
+ + nla_total_size(MAX_ADDR_LEN) /* NDA_LLADDR */
+ + nla_total_size(sizeof(struct nda_cacheinfo))
+ + nla_total_size(4) /* NDA_PROBES */
+ + nla_total_size(1); /* NDA_PROTOCOL */
+}
+
+static int neigh_get_reply(struct net *net, struct neighbour *neigh,
+ u32 pid, u32 seq)
+{
+ struct sk_buff *skb;
+ int err = 0;
+
+ skb = nlmsg_new(neigh_nlmsg_size(), GFP_KERNEL);
+ if (!skb)
+ return -ENOBUFS;
+
+ err = neigh_fill_info(skb, neigh, pid, seq, RTM_NEWNEIGH, 0);
+ if (err) {
+ kfree_skb(skb);
+ goto errout;
+ }
+
+ err = rtnl_unicast(skb, net, pid);
+errout:
+ return err;
+}
+
+static inline size_t pneigh_nlmsg_size(void)
+{
+ return NLMSG_ALIGN(sizeof(struct ndmsg))
+ + nla_total_size(MAX_ADDR_LEN); /* NDA_DST */
+ + nla_total_size(1); /* NDA_PROTOCOL */
+}
+
+static int pneigh_get_reply(struct net *net, struct pneigh_entry *neigh,
+ u32 pid, u32 seq, struct neigh_table *tbl)
+{
+ struct sk_buff *skb;
+ int err = 0;
+
+ skb = nlmsg_new(pneigh_nlmsg_size(), GFP_KERNEL);
+ if (!skb)
+ return -ENOBUFS;
+
+ err = pneigh_fill_info(skb, neigh, pid, seq, RTM_NEWNEIGH, 0, tbl);
+ if (err) {
+ kfree_skb(skb);
+ goto errout;
+ }
+
+ err = rtnl_unicast(skb, net, pid);
+errout:
+ return err;
+}
+
+static int neigh_get(struct sk_buff *in_skb, struct nlmsghdr *nlh,
+ struct netlink_ext_ack *extack)
+{
+ struct net *net = sock_net(in_skb->sk);
+ struct net_device *dev = NULL;
+ struct neigh_table *tbl = NULL;
+ struct neighbour *neigh;
+ void *dst = NULL;
+ u8 ndm_flags = 0;
+ int dev_idx = 0;
+ int err;
+
+ err = neigh_valid_get_req(nlh, &tbl, &dst, &dev_idx, &ndm_flags,
+ extack);
+ if (err < 0)
+ return err;
+
+ if (dev_idx) {
+ dev = __dev_get_by_index(net, dev_idx);
+ if (!dev) {
+ NL_SET_ERR_MSG(extack, "Unknown device ifindex");
+ return -ENODEV;
+ }
+ }
+
+ if (ndm_flags & NTF_PROXY) {
+ struct pneigh_entry *pn;
+
+ pn = pneigh_lookup(tbl, net, dst, dev, 0);
+ if (!pn) {
+ NL_SET_ERR_MSG(extack, "Proxy neighbour entry not found");
+ return -ENOENT;
+ }
+ return pneigh_get_reply(net, pn, NETLINK_CB(in_skb).portid,
+ nlh->nlmsg_seq, tbl);
+ }
+
+ if (!dev) {
+ NL_SET_ERR_MSG(extack, "No Device specified");
+ return -ENODEV;
+ }
+
+ neigh = neigh_lookup(tbl, dst, dev);
+ if (!neigh) {
+ NL_SET_ERR_MSG(extack, "Neighbour entry not found");
+ return -ENOENT;
+ }
+
+ err = neigh_get_reply(net, neigh, NETLINK_CB(in_skb).portid,
+ nlh->nlmsg_seq);
+
+ neigh_release(neigh);
+
+ return err;
+}
+
void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie)
{
int chain;
@@ -3118,16 +3305,6 @@ static const struct seq_operations neigh_stat_seq_ops = {
};
#endif /* CONFIG_PROC_FS */
-static inline size_t neigh_nlmsg_size(void)
-{
- return NLMSG_ALIGN(sizeof(struct ndmsg))
- + nla_total_size(MAX_ADDR_LEN) /* NDA_DST */
- + nla_total_size(MAX_ADDR_LEN) /* NDA_LLADDR */
- + nla_total_size(sizeof(struct nda_cacheinfo))
- + nla_total_size(4) /* NDA_PROBES */
- + nla_total_size(1); /* NDA_PROTOCOL */
-}
-
static void __neigh_notify(struct neighbour *n, int type, int flags,
u32 pid)
{
@@ -3511,7 +3688,7 @@ static int __init neigh_init(void)
{
rtnl_register(PF_UNSPEC, RTM_NEWNEIGH, neigh_add, NULL, 0);
rtnl_register(PF_UNSPEC, RTM_DELNEIGH, neigh_delete, NULL, 0);
- rtnl_register(PF_UNSPEC, RTM_GETNEIGH, NULL, neigh_dump_info, 0);
+ rtnl_register(PF_UNSPEC, RTM_GETNEIGH, neigh_get, neigh_dump_info, 0);
rtnl_register(PF_UNSPEC, RTM_GETNEIGHTBL, NULL, neightbl_dump_info,
0);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index baf2685..48f6188 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3460,18 +3460,6 @@ void rtmsg_ifinfo_newnet(int type, struct net_device *dev, unsigned int change,
new_nsid, new_ifindex);
}
-static const struct nla_policy nda_policy[NDA_MAX+1] = {
- [NDA_DST] = { .type = NLA_BINARY, .len = MAX_ADDR_LEN },
- [NDA_LLADDR] = { .type = NLA_BINARY, .len = MAX_ADDR_LEN },
- [NDA_CACHEINFO] = { .len = sizeof(struct nda_cacheinfo) },
- [NDA_PROBES] = { .type = NLA_U32 },
- [NDA_VLAN] = { .type = NLA_U16 },
- [NDA_PORT] = { .type = NLA_U16 },
- [NDA_VNI] = { .type = NLA_U32 },
- [NDA_IFINDEX] = { .type = NLA_U32 },
- [NDA_MASTER] = { .type = NLA_U32 },
-};
-
static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
struct net_device *dev,
u8 *addr, u16 vid, u32 pid, u32 seq,
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/2] selftests: rtnetlink.sh: add testcase for neigh get
2018-12-19 16:27 [PATCH net-next 0/2] neigh get support Roopa Prabhu
2018-12-19 16:27 ` [PATCH net-next 1/2] neighbour: register rtnl doit handler Roopa Prabhu
@ 2018-12-19 16:27 ` Roopa Prabhu
2018-12-19 16:41 ` David Ahern
1 sibling, 1 reply; 7+ messages in thread
From: Roopa Prabhu @ 2018-12-19 16:27 UTC (permalink / raw)
To: davem; +Cc: netdev, dsa
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
tools/testing/selftests/net/rtnetlink.sh | 54 ++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index bb3436f..7f9b4e2 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -1007,6 +1007,59 @@ kci_test_fdb_get()
echo "PASS: bridge fdb get"
}
+kci_test_neigh_get()
+{
+ dstmac=de:ad:be:ef:13:37
+ dstip=10.0.2.4
+ dstip6=dead::2
+ ret=0
+
+ ip neigh help 2>&1 |grep -q 'ip neigh get'
+ if [ $? -ne 0 ];then
+ echo "SKIP: fdb get tests: iproute2 too old"
+ return $ksft_skip
+ fi
+
+ # ipv4
+ ip neigh add $dstip lladdr $dstmac dev "$devdummy" > /dev/null
+ check_err $?
+ ip neigh get $dstip dev "$devdummy" 2> /dev/null | grep -q "$dstmac"
+ check_err $?
+ ip neigh del $dstip lladdr $dstmac dev "$devdummy" > /dev/null
+ check_err $?
+
+ # ipv4 proxy
+ ip neigh add proxy $dstip dev "$devdummy" > /dev/null
+ check_err $?
+ ip neigh get proxy $dstip dev "$devdummy" 2>/dev/null | grep -q "$dstip"
+ check_err $?
+ ip neigh del proxy $dstip dev "$devdummy" > /dev/null
+ check_err $?
+
+ # ipv6
+ ip neigh add $dstip6 lladdr $dstmac dev "$devdummy" > /dev/null
+ check_err $?
+ ip neigh get $dstip6 dev "$devdummy" 2> /dev/null | grep -q "$dstmac"
+ check_err $?
+ ip neigh del $dstip6 lladdr $dstmac dev "$devdummy" > /dev/null
+ check_err $?
+
+ # ipv6 proxy
+ ip neigh add proxy $dstip6 dev "$devdummy" > /dev/null
+ check_err $?
+ ip neigh get proxy $dstip6 dev "$devdummy" 2>/dev/null | grep -q "$dstip6"
+ check_err $?
+ ip neigh del proxy $dstip6 dev "$devdummy" > /dev/null
+ check_err $?
+
+ if [ $ret -ne 0 ];then
+ echo "FAIL: neigh get"
+ return 1
+ fi
+
+ echo "PASS: neigh get"
+}
+
kci_test_rtnl()
{
kci_add_dummy
@@ -1032,6 +1085,7 @@ kci_test_rtnl()
kci_test_ipsec
kci_test_ipsec_offload
kci_test_fdb_get
+ kci_test_neigh_get
kci_del_dummy
}
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 1/2] neighbour: register rtnl doit handler
2018-12-19 16:27 ` [PATCH net-next 1/2] neighbour: register rtnl doit handler Roopa Prabhu
@ 2018-12-19 16:39 ` David Ahern
2018-12-19 19:24 ` Roopa Prabhu
0 siblings, 1 reply; 7+ messages in thread
From: David Ahern @ 2018-12-19 16:39 UTC (permalink / raw)
To: Roopa Prabhu, davem; +Cc: netdev
On 12/19/18 9:27 AM, Roopa Prabhu wrote:
> + for (i = 0; i <= NDA_MAX; ++i) {
> + if (!tb[i])
> + continue;
> +
> + switch (i) {
> + case NDA_DST:
> + if (nla_len(tb[NDA_DST]) < (int)(*tbl)->key_len) {
that should != instead of <; the address should be exactly the number of
bytes for the address family.
...
> + if (ndm_flags & NTF_PROXY) {
> + struct pneigh_entry *pn;
> +
> + pn = pneigh_lookup(tbl, net, dst, dev, 0);
> + if (!pn) {
> + NL_SET_ERR_MSG(extack, "Proxy neighbour entry not found");
> + return -ENOENT;
> + }
> + return pneigh_get_reply(net, pn, NETLINK_CB(in_skb).portid,
> + nlh->nlmsg_seq, tbl);
> + }
> +
> + if (!dev) {
> + NL_SET_ERR_MSG(extack, "No Device specified");
"No device ..."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/2] selftests: rtnetlink.sh: add testcase for neigh get
2018-12-19 16:27 ` [PATCH net-next 2/2] selftests: rtnetlink.sh: add testcase for neigh get Roopa Prabhu
@ 2018-12-19 16:41 ` David Ahern
2018-12-19 18:26 ` Roopa Prabhu
0 siblings, 1 reply; 7+ messages in thread
From: David Ahern @ 2018-12-19 16:41 UTC (permalink / raw)
To: Roopa Prabhu, davem; +Cc: netdev
On 12/19/18 9:27 AM, Roopa Prabhu wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> tools/testing/selftests/net/rtnetlink.sh | 54 ++++++++++++++++++++++++++++++++
> 1 file changed, 54 insertions(+)
>
> diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
> index bb3436f..7f9b4e2 100755
> --- a/tools/testing/selftests/net/rtnetlink.sh
> +++ b/tools/testing/selftests/net/rtnetlink.sh
> @@ -1007,6 +1007,59 @@ kci_test_fdb_get()
> echo "PASS: bridge fdb get"
> }
>
> +kci_test_neigh_get()
> +{
> + dstmac=de:ad:be:ef:13:37
> + dstip=10.0.2.4
> + dstip6=dead::2
> + ret=0
> +
> + ip neigh help 2>&1 |grep -q 'ip neigh get'
> + if [ $? -ne 0 ];then
> + echo "SKIP: fdb get tests: iproute2 too old"
> + return $ksft_skip
> + fi
> +
> + # ipv4
> + ip neigh add $dstip lladdr $dstmac dev "$devdummy" > /dev/null
> + check_err $?
> + ip neigh get $dstip dev "$devdummy" 2> /dev/null | grep -q "$dstmac"
> + check_err $?
> + ip neigh del $dstip lladdr $dstmac dev "$devdummy" > /dev/null
> + check_err $?
> +
> + # ipv4 proxy
> + ip neigh add proxy $dstip dev "$devdummy" > /dev/null
> + check_err $?
> + ip neigh get proxy $dstip dev "$devdummy" 2>/dev/null | grep -q "$dstip"
> + check_err $?
> + ip neigh del proxy $dstip dev "$devdummy" > /dev/null
> + check_err $?
> +
> + # ipv6
> + ip neigh add $dstip6 lladdr $dstmac dev "$devdummy" > /dev/null
> + check_err $?
> + ip neigh get $dstip6 dev "$devdummy" 2> /dev/null | grep -q "$dstmac"
> + check_err $?
> + ip neigh del $dstip6 lladdr $dstmac dev "$devdummy" > /dev/null
> + check_err $?
> +
> + # ipv6 proxy
> + ip neigh add proxy $dstip6 dev "$devdummy" > /dev/null
> + check_err $?
> + ip neigh get proxy $dstip6 dev "$devdummy" 2>/dev/null | grep -q "$dstip6"
> + check_err $?
> + ip neigh del proxy $dstip6 dev "$devdummy" > /dev/null
> + check_err $?
This is an odd quirk to this test script. The test is for neigh get so
the ret should only be for the 'ip neigh get'; the rest of the commands
can be run with set -e ... set +e.
> +
> + if [ $ret -ne 0 ];then
> + echo "FAIL: neigh get"
> + return 1
> + fi
> +
> + echo "PASS: neigh get"
> +}
> +
> kci_test_rtnl()
> {
> kci_add_dummy
> @@ -1032,6 +1085,7 @@ kci_test_rtnl()
> kci_test_ipsec
> kci_test_ipsec_offload
> kci_test_fdb_get
> + kci_test_neigh_get
spaces instead of tab
>
> kci_del_dummy
> }
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/2] selftests: rtnetlink.sh: add testcase for neigh get
2018-12-19 16:41 ` David Ahern
@ 2018-12-19 18:26 ` Roopa Prabhu
0 siblings, 0 replies; 7+ messages in thread
From: Roopa Prabhu @ 2018-12-19 18:26 UTC (permalink / raw)
To: David Ahern; +Cc: David Miller, netdev
On Wed, Dec 19, 2018 at 8:41 AM David Ahern <dsa@cumulusnetworks.com> wrote:
>
> On 12/19/18 9:27 AM, Roopa Prabhu wrote:
> > From: Roopa Prabhu <roopa@cumulusnetworks.com>
> >
> > Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> > ---
> > tools/testing/selftests/net/rtnetlink.sh | 54 ++++++++++++++++++++++++++++++++
> > 1 file changed, 54 insertions(+)
> >
> > diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
> > index bb3436f..7f9b4e2 100755
> > --- a/tools/testing/selftests/net/rtnetlink.sh
> > +++ b/tools/testing/selftests/net/rtnetlink.sh
> > @@ -1007,6 +1007,59 @@ kci_test_fdb_get()
> > echo "PASS: bridge fdb get"
> > }
> >
> > +kci_test_neigh_get()
> > +{
> > + dstmac=de:ad:be:ef:13:37
> > + dstip=10.0.2.4
> > + dstip6=dead::2
> > + ret=0
> > +
> > + ip neigh help 2>&1 |grep -q 'ip neigh get'
> > + if [ $? -ne 0 ];then
> > + echo "SKIP: fdb get tests: iproute2 too old"
> > + return $ksft_skip
> > + fi
> > +
> > + # ipv4
> > + ip neigh add $dstip lladdr $dstmac dev "$devdummy" > /dev/null
> > + check_err $?
> > + ip neigh get $dstip dev "$devdummy" 2> /dev/null | grep -q "$dstmac"
> > + check_err $?
> > + ip neigh del $dstip lladdr $dstmac dev "$devdummy" > /dev/null
> > + check_err $?
> > +
> > + # ipv4 proxy
> > + ip neigh add proxy $dstip dev "$devdummy" > /dev/null
> > + check_err $?
> > + ip neigh get proxy $dstip dev "$devdummy" 2>/dev/null | grep -q "$dstip"
> > + check_err $?
> > + ip neigh del proxy $dstip dev "$devdummy" > /dev/null
> > + check_err $?
> > +
> > + # ipv6
> > + ip neigh add $dstip6 lladdr $dstmac dev "$devdummy" > /dev/null
> > + check_err $?
> > + ip neigh get $dstip6 dev "$devdummy" 2> /dev/null | grep -q "$dstmac"
> > + check_err $?
> > + ip neigh del $dstip6 lladdr $dstmac dev "$devdummy" > /dev/null
> > + check_err $?
> > +
> > + # ipv6 proxy
> > + ip neigh add proxy $dstip6 dev "$devdummy" > /dev/null
> > + check_err $?
> > + ip neigh get proxy $dstip6 dev "$devdummy" 2>/dev/null | grep -q "$dstip6"
> > + check_err $?
> > + ip neigh del proxy $dstip6 dev "$devdummy" > /dev/null
> > + check_err $?
>
> This is an odd quirk to this test script. The test is for neigh get so
> the ret should only be for the 'ip neigh get'; the rest of the commands
> can be run with set -e ... set +e.
yes, this is true with all the testcases in this file. In general
this test file needs some catching up with the latest test infra.
eg check_err is not consistent with the rest of the newer tests. Plus
we should move all the tests in this file to use netns.
I am thinking of keeping this as is to be consistent with the rest of
the testcases in this file and address this in a future upgrade to all
tests.
>
> > +
> > + if [ $ret -ne 0 ];then
> > + echo "FAIL: neigh get"
> > + return 1
> > + fi
> > +
> > + echo "PASS: neigh get"
> > +}
> > +
> > kci_test_rtnl()
> > {
> > kci_add_dummy
> > @@ -1032,6 +1085,7 @@ kci_test_rtnl()
> > kci_test_ipsec
> > kci_test_ipsec_offload
> > kci_test_fdb_get
> > + kci_test_neigh_get
>
> spaces instead of tab
will fix.
>
> >
> > kci_del_dummy
> > }
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 1/2] neighbour: register rtnl doit handler
2018-12-19 16:39 ` David Ahern
@ 2018-12-19 19:24 ` Roopa Prabhu
0 siblings, 0 replies; 7+ messages in thread
From: Roopa Prabhu @ 2018-12-19 19:24 UTC (permalink / raw)
To: David Ahern; +Cc: David Miller, netdev
On Wed, Dec 19, 2018 at 8:39 AM David Ahern <dsa@cumulusnetworks.com> wrote:
>
> On 12/19/18 9:27 AM, Roopa Prabhu wrote:
> > + for (i = 0; i <= NDA_MAX; ++i) {
> > + if (!tb[i])
> > + continue;
> > +
> > + switch (i) {
> > + case NDA_DST:
> > + if (nla_len(tb[NDA_DST]) < (int)(*tbl)->key_len) {
>
> that should != instead of <; the address should be exactly the number of
> bytes for the address family.
>
picked this up from neigh_add. But agree on != check.
> ...
>
> > + if (ndm_flags & NTF_PROXY) {
> > + struct pneigh_entry *pn;
> > +
> > + pn = pneigh_lookup(tbl, net, dst, dev, 0);
> > + if (!pn) {
> > + NL_SET_ERR_MSG(extack, "Proxy neighbour entry not found");
> > + return -ENOENT;
> > + }
> > + return pneigh_get_reply(net, pn, NETLINK_CB(in_skb).portid,
> > + nlh->nlmsg_seq, tbl);
> > + }
> > +
> > + if (!dev) {
> > + NL_SET_ERR_MSG(extack, "No Device specified");
>
> "No device ..."
>
ack
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-12-19 19:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19 16:27 [PATCH net-next 0/2] neigh get support Roopa Prabhu
2018-12-19 16:27 ` [PATCH net-next 1/2] neighbour: register rtnl doit handler Roopa Prabhu
2018-12-19 16:39 ` David Ahern
2018-12-19 19:24 ` Roopa Prabhu
2018-12-19 16:27 ` [PATCH net-next 2/2] selftests: rtnetlink.sh: add testcase for neigh get Roopa Prabhu
2018-12-19 16:41 ` David Ahern
2018-12-19 18:26 ` Roopa Prabhu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).