7 typedef struct Hdr Hdr;
37 static Field p_fields[] =
39 {"spa", Fv4ip, Ospa, "protocol source", } ,
40 {"tpa", Fv4ip, Otpa, "protocol target", } ,
41 {"a", Fv4ip, Ostpa, "protocol source/target", } ,
42 {"sha", Fba, Osha, "hardware source", } ,
43 {"tha", Fba, Otha, "hardware target", } ,
44 {"ah", Fba, Ostha, "hardware source/target", } ,
52 compile_cmp(arp.name, f, p_fields);
55 sysfatal("unknown arp field: %s", f->s);
59 p_filter(Filter *f, Msg *m)
63 if(m->pe - m->ps < ARPLEN)
71 return h->pln == 4 && NetL(h->spa) == f->ulv;
73 return h->pln == 4 && NetL(h->tpa) == f->ulv;
75 return h->pln == 4 && (NetL(h->tpa) == f->ulv ||
76 NetL(h->spa) == f->ulv);
78 return memcmp(h->sha, f->a, h->hln) == 0;
80 return memcmp(h->tha, f->a, h->hln) == 0;
82 return memcmp(h->sha, f->a, h->hln)==0
83 ||memcmp(h->tha, f->a, h->hln)==0;
93 if(m->pe - m->ps < ARPLEN)
99 /* no next protocol */
102 m->p = seprint(m->p, m->e, "op=%1d len=%1d/%1d spa=%V sha=%E tpa=%V tha=%E",
103 NetS(h->op), h->pln, h->hln,
104 h->spa, h->sha, h->tpa, h->tha);