DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap
@ 2023-03-03 13:56 Martzki
  2023-03-05 17:16 ` Stephen Hemminger
  2023-03-06 15:32 ` [PATCH v2] lib/bpf: Rename bpf function names " Martzki
  0 siblings, 2 replies; 17+ messages in thread
From: Martzki @ 2023-03-03 13:56 UTC (permalink / raw)
  To: dev; +Cc: Martzki, Konstantin Ananyev

The library libpcap has their function 'bpf_validate' either so
there would be a multiple definition issue when linking with
librte_bpf.a and libpcap.a staticly.

You can reproduce this issue by 'meson build -Dprefer_static=true
-Denable_apps=test-pmd -Denable_drivers=net/af_xdp,net/af_packet'.
Notice you need to have a static version of libpcap to reproduce this.

In 2019 there was a patch reported the same issue but not applied:
https://inbox.dpdk.org/stable/2601191342CEEE43887BDE71AB9772580148A95BE2@irsmsx105.ger.corp.intel.com/T

Since 'bpf_validate' is an internal function, I think adding an 'rte'
prefix is not a good idea and rename it to 'bpf_do_validate' instead.

Signed-off-by: Martzki <mars14850@gmail.com>
---
 lib/bpf/bpf_impl.h     | 2 +-
 lib/bpf/bpf_load.c     | 2 +-
 lib/bpf/bpf_validate.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index b4d8e87c6d..a0a1fbab24 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -17,7 +17,7 @@ struct rte_bpf {
 	uint32_t stack_sz;
 };
 
-extern int bpf_validate(struct rte_bpf *bpf);
+extern int bpf_do_validate(struct rte_bpf *bpf);
 
 extern int bpf_jit(struct rte_bpf *bpf);
 
diff --git a/lib/bpf/bpf_load.c b/lib/bpf/bpf_load.c
index 1e17df6ce0..b2591d39fa 100644
--- a/lib/bpf/bpf_load.c
+++ b/lib/bpf/bpf_load.c
@@ -108,7 +108,7 @@ rte_bpf_load(const struct rte_bpf_prm *prm)
 		return NULL;
 	}
 
-	rc = bpf_validate(bpf);
+	rc = bpf_do_validate(bpf);
 	if (rc == 0) {
 		bpf_jit(bpf);
 		if (mprotect(bpf, bpf->sz, PROT_READ) != 0)
diff --git a/lib/bpf/bpf_validate.c b/lib/bpf/bpf_validate.c
index 61cbb42216..52defb3337 100644
--- a/lib/bpf/bpf_validate.c
+++ b/lib/bpf/bpf_validate.c
@@ -2302,7 +2302,7 @@ evaluate(struct bpf_verifier *bvf)
 }
 
 int
-bpf_validate(struct rte_bpf *bpf)
+bpf_do_validate(struct rte_bpf *bpf)
 {
 	int32_t rc;
 	struct bpf_verifier bvf;
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-03-20 11:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 13:56 [PATCH] lib/bpf: Rename 'bpf_validate' to avoid potential conflict with libpcap Martzki
2023-03-05 17:16 ` Stephen Hemminger
2023-03-05 17:31   ` Stephen Hemminger
2023-03-06 15:32 ` [PATCH v2] lib/bpf: Rename bpf function names " Martzki
2023-03-06 15:42   ` [PATCH v3] " Martzki
2023-03-11  9:18     ` Thomas Monjalon
2023-03-12  6:20     ` [PATCH v4] " J.J. Martzki
2023-03-12 14:02       ` Konstantin Ananyev
2023-03-13  1:50         ` J.J. Mars
2023-03-13 14:55         ` J.J. Martzki
2023-03-13 15:54           ` Stephen Hemminger
2023-03-13 17:07           ` Konstantin Ananyev
2023-03-13 17:22             ` Stephen Hemminger
2023-03-14  2:21               ` 马尔斯
2023-03-14 14:20       ` [PATCH v5] " J.J. Martzki
2023-03-16  0:58         ` Konstantin Ananyev
2023-03-20 11:50           ` Thomas Monjalon

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).