Padding in pfloghdr

Caglar Kilimci Caglar.Kilimci at logo.com.tr
Tue May 7 11:09:01 UTC 2013


Hello list, I want to insert an extra field, u_int32_t, into pfloghdr struct but I am not sure how to change padding. 

160 Index: sys/net/if_pflog.h                                                      
161 ===================================================================            
162 --- sys/net/if_pflog.h  (revision 250171)                                      
163 +++ sys/net/if_pflog.h  (working copy)                                         
164 @@ -45,6 +45,8 @@                                                              
165         uid_t           rule_uid;                                              
166         pid_t           rule_pid;                                              
167         u_int8_t        dir;                                                   
168 +       //added for extra                                                       
169 +       u_int32_t       index;                                                 
170         u_int8_t        pad[3];                                                
171  }; 

If I increment hdrlen by 4 in tcpdump, everything seems fine but I guess this solution is not good.

  1 Index: print-pflog.c                                                           
  2 ===================================================================            
  3 --- print-pflog.c       (revision 250174)                                      
  4 +++ print-pflog.c       (working copy)                                         
  5 @@ -145,6 +145,7 @@                                                            
  6                                                                                
  7         /* skip to the real packet */                                          
  8         af = hdr->af;                                                          
  9 +       hdrlen+=4;                                                             
 10         length -= hdrlen;                                                      
 11         caplen -= hdrlen;                                                      
 12         p += hdrlen;

If I do not touch anything in tcpdump, it complains as "bad-len 0" error.

I mean, what is padding number for pfloghdr struct?
"Bu mesaji yazdirmadan once cevreye olan sorumlulugumuzu bir kez daha dusunelim.  / Please consider the environment before printing this e-mail."


Bu elektronik posta ve ekinde yer alan tum dosyalar gonderici ve alici kisi ve kurumlara ozel olup gizli bilgi ihtiva edebilir. Dogru aliciya ulasmamasi halinde mesajin ekleri ile birlikte silinmesi ve yok edilmesi gerekmektedir. Mesaj, icerigi ve ekinde bulunan dusunce ve yorumlar Logo Yazilim Sanayi ve Ticaret A.S.'ye degil gondericiye aittir.

This electronic mail and all files attached to it are private to the sender and recipient, and may contain confidential information. If it fails to reach the right recipient, the message should be deleted and destroyed along with its attachments. The message, its content and opinion and comments attached to it belong to the sender, not Logo Yazilim Sanayi ve Ticaret A.S.




More information about the freebsd-pf mailing list