]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bfdd: fix CI warnings
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Tue, 5 Feb 2019 00:05:39 +0000 (22:05 -0200)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Thu, 14 Feb 2019 16:18:23 +0000 (14:18 -0200)
Fix a few checkpatch warnings and a clang analyzer warning of
uninitialized variable.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
bfdd/bfd.c
bfdd/bfd.h
bfdd/bfd_packet.c
bfdd/bfdd_vty.c

index f2f63480f7c6e70643e3955c206541d1d8f54160..12ba16bc82f2214638f3fcddb6a01db20cbf86b0 100644 (file)
@@ -36,7 +36,7 @@ DEFINE_QOBJ_TYPE(bfd_session);
 /*
  * Prototypes
  */
-struct bfd_session *bs_peer_waiting_find(struct bfd_peer_cfg *);
+static struct bfd_session *bs_peer_waiting_find(struct bfd_peer_cfg *bpc);
 
 static uint32_t ptm_bfd_gen_ID(void);
 static void ptm_bfd_echo_xmt_TO(struct bfd_session *bfd);
@@ -47,11 +47,16 @@ static struct bfd_session *bfd_find_disc(struct sockaddr_any *sa,
 static int bfd_session_update(struct bfd_session *bs, struct bfd_peer_cfg *bpc);
 static const char *get_diag_str(int diag);
 
+static void bs_admin_down_handler(struct bfd_session *bs, int nstate);
+static void bs_down_handler(struct bfd_session *bs, int nstate);
+static void bs_init_handler(struct bfd_session *bs, int nstate);
+static void bs_up_handler(struct bfd_session *bs, int nstate);
+
 
 /*
  * Functions
  */
-struct bfd_session *bs_peer_waiting_find(struct bfd_peer_cfg *bpc)
+static struct bfd_session *bs_peer_waiting_find(struct bfd_peer_cfg *bpc)
 {
        struct bfd_session_observer *bso;
        struct bfd_session *bs = NULL;
@@ -826,13 +831,9 @@ void bfd_set_polling(struct bfd_session *bs)
  * transition mechanism. `<state>` is the current session state and
  * the parameter `nstate` is the peer new state.
  */
-void bs_admin_down_handler(struct bfd_session *bs, int nstate);
-void bs_down_handler(struct bfd_session *bs, int nstate);
-void bs_init_handler(struct bfd_session *bs, int nstate);
-void bs_up_handler(struct bfd_session *bs, int nstate);
-
-void bs_admin_down_handler(struct bfd_session *bs __attribute__((__unused__)),
-                          int nstate __attribute__((__unused__)))
+static void bs_admin_down_handler(struct bfd_session *bs
+                                 __attribute__((__unused__)),
+                                 int nstate __attribute__((__unused__)))
 {
        /*
         * We are administratively down, there is no state machine
@@ -840,7 +841,7 @@ void bs_admin_down_handler(struct bfd_session *bs __attribute__((__unused__)),
         */
 }
 
-void bs_down_handler(struct bfd_session *bs, int nstate)
+static void bs_down_handler(struct bfd_session *bs, int nstate)
 {
        switch (nstate) {
        case PTM_BFD_ADM_DOWN:
@@ -874,7 +875,7 @@ void bs_down_handler(struct bfd_session *bs, int nstate)
        }
 }
 
-void bs_init_handler(struct bfd_session *bs, int nstate)
+static void bs_init_handler(struct bfd_session *bs, int nstate)
 {
        switch (nstate) {
        case PTM_BFD_ADM_DOWN:
@@ -901,7 +902,7 @@ void bs_init_handler(struct bfd_session *bs, int nstate)
        }
 }
 
-void bs_up_handler(struct bfd_session *bs, int nstate)
+static void bs_up_handler(struct bfd_session *bs, int nstate)
 {
        switch (nstate) {
        case PTM_BFD_ADM_DOWN:
index 2a0cda570e11a0d7fbabee3952ecbc2dcb526d6a..a65c47c06f50834afb5697d478b8fbaddde3bea6 100644 (file)
@@ -465,8 +465,8 @@ int bp_udp_shop(void);
 int bp_udp_mhop(void);
 int bp_udp6_shop(void);
 int bp_udp6_mhop(void);
-int bp_peer_socket(const struct bfd_session *);
-int bp_peer_socketv6(const struct bfd_session *);
+int bp_peer_socket(const struct bfd_session *bs);
+int bp_peer_socketv6(const struct bfd_session *bs);
 int bp_echo_socket(void);
 int bp_echov6_socket(void);
 
@@ -504,8 +504,8 @@ void bfd_echo_xmttimer_assign(struct bfd_session *bs, bfd_ev_cb cb);
  *
  * BFD protocol specific code.
  */
-int bfd_session_enable(struct bfd_session *);
-void bfd_session_disable(struct bfd_session *);
+int bfd_session_enable(struct bfd_session *bs);
+void bfd_session_disable(struct bfd_session *bs);
 struct bfd_session *ptm_bfd_sess_new(struct bfd_peer_cfg *bpc);
 int ptm_bfd_ses_del(struct bfd_peer_cfg *bpc);
 void ptm_bfd_ses_dn(struct bfd_session *bfd, uint8_t diag);
@@ -514,16 +514,18 @@ void ptm_bfd_echo_stop(struct bfd_session *bfd);
 void ptm_bfd_echo_start(struct bfd_session *bfd);
 void ptm_bfd_xmt_TO(struct bfd_session *bfd, int fbit);
 void ptm_bfd_start_xmt_timer(struct bfd_session *bfd, bool is_echo);
-struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *, struct sockaddr_any *,
-                                     struct sockaddr_any *, ifindex_t,
-                                     vrf_id_t, bool);
+struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *cp,
+                                     struct sockaddr_any *peer,
+                                     struct sockaddr_any *local,
+                                     ifindex_t ifindex, vrf_id_t vrfid,
+                                     bool is_mhop);
 
 struct bfd_session *bs_peer_find(struct bfd_peer_cfg *bpc);
 int bfd_session_update_label(struct bfd_session *bs, const char *nlabel);
 void bfd_set_polling(struct bfd_session *bs);
-void bs_state_handler(struct bfd_session *, int);
-void bs_echo_timer_handler(struct bfd_session *);
-void bs_final_handler(struct bfd_session *);
+void bs_state_handler(struct bfd_session *bs, int nstate);
+void bs_echo_timer_handler(struct bfd_session *bs);
+void bs_final_handler(struct bfd_session *bs);
 void bs_set_slow_timers(struct bfd_session *bs);
 const char *satostr(struct sockaddr_any *sa);
 const char *diag2str(uint8_t diag);
@@ -531,8 +533,8 @@ int strtosa(const char *addr, struct sockaddr_any *sa);
 void integer2timestr(uint64_t time, char *buf, size_t buflen);
 const char *bs_to_string(struct bfd_session *bs);
 
-int bs_observer_add(struct bfd_session *);
-void bs_observer_del(struct bfd_session_observer *);
+int bs_observer_add(struct bfd_session *bs);
+void bs_observer_del(struct bfd_session_observer *bso);
 
 /* BFD hash data structures interface */
 void bfd_initialize(void);
index 674c9bf9e63b1a5619e106dea8f8e1b17db8201f..45c5f5dbdc415a1143d900ad5f5a15d0dd94e364 100644 (file)
@@ -505,7 +505,7 @@ int bfd_recv_cb(struct thread *t)
        struct bfd_pkt *cp;
        bool is_mhop;
        ssize_t mlen = 0;
-       uint8_t ttl;
+       uint8_t ttl = 0;
        vrf_id_t vrfid = VRF_DEFAULT;
        ifindex_t ifindex = IFINDEX_INTERNAL;
        struct sockaddr_any local, peer;
index ed1c434c8effe8cf8ce7ff242b297a373a8b8a05..6bdfc384e83350e88de8dff8567d182bcc498a79 100644 (file)
@@ -293,9 +293,8 @@ DEFPY(bfd_peer_echo, bfd_peer_echo_cmd, "[no] echo-mode",
 
                BFD_SET_FLAG(bs->flags, BFD_SESS_FLAG_ECHO);
                /* Apply setting immediately. */
-               if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN)) {
+               if (!BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_SHUTDOWN))
                        bs_echo_timer_handler(bs);
-               }
        }
 
        return CMD_SUCCESS;