summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2020-04-13 20:18:17 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2020-04-14 14:35:08 +0200
commit6e10bd97722da2905e56c5a7b8595de17c2dc30c (patch)
tree3f3efbbb6d0fe87cda0cd2377795e7081ad4e010 /bfdd
parentbfdd: remove time calculation debugs (diff)
downloadfrr-6e10bd97722da2905e56c5a7b8595de17c2dc30c.tar.xz
frr-6e10bd97722da2905e56c5a7b8595de17c2dc30c.zip
bfdd: constify satostr
Detect modifications to the `sockaddr_any` struct. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfd.c6
-rw-r--r--bfdd/bfd.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index 0d2c61ac7..49cb586db 100644
--- a/bfdd/bfd.c
+++ b/bfdd/bfd.c
@@ -1111,13 +1111,13 @@ static const char *get_diag_str(int diag)
return "N/A";
}
-const char *satostr(struct sockaddr_any *sa)
+const char *satostr(const struct sockaddr_any *sa)
{
#define INETSTR_BUFCOUNT 8
static char buf[INETSTR_BUFCOUNT][INET6_ADDRSTRLEN];
static int bufidx;
- struct sockaddr_in *sin = &sa->sa_sin;
- struct sockaddr_in6 *sin6 = &sa->sa_sin6;
+ const struct sockaddr_in *sin = &sa->sa_sin;
+ const struct sockaddr_in6 *sin6 = &sa->sa_sin6;
bufidx += (bufidx + 1) % INETSTR_BUFCOUNT;
buf[bufidx][0] = 0;
diff --git a/bfdd/bfd.h b/bfdd/bfd.h
index 1cc9ddb47..93873eed9 100644
--- a/bfdd/bfd.h
+++ b/bfdd/bfd.h
@@ -529,7 +529,7 @@ 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 *satostr(const struct sockaddr_any *sa);
const char *diag2str(uint8_t diag);
int strtosa(const char *addr, struct sockaddr_any *sa);
void integer2timestr(uint64_t time, char *buf, size_t buflen);