mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
[IPSEC]: output mode to take an xfrm state as input param
Expose IPSEC modes output path to take an xfrm state as input param. This makes it consistent with the input mode processing (which already takes the xfrm state as a param). Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fda9ef5d67
commit
eb878e8457
8 changed files with 8 additions and 14 deletions
|
@ -285,7 +285,7 @@ extern void xfrm_put_type(struct xfrm_type *type);
|
||||||
|
|
||||||
struct xfrm_mode {
|
struct xfrm_mode {
|
||||||
int (*input)(struct xfrm_state *x, struct sk_buff *skb);
|
int (*input)(struct xfrm_state *x, struct sk_buff *skb);
|
||||||
int (*output)(struct sk_buff *skb);
|
int (*output)(struct xfrm_state *x,struct sk_buff *skb);
|
||||||
|
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
unsigned int encap;
|
unsigned int encap;
|
||||||
|
|
|
@ -21,9 +21,8 @@
|
||||||
* On exit, skb->h will be set to the start of the payload to be processed
|
* On exit, skb->h will be set to the start of the payload to be processed
|
||||||
* by x->type->output and skb->nh will be set to the top IP header.
|
* by x->type->output and skb->nh will be set to the top IP header.
|
||||||
*/
|
*/
|
||||||
static int xfrm4_transport_output(struct sk_buff *skb)
|
static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct xfrm_state *x;
|
|
||||||
struct iphdr *iph;
|
struct iphdr *iph;
|
||||||
int ihl;
|
int ihl;
|
||||||
|
|
||||||
|
@ -33,7 +32,6 @@ static int xfrm4_transport_output(struct sk_buff *skb)
|
||||||
ihl = iph->ihl * 4;
|
ihl = iph->ihl * 4;
|
||||||
skb->h.raw += ihl;
|
skb->h.raw += ihl;
|
||||||
|
|
||||||
x = skb->dst->xfrm;
|
|
||||||
skb->nh.raw = memmove(skb_push(skb, x->props.header_len), iph, ihl);
|
skb->nh.raw = memmove(skb_push(skb, x->props.header_len), iph, ihl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,9 @@ static inline void ipip_ecn_decapsulate(struct sk_buff *skb)
|
||||||
* On exit, skb->h will be set to the start of the payload to be processed
|
* On exit, skb->h will be set to the start of the payload to be processed
|
||||||
* by x->type->output and skb->nh will be set to the top IP header.
|
* by x->type->output and skb->nh will be set to the top IP header.
|
||||||
*/
|
*/
|
||||||
static int xfrm4_tunnel_output(struct sk_buff *skb)
|
static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct dst_entry *dst = skb->dst;
|
struct dst_entry *dst = skb->dst;
|
||||||
struct xfrm_state *x = dst->xfrm;
|
|
||||||
struct iphdr *iph, *top_iph;
|
struct iphdr *iph, *top_iph;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ static int xfrm4_output_one(struct sk_buff *skb)
|
||||||
if (err)
|
if (err)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
err = x->mode->output(skb);
|
err = x->mode->output(x, skb);
|
||||||
if (err)
|
if (err)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,8 @@
|
||||||
* its absence, that of the top IP header. The value of skb->data will always
|
* its absence, that of the top IP header. The value of skb->data will always
|
||||||
* point to the top IP header.
|
* point to the top IP header.
|
||||||
*/
|
*/
|
||||||
static int xfrm6_ro_output(struct sk_buff *skb)
|
static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct xfrm_state *x = skb->dst->xfrm;
|
|
||||||
struct ipv6hdr *iph;
|
struct ipv6hdr *iph;
|
||||||
u8 *prevhdr;
|
u8 *prevhdr;
|
||||||
int hdr_len;
|
int hdr_len;
|
||||||
|
|
|
@ -25,9 +25,8 @@
|
||||||
* its absence, that of the top IP header. The value of skb->data will always
|
* its absence, that of the top IP header. The value of skb->data will always
|
||||||
* point to the top IP header.
|
* point to the top IP header.
|
||||||
*/
|
*/
|
||||||
static int xfrm6_transport_output(struct sk_buff *skb)
|
static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct xfrm_state *x = skb->dst->xfrm;
|
|
||||||
struct ipv6hdr *iph;
|
struct ipv6hdr *iph;
|
||||||
u8 *prevhdr;
|
u8 *prevhdr;
|
||||||
int hdr_len;
|
int hdr_len;
|
||||||
|
|
|
@ -37,10 +37,9 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
|
||||||
* its absence, that of the top IP header. The value of skb->data will always
|
* its absence, that of the top IP header. The value of skb->data will always
|
||||||
* point to the top IP header.
|
* point to the top IP header.
|
||||||
*/
|
*/
|
||||||
static int xfrm6_tunnel_output(struct sk_buff *skb)
|
static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct dst_entry *dst = skb->dst;
|
struct dst_entry *dst = skb->dst;
|
||||||
struct xfrm_state *x = dst->xfrm;
|
|
||||||
struct ipv6hdr *iph, *top_iph;
|
struct ipv6hdr *iph, *top_iph;
|
||||||
int dsfield;
|
int dsfield;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
|
||||||
if (err)
|
if (err)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
err = x->mode->output(skb);
|
err = x->mode->output(x, skb);
|
||||||
if (err)
|
if (err)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue