Re: [PATCH 7/23] [PATCH] [XFRM] STATE: Add a hook to find where to be inserted header in outbound.
From: David Miller <davem@davemloft.net>
Date: 2006-08-02 00:09:18
From: David Miller <davem@davemloft.net>
Date: 2006-08-02 00:09:18
From: Masahide NAKAMURA <redacted> Date: Sat, 29 Jul 2006 18:30:23 +0900
@@ -270,6 +270,7 @@ struct xfrm_type void (*destructor)(struct xfrm_state *); int (*input)(struct xfrm_state *, struct sk_buff *skb); int (*output)(struct xfrm_state *, struct sk_buff *pskb); + int (*place_find)(struct xfrm_state *, struct sk_buff *, u8 **); /* Estimate maximal size of result of transformation of a dgram */ u32 (*get_max_size)(struct xfrm_state *, int size); };
I see a dangerous pattern of adding many, many, many methods to the xfrm_type structure which are only used by ipv6. But I cannot suggest another method. There are frequent calls of the form: if (x->type->op != NULL) x->type->op(x, y, z); else foo(y, z); it might be nicer to hide all of this behind carefully crafted inline functions.