Hello,

I am trying to replace field references inside a struct of given type with references from a different struct (that is passed as an input parameter for a function).  I have the following coccinelle rule that is not working

@vlan@    
identifier p,c,fn;
type t;          
struct vlan_hdr *v;
@@                
t fn(struct xdp_md *ctx){
...                      
- v->h_vlan_encapsulated_proto
+ ctx->vlan_proto            
}

However, I have a similar rule that works for another struct type.  I am not sure what I am missing in the above rule compared to the one below. The only difference I can see in the source code is that the above rule needs to transform a piece of code inside an if block. I believe the three ellipsis (...) would handle that anyways?

@rule3@
identifier p,c,fn;                                                                                                              type t;
struct ethhdr *e;
@@              
t fn(struct xdp_md *ctx){
...                      
- e->h_proto            
+ ctx->protocol
...
}

Appreciate your help.

Regards,
Palani.