On Sat, Apr 25, 2026 at 11:35:59AM +0200, Stefano Brivio wrote:
On Fri, 24 Apr 2026 18:37:58 -0400 Jon Maloy
wrote: On 2026-04-21 02:25, David Gibson wrote:
Implement serialisation of our current forwarding rules in conf.c, deserialising it to display in the pesto client. Doing this requires adding ip.c, inany.c, bitmap.c, lineread.c and fwd_rule.c to the pesto build. With previous preparations that now requires only a trivial change [...]
+ + +/** + * fwd_rule_read() - Read serialised rule from an fd + * @fd: fd to serialise to + * @rule: Buffer to store rule into + * + * Return: 0 on success, -1 on error (with errno set) + */ +int fwd_rule_read(int fd, struct fwd_rule *rule) +{ + if (read_all_buf(fd, rule, sizeof(*rule))) + return -1; + + /* Byteswap for host */ + rule->first = ntohs(rule->first); + rule->last = ntohs(rule->last); + rule->to = htons(rule->to); Or ntohs() ?
Thanks, nice catch, I'll fix this (I'm adopting this series and trying to complete it while David is off).
Oops, yes, good catch, thanks. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson