Adjust ldpd to follow the new ibuf API.
Diff is simple but as usual I could not test it out so please test.

-- 
:wq Claudio

Index: hello.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldpd/hello.c,v
retrieving revision 1.58
diff -u -p -r1.58 hello.c
--- hello.c     12 Dec 2019 00:10:29 -0000      1.58
+++ hello.c     12 Jun 2023 07:27:51 -0000
@@ -139,7 +139,7 @@ send_hello(enum hello_type type, struct 
                return (-1);
        }
 
-       send_packet(fd, af, &dst, ia, buf->buf, buf->wpos);
+       send_packet(fd, af, &dst, ia, ibuf_data(buf), ibuf_size(buf));
        ibuf_free(buf);
 
        return (0);
Index: labelmapping.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldpd/labelmapping.c,v
retrieving revision 1.68
diff -u -p -r1.68 labelmapping.c
--- labelmapping.c      4 Mar 2017 00:15:35 -0000       1.68
+++ labelmapping.c      22 Jun 2023 08:49:55 -0000
@@ -22,6 +22,7 @@
 #include <arpa/inet.h>
 #include <netmpls/mpls.h>
 #include <limits.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -39,10 +40,8 @@ static void   log_msg_mapping(int, uint16
 static void
 enqueue_pdu(struct nbr *nbr, struct ibuf *buf, uint16_t size)
 {
-       struct ldp_hdr          *ldp_hdr;
-
-       ldp_hdr = ibuf_seek(buf, 0, sizeof(struct ldp_hdr));
-       ldp_hdr->length = htons(size);
+       if (ibuf_set_n16(buf, offsetof(struct ldp_hdr, length), size) == -1)
+               fatal(__func__);
        evbuf_enqueue(&nbr->tcp->wbuf, buf);
 }
 

Reply via email to