-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isisd: added l1 to l2 distibution #14610
Conversation
Please check |
25f0001
to
3cac7ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code need some review. In addition, the code is not correctly indented. Please have a look to automatic check style result.
isisd/isis_lsp.c
Outdated
_lsp_regenerate_schedule(area, lsp->level, 0, false, __func__, __FILE__, | ||
__LINE__); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not use the _lsp_regenerate_schedule()
function but instead the lsp_regenerate_schedule()
macro. Please have a look to existing call to this function.
isisd/isis_lsp.c
Outdated
struct isis_lsp* lsp_tmp_ip; | ||
struct isis_lsp* lsp_tmp_ipv6; | ||
struct lspdb_head *head_tmp_ip = &area->lspdb[0]; | ||
struct lspdb_head *head_tmp_ipv6 = &area->lspdb[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use same variables for both IP and IPv6. There are temporary pointer and there is no reason to duplicate them.
3cac7ef
to
1ea5326
Compare
1ea5326
to
e398825
Compare
fcfbe69
to
eb4217b
Compare
79b41ad
to
c15c161
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks okay ... waiting on other review comments
6d25240
to
be16d01
Compare
fc794ee
to
70a24a1
Compare
70a24a1
to
97a869a
Compare
74c32fe
to
252fdb4
Compare
252fdb4
to
dfde882
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good ... waiting on other reviewers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iteration functions over IP extended reachability should be rewritten.
All new functions should be declared as static and not publish through isis_lsp.h if there are not used in another file
isisd/isis_lsp.h
Outdated
void iteration_in_lspdb(struct isis_area *area, struct isis_lsp *lsp); | ||
void adding_new_prefix(struct isis_area *area, struct isis_lsp *lsp, | ||
struct isis_lsp *lsp_tmp); | ||
void iteration_in_lsp_ip(struct isis_extended_ip_reach *i, struct isis_lsp *lsp, | ||
int *count); | ||
void iteration_in_lsp_ipv6(struct isis_ipv6_reach *i, struct isis_lsp *lsp, | ||
int *count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary if these functions are not used outside isis_lsp.c file. You should rather declare the functions as static in isis_lsp.c file
isisd/isis_lsp.c
Outdated
@@ -1070,6 +1071,80 @@ static struct isis_lsp *lsp_next_frag(uint8_t frag_num, struct isis_lsp *lsp0, | |||
* Builds the LSP data part. This func creates a new frag whenever | |||
* area->lsp_frag_threshold is exceeded. | |||
*/ | |||
void iteration_in_lsp_ip(struct isis_extended_ip_reach *r, struct isis_lsp *lsp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is preferable to declare a function that return the count instead of void and returning the result with a variable. In particular, in the function, you don't check if the count variable has been allocated or not i.e. if it is not NULL.
isisd/isis_lsp.c
Outdated
if (IPV4_ADDR_SAME(&r->prefix.prefix, &rt->prefix.prefix)) { | ||
if ((r->metric > rt->metric) || | ||
(r->metric == rt->metric)) | ||
*count += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a local variable instead and later use return count
isisd/isis_lsp.c
Outdated
if ((r->metric > rt->metric) || | ||
(r->metric == rt->metric)) | ||
*count += 1; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you code terminate the loop once a first occurrence has been founded. Thus, the value of count will be 0 or 1. May be returning a boolean should be sufficient if it is really the goal of this function. If the objective is to count the number of extended IP reachability TLV that have the same IPv4 prefix, you should remove the break instruction.
isisd/isis_lsp.c
Outdated
void iteration_in_lsp_ipv6(struct isis_ipv6_reach *r, struct isis_lsp *lsp, | ||
int *count) | ||
{ | ||
for (struct isis_item *l = lsp->tlvs->ipv6_reach.head; l; l = l->next) { | ||
struct isis_ipv6_reach *rt = (struct isis_ipv6_reach *)l; | ||
|
||
if (IPV6_ADDR_SAME(&r->prefix.prefix.s6_addr, | ||
&rt->prefix.prefix.s6_addr)) { | ||
if ((r->metric > rt->metric) || | ||
(r->metric == rt->metric)) | ||
*count += 1; | ||
break; | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as for IPv4 function
@Sashhkaa still working on this? |
dfde882
to
5cb2fc2
Compare
5cb2fc2
to
8cfa3b5
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
added adding prefixes with the best metric from the level-1 db to the level-2 db on l1_l2 end system
Signed-off-by: Sososhas [email protected]