* [net-next] ipv6: sr: export some functions of seg6local
@ 2017-12-29 21:09 Ahmed Abdelsalam
2018-01-02 20:11 ` David Lebrun
0 siblings, 1 reply; 3+ messages in thread
From: Ahmed Abdelsalam @ 2017-12-29 21:09 UTC (permalink / raw)
To: davem, kuznet, yoshfuji; +Cc: david.lebrun, netdev, amsalam20
Some functions of seg6local are very useful to process SRv6
encapsulated packets.
This patch exports some functions of seg6local that are useful and
can be re-used at different parts of the kernel.
The set of exported functions are:
(1) get_srh()
(2) advance_nextseg()
(3) lookup_nexthop
Signed-off-by: Ahmed Abdelsalam <amsalam20@gmail.com>
---
I'm writing some extensions to netfilter framework to support
Segment Routing. These function are useful to process
SR-encapsulated packets
include/net/seg6.h | 4 ++++
net/ipv6/seg6_local.c | 11 +++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/net/seg6.h b/include/net/seg6.h
index 099bad5..4058f23 100644
--- a/include/net/seg6.h
+++ b/include/net/seg6.h
@@ -60,6 +60,10 @@ extern int seg6_local_init(void);
extern void seg6_local_exit(void);
extern bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len);
+extern struct ipv6_sr_hdr *get_srh(struct sk_buff *skb);
+extern void advance_nextseg(struct ipv6_sr_hdr *srh, struct in6_addr *daddr);
+extern void lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
+ u32 tbl_id);
extern int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh,
int proto);
extern int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh);
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 825b8e0..5661d6c 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -59,7 +59,7 @@ static struct seg6_local_lwt *seg6_local_lwtunnel(struct lwtunnel_state *lwt)
return (struct seg6_local_lwt *)lwt->data;
}
-static struct ipv6_sr_hdr *get_srh(struct sk_buff *skb)
+struct ipv6_sr_hdr *get_srh(struct sk_buff *skb)
{
struct ipv6_sr_hdr *srh;
int len, srhoff = 0;
@@ -82,6 +82,7 @@ static struct ipv6_sr_hdr *get_srh(struct sk_buff *skb)
return srh;
}
+EXPORT_SYMBOL_GPL(get_srh);
static struct ipv6_sr_hdr *get_and_validate_srh(struct sk_buff *skb)
{
@@ -131,7 +132,7 @@ static bool decap_and_validate(struct sk_buff *skb, int proto)
return true;
}
-static void advance_nextseg(struct ipv6_sr_hdr *srh, struct in6_addr *daddr)
+void advance_nextseg(struct ipv6_sr_hdr *srh, struct in6_addr *daddr)
{
struct in6_addr *addr;
@@ -139,9 +140,10 @@ static void advance_nextseg(struct ipv6_sr_hdr *srh, struct in6_addr *daddr)
addr = srh->segments + srh->segments_left;
*daddr = *addr;
}
+EXPORT_SYMBOL_GPL(advance_nextseg);
-static void lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
- u32 tbl_id)
+void lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
+ u32 tbl_id)
{
struct net *net = dev_net(skb->dev);
struct ipv6hdr *hdr = ipv6_hdr(skb);
@@ -188,6 +190,7 @@ static void lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
skb_dst_drop(skb);
skb_dst_set(skb, dst);
}
+EXPORT_SYMBOL_GPL(lookup_nexthop);
/* regular endpoint function */
static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [net-next] ipv6: sr: export some functions of seg6local
2017-12-29 21:09 [net-next] ipv6: sr: export some functions of seg6local Ahmed Abdelsalam
@ 2018-01-02 20:11 ` David Lebrun
2018-01-02 20:25 ` Ahmed Abdelsalam
0 siblings, 1 reply; 3+ messages in thread
From: David Lebrun @ 2018-01-02 20:11 UTC (permalink / raw)
To: Ahmed Abdelsalam, davem, kuznet, yoshfuji; +Cc: david.lebrun, netdev
On 12/29/2017 09:09 PM, Ahmed Abdelsalam wrote:
> Some functions of seg6local are very useful to process SRv6
> encapsulated packets.
>
> This patch exports some functions of seg6local that are useful and
> can be re-used at different parts of the kernel.
>
> The set of exported functions are:
> (1) get_srh()
> (2) advance_nextseg()
> (3) lookup_nexthop
If you want to export those functions, it's better to prefix them with
e.g. seg6_:
seg6_get_srh()
seg6_advance_nextseg()
seg6_lookup_nexthop()
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [net-next] ipv6: sr: export some functions of seg6local
2018-01-02 20:11 ` David Lebrun
@ 2018-01-02 20:25 ` Ahmed Abdelsalam
0 siblings, 0 replies; 3+ messages in thread
From: Ahmed Abdelsalam @ 2018-01-02 20:25 UTC (permalink / raw)
To: David Lebrun; +Cc: davem, kuznet, yoshfuji, david.lebrun, netdev
Ok!
Thanks David
On Tue, 2 Jan 2018 20:11:48 +0000
David Lebrun <dav.lebrun@gmail.com> wrote:
> On 12/29/2017 09:09 PM, Ahmed Abdelsalam wrote:
> > Some functions of seg6local are very useful to process SRv6
> > encapsulated packets.
> >
> > This patch exports some functions of seg6local that are useful and
> > can be re-used at different parts of the kernel.
> >
> > The set of exported functions are:
> > (1) get_srh()
> > (2) advance_nextseg()
> > (3) lookup_nexthop
>
> If you want to export those functions, it's better to prefix them with
> e.g. seg6_:
>
> seg6_get_srh()
> seg6_advance_nextseg()
> seg6_lookup_nexthop()
>
> David
--
Ahmed Abdelsalam <amsalam20@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-02 20:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-29 21:09 [net-next] ipv6: sr: export some functions of seg6local Ahmed Abdelsalam
2018-01-02 20:11 ` David Lebrun
2018-01-02 20:25 ` Ahmed Abdelsalam
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.