mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 04:47:05 +00:00
ospf6d: create an ospf_read_helper function
Take the contents of ospf6_receive and split the funtionality that deals with a single packet receipt and place it in a separate helper function. This is the first step in a refactor process to allow the ospf6_read task to read until failure. Signed-off-by: Pat Ruddy <pat@voltanet.io>
This commit is contained in:
parent
161b567451
commit
ec44732ea3
@ -1572,23 +1572,14 @@ void ospf6_message_terminate(void)
|
|||||||
iobuflen = 0;
|
iobuflen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ospf6_receive(struct thread *thread)
|
static int ospf6_read_helper(int sockfd, struct ospf6 *ospf6)
|
||||||
{
|
{
|
||||||
int sockfd;
|
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
struct in6_addr src, dst;
|
struct in6_addr src, dst;
|
||||||
ifindex_t ifindex;
|
ifindex_t ifindex;
|
||||||
struct iovec iovector[2];
|
struct iovec iovector[2];
|
||||||
struct ospf6_interface *oi;
|
struct ospf6_interface *oi;
|
||||||
struct ospf6_header *oh;
|
struct ospf6_header *oh;
|
||||||
struct ospf6 *ospf6;
|
|
||||||
|
|
||||||
/* add next read thread */
|
|
||||||
ospf6 = THREAD_ARG(thread);
|
|
||||||
sockfd = THREAD_FD(thread);
|
|
||||||
|
|
||||||
thread_add_read(master, ospf6_receive, ospf6, ospf6->fd,
|
|
||||||
&ospf6->t_ospf6_receive);
|
|
||||||
|
|
||||||
/* initialize */
|
/* initialize */
|
||||||
memset(&src, 0, sizeof(src));
|
memset(&src, 0, sizeof(src));
|
||||||
@ -1689,6 +1680,21 @@ int ospf6_receive(struct thread *thread)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ospf6_receive(struct thread *thread)
|
||||||
|
{
|
||||||
|
int sockfd;
|
||||||
|
struct ospf6 *ospf6;
|
||||||
|
|
||||||
|
/* add next read thread */
|
||||||
|
ospf6 = THREAD_ARG(thread);
|
||||||
|
sockfd = THREAD_FD(thread);
|
||||||
|
|
||||||
|
thread_add_read(master, ospf6_receive, ospf6, ospf6->fd,
|
||||||
|
&ospf6->t_ospf6_receive);
|
||||||
|
|
||||||
|
return ospf6_read_helper(sockfd, ospf6);
|
||||||
|
}
|
||||||
|
|
||||||
static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
|
static void ospf6_send(struct in6_addr *src, struct in6_addr *dst,
|
||||||
struct ospf6_interface *oi, struct ospf6_header *oh)
|
struct ospf6_interface *oi, struct ospf6_header *oh)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user