Skip to content
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

statd: add support for additional operstates #92

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

rical
Copy link
Contributor

@rical rical commented Aug 1, 2023

Add support for yang link state "lower-layer-down" and "not-present".

Copy link
Contributor

@troglobit troglobit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall better solution to any of what we have right now. I did a few more fixes in #82 that I'd like to get in, but I could also rework that PR.

Just a thought, instead of multiple strcmp(), personally I'd go for more of a table of strings:

struct {
  char *kern;
  char *yang;
} map[] = {
  { "foo", "bar" },
};

for (size_t i = 0; sizeof(map) / sizeof(map[0]); i++) {
  if (strcmp(operstate, map[i]))
    continue;
  return map[i];
}

return "unknown";

src/statd/statd.c Show resolved Hide resolved
Add support for yang link state "lower-layer-down" and "not-present".

Signed-off-by: Richard Alpe <richard@bit42.se>
@rical rical force-pushed the statd-additional-operstates branch from 48bd687 to dfc7c52 Compare August 1, 2023 10:03
@rical rical requested a review from troglobit August 2, 2023 06:32
Copy link
Contributor

@troglobit troglobit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 👍

@troglobit troglobit merged commit a931790 into kernelkit:main Aug 2, 2023
1 check passed
@troglobit
Copy link
Contributor

Btw, I'll be back from vacation in a couple of week, but iirc @wkz will be back already next week, Monday.

@troglobit troglobit added this to the Infix v23.08 milestone Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants