On Tue, Apr 18, 2023 at 03:38:12PM +0200, Claudio Jeker wrote: > Extend the pt_entry api to handle flowspec. > Introduce pt_get_flow() and pt_add_flow() to lookup and insert flowspec > objects. Add pt_getflowspec() which works somewhat similar to pt_getaddr() > to extract the flowspec NLRI from a pt_entry. > > There is a hack in pt_getaddr() to return something. This is the > destination prefix of the flowspec rule (or a default route if that is > missing). Also extend pt_write() to handle flowspec NLRI.
This reads fine to me. These casting and union gymnastics make me squirm, but it's not the moment to rethink this. Regarding the unused prefixlen, I think that's only superficially the case. flowspec_cmp() will extract it again and use it. So I think this is ok as it is. > @@ -471,7 +575,8 @@ pt_writebuf(struct ibuf *buf, struct pt_ > { > struct pt_entry_vpn4 *pvpn4 = (struct pt_entry_vpn4 *)pte; > struct pt_entry_vpn6 *pvpn6 = (struct pt_entry_vpn6 *)pte; > - int totlen; > + struct pt_entry_flow *pflow = (struct pt_entry_flow *)pte; > + int totlen, flowlen; ^ There is a space before a tab hiding here.