summaryrefslogtreecommitdiff
path: root/pimd/pim_msdp_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim_msdp_packet.c')
-rw-r--r--pimd/pim_msdp_packet.c51
1 files changed, 20 insertions, 31 deletions
diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c
index eb5f46951e..4adaca4e78 100644
--- a/pimd/pim_msdp_packet.c
+++ b/pimd/pim_msdp_packet.c
@@ -66,18 +66,18 @@ static char *pim_msdp_pkt_type_dump(enum pim_msdp_tlv type, char *buf,
static void pim_msdp_pkt_sa_dump_one(struct stream *s)
{
- struct prefix_sg sg;
+ pim_sgaddr sg;
/* just throw away the three reserved bytes */
stream_get3(s);
/* throw away the prefix length also */
stream_getc(s);
- memset(&sg, 0, sizeof(struct prefix_sg));
+ memset(&sg, 0, sizeof(sg));
sg.grp.s_addr = stream_get_ipv4(s);
sg.src.s_addr = stream_get_ipv4(s);
- zlog_debug(" sg %s", pim_str_sg_dump(&sg));
+ zlog_debug(" sg %pSG", &sg);
}
static void pim_msdp_pkt_sa_dump(struct stream *s)
@@ -182,7 +182,7 @@ static void pim_msdp_write_proceed_actions(struct pim_msdp_peer *mp)
}
}
-int pim_msdp_write(struct thread *thread)
+void pim_msdp_write(struct thread *thread)
{
struct pim_msdp_peer *mp;
struct stream *s;
@@ -199,23 +199,21 @@ int pim_msdp_write(struct thread *thread)
zlog_debug("MSDP peer %s pim_msdp_write", mp->key_str);
}
if (mp->fd < 0) {
- return -1;
+ return;
}
/* check if TCP connection is established */
if (mp->state != PIM_MSDP_ESTABLISHED) {
pim_msdp_connect_check(mp);
- return 0;
+ return;
}
s = stream_fifo_head(mp->obuf);
if (!s) {
pim_msdp_write_proceed_actions(mp);
- return 0;
+ return;
}
- sockopt_cork(mp->fd, 1);
-
/* Nonblocking write until TCP output buffer is full */
do {
int writenum;
@@ -237,7 +235,7 @@ int pim_msdp_write(struct thread *thread)
}
pim_msdp_peer_reset_tcp_conn(mp, "pkt-tx-failed");
- return 0;
+ return;
}
if (num != writenum) {
@@ -280,14 +278,10 @@ int pim_msdp_write(struct thread *thread)
} while ((s = stream_fifo_head(mp->obuf)) != NULL);
pim_msdp_write_proceed_actions(mp);
- sockopt_cork(mp->fd, 0);
-
if (PIM_DEBUG_MSDP_INTERNAL) {
zlog_debug("MSDP peer %s pim_msdp_write wrote %d packets",
mp->key_str, work_cnt);
}
-
- return 0;
}
static void pim_msdp_pkt_send(struct pim_msdp_peer *mp, struct stream *s)
@@ -458,7 +452,7 @@ void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp)
}
void pim_msdp_pkt_sa_tx_one_to_one_peer(struct pim_msdp_peer *mp,
- struct in_addr rp, struct prefix_sg sg)
+ struct in_addr rp, pim_sgaddr sg)
{
struct pim_msdp_sa sa;
@@ -493,7 +487,7 @@ static void pim_msdp_pkt_ka_rx(struct pim_msdp_peer *mp, int len)
static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp)
{
int prefix_len;
- struct prefix_sg sg;
+ pim_sgaddr sg;
struct listnode *peer_node;
struct pim_msdp_peer *peer;
@@ -501,7 +495,7 @@ static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp)
stream_get3(mp->ibuf);
prefix_len = stream_getc(mp->ibuf);
- memset(&sg, 0, sizeof(struct prefix_sg));
+ memset(&sg, 0, sizeof(sg));
sg.grp.s_addr = stream_get_ipv4(mp->ibuf);
sg.src.s_addr = stream_get_ipv4(mp->ibuf);
@@ -513,7 +507,7 @@ static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp)
return;
}
if (PIM_DEBUG_MSDP_PACKETS) {
- zlog_debug(" sg %s", pim_str_sg_dump(&sg));
+ zlog_debug(" sg %pSG", &sg);
}
pim_msdp_sa_ref(mp->pim, mp, &sg, rp);
@@ -674,7 +668,7 @@ static int pim_msdp_read_packet(struct pim_msdp_peer *mp)
return 0;
}
-int pim_msdp_read(struct thread *thread)
+void pim_msdp_read(struct thread *thread)
{
struct pim_msdp_peer *mp;
int rc;
@@ -688,13 +682,13 @@ int pim_msdp_read(struct thread *thread)
}
if (mp->fd < 0) {
- return -1;
+ return;
}
/* check if TCP connection is established */
if (mp->state != PIM_MSDP_ESTABLISHED) {
pim_msdp_connect_check(mp);
- return 0;
+ return;
}
PIM_MSDP_PEER_READ_ON(mp);
@@ -706,32 +700,27 @@ int pim_msdp_read(struct thread *thread)
if (stream_get_endp(mp->ibuf) < PIM_MSDP_HEADER_SIZE) {
/* start by reading the TLV header */
rc = pim_msdp_read_packet(mp);
- if (rc < 0) {
- goto pim_msdp_read_end;
- }
+ if (rc < 0)
+ return;
/* Find TLV type and len */
stream_getc(mp->ibuf);
len = stream_getw(mp->ibuf);
if (len < PIM_MSDP_HEADER_SIZE) {
pim_msdp_pkt_rxed_with_fatal_error(mp);
- goto pim_msdp_read_end;
+ return;
}
/* read complete TLV */
mp->packet_size = len;
}
rc = pim_msdp_read_packet(mp);
- if (rc < 0) {
- goto pim_msdp_read_end;
- }
+ if (rc < 0)
+ return;
pim_msdp_pkt_rx(mp);
/* reset input buffers and get ready for the next packet */
mp->packet_size = 0;
stream_reset(mp->ibuf);
-
-pim_msdp_read_end:
- return 0;
}