mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 12:49:18 +00:00
isisd: use a smaller #ifdef for isis_receive()
There's no need to provide two definitions of the isis_receive() function (one for GNU_LINUX and the other for !GNU_LINUX). Both differ only slightly so it makes more sense to define isis_receive() just once and use a smaller #ifdef to account for these differences. This improves code readability. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
18653436b7
commit
0649629483
@ -2139,7 +2139,6 @@ isis_handle_pdu (struct isis_circuit *circuit, u_char * ssnpa)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GNU_LINUX
|
|
||||||
int
|
int
|
||||||
isis_receive (struct thread *thread)
|
isis_receive (struct thread *thread)
|
||||||
{
|
{
|
||||||
@ -2153,10 +2152,11 @@ isis_receive (struct thread *thread)
|
|||||||
circuit = THREAD_ARG (thread);
|
circuit = THREAD_ARG (thread);
|
||||||
assert (circuit);
|
assert (circuit);
|
||||||
|
|
||||||
|
circuit->t_read = NULL;
|
||||||
|
|
||||||
isis_circuit_stream(circuit, &circuit->rcv_stream);
|
isis_circuit_stream(circuit, &circuit->rcv_stream);
|
||||||
|
|
||||||
retval = circuit->rx (circuit, ssnpa);
|
retval = circuit->rx (circuit, ssnpa);
|
||||||
circuit->t_read = NULL;
|
|
||||||
|
|
||||||
if (retval == ISIS_OK)
|
if (retval == ISIS_OK)
|
||||||
retval = isis_handle_pdu (circuit, ssnpa);
|
retval = isis_handle_pdu (circuit, ssnpa);
|
||||||
@ -2166,52 +2166,20 @@ isis_receive (struct thread *thread)
|
|||||||
*/
|
*/
|
||||||
if (!circuit->is_passive)
|
if (!circuit->is_passive)
|
||||||
{
|
{
|
||||||
|
#ifdef GNU_LINUX
|
||||||
THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
|
THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
|
||||||
circuit->fd);
|
circuit->fd);
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
int
|
|
||||||
isis_receive (struct thread *thread)
|
|
||||||
{
|
|
||||||
struct isis_circuit *circuit;
|
|
||||||
u_char ssnpa[ETH_ALEN];
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the circuit
|
|
||||||
*/
|
|
||||||
circuit = THREAD_ARG (thread);
|
|
||||||
assert (circuit);
|
|
||||||
|
|
||||||
circuit->t_read = NULL;
|
|
||||||
|
|
||||||
isis_circuit_stream(circuit, &circuit->rcv_stream);
|
|
||||||
|
|
||||||
retval = circuit->rx (circuit, ssnpa);
|
|
||||||
|
|
||||||
if (retval == ISIS_OK)
|
|
||||||
retval = isis_handle_pdu (circuit, ssnpa);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* prepare for next packet.
|
|
||||||
*/
|
|
||||||
if (!circuit->is_passive)
|
|
||||||
{
|
|
||||||
circuit->t_read = thread_add_timer_msec (master, isis_receive, circuit,
|
circuit->t_read = thread_add_timer_msec (master, isis_receive, circuit,
|
||||||
listcount
|
listcount
|
||||||
(circuit->area->circuit_list) *
|
(circuit->area->circuit_list) *
|
||||||
100);
|
100);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* filling of the fixed isis header */
|
/* filling of the fixed isis header */
|
||||||
void
|
void
|
||||||
fill_fixed_hdr (struct isis_fixed_hdr *hdr, u_char pdu_type)
|
fill_fixed_hdr (struct isis_fixed_hdr *hdr, u_char pdu_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user