]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_bpf.c
Merge pull request #5639 from qlyoung/fix-zebra-ptm-double-free
[mirror_frr.git] / isisd / isis_bpf.c
index cd7a090f70966191732ece7fb50d7e5d5cb8315f..e916a50883c3b54fcabde940f03ddb68f7d5cb6b 100644 (file)
@@ -34,7 +34,6 @@
 #include "if.h"
 #include "lib_errors.h"
 
-#include "isisd/dict.h"
 #include "isisd/isis_constants.h"
 #include "isisd/isis_common.h"
 #include "isisd/isis_circuit.h"
@@ -43,6 +42,7 @@
 #include "isisd/isis_constants.h"
 #include "isisd/isis_circuit.h"
 #include "isisd/isis_network.h"
+#include "isisd/isis_pdu.h"
 
 #include "privs.h"
 
@@ -65,10 +65,13 @@ uint8_t *readbuff = NULL;
  * ISO 10589 - 8.4.8
  */
 
-uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14};
-uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15};
-uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05};
-uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04};
+static const uint8_t ALL_L1_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x14};
+static const uint8_t ALL_L2_ISS[6] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x15};
+#if 0
+/* missing support for P2P-over-LAN / ES-IS on BSD */
+static const uint8_t ALL_ISS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x05};
+static const uint8_t ALL_ESS[6] = {0x09, 0x00, 0x2B, 0x00, 0x00, 0x04};
+#endif
 
 static char sock_buff[8192];
 
@@ -187,12 +190,13 @@ int isis_sock_init(struct isis_circuit *circuit)
 {
        int retval = ISIS_OK;
 
-       frr_elevate_privs(&isisd_privs) {
+       frr_with_privs(&isisd_privs) {
 
                retval = open_bpf_dev(circuit);
 
                if (retval != ISIS_OK) {
-                       zlog_warn("%s: could not initialize the socket", __func__);
+                       zlog_warn("%s: could not initialize the socket",
+                                 __func__);
                        break;
                }
 
@@ -204,15 +208,14 @@ int isis_sock_init(struct isis_circuit *circuit)
                        retval = ISIS_WARNING;
                        break;
                }
-
-}
+       }
 
        return retval;
 }
 
 int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
 {
-       int bytesread = 0, bytestoread, offset, one = 1, err = ISIS_OK;
+       int bytesread = 0, bytestoread, offset, one = 1;
        uint8_t *buff_ptr;
        struct bpf_hdr *bpf_hdr;
 
@@ -248,7 +251,7 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
                memcpy(ssnpa, buff_ptr + bpf_hdr->bh_hdrlen + ETHER_ADDR_LEN,
                ETHER_ADDR_LEN);
 
-               err = isis_handle_pdu(circuit, ssnpa);
+               isis_handle_pdu(circuit, ssnpa);
                stream_reset(circuit->rcv_stream);
                buff_ptr += BPF_WORDALIGN(bpf_hdr->bh_hdrlen +
                                                bpf_hdr->bh_datalen);