Tue, Jan 17, 2017 at 11:36:06AM CET, paganelb9(a)box.az wrote:
Signed-off-by: Paganelb9 <paganelb9(a)box.az>
1. I doubt you name is "Paganelb9".
2. The signed-off tag should be placed at the end of the description.
"git log" will show you.
>
>Fix problem with retrieving state item value per interface name,
>when some member interface names partially match to one another.
>Like `eth1` and `eth11`, or `eth1` with `eth10`
>Add also optimization suggested by Marcelo Ricardo Leitner,
>not to perform any string comparison if string lengths differ.
>---
> teamd/teamd_state.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>diff --git a/teamd/teamd_state.c b/teamd/teamd_state.c
>index ab64db9..952f031 100644
>--- a/teamd/teamd_state.c
>+++ b/teamd/teamd_state.c
>@@ -318,8 +318,9 @@ static int __find_by_item_path(struct teamd_state_val_item
**p_item,
> subpath = ifname_end + 1;
>
> teamd_for_each_tdport(cur_tdport, ctx) {
>- if (!strncmp(cur_tdport->ifname, ifname_start,
>- ifname_len)) {
>+ if (strlen(cur_tdport->ifname) == ifname_len &&
>+ (!strncmp(cur_tdport->ifname, ifname_start,
>+ ifname_len))) {
> tdport = cur_tdport;
> break;
> }
>--
>2.10.2