Re: [PATCH 7/23] [PATCH] [XFRM] STATE: Add a hook to find where to be inserted header in outbound.
From: Masahide NAKAMURA <hidden>
Date: 2006-08-02 02:20:33
From: Masahide NAKAMURA <hidden>
Date: 2006-08-02 02:20:33
David Miller wrote:
From: Masahide NAKAMURA <redacted> Date: Sat, 29 Jul 2006 18:30:23 +0900quoted
@@ -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.
Sometimes this is a difficult point for me to design.
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.
I'll fix it. James gave me this comment, too. BTW he also gave me another point:
Maybe also change the naming of ->place_find to ->hdr_offset
I'll use this idea, too. Thank you. -- Masahide NAKAMURA