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

*: clean up zclient options #14867

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/zclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ static void zclient_event(enum zclient_event, struct zclient *);
static void zebra_interface_if_set_value(struct stream *s,
struct interface *ifp);

struct zclient_options zclient_options_default = {.receive_notify = false,
.synchronous = false};
struct zclient_options zclient_options_default = {
Copy link
Member

Choose a reason for hiding this comment

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

If I am testing via bisect, won't this change cause and assert and crash in zebra every time? This makes me unhappy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

???

Why would this crash anything?

Copy link
Member

Choose a reason for hiding this comment

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

In this commit the byte of data sent in the send_hello function is removed. The equivalent code in zebra to read this will now crash as that it will try to read 1 byte beyond the end of the stream, as that we have code that intentionally crashes when this happens. As I stated if this commit is choosen as the bisect I will be stopped in my tracks if I attempt to run zebra with any other daemon at all to find a different problem. This is especially egregious from my perspective because I cannot work around this issue at all as that the initial connection from any daemon will cause zebra to crash

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The byte is not removed in this commit. Please flush your brain cache and look at the commit again 😆
25a1dcc#diff-f949c6f0ae3101476f0699de68a4a73935fdd945294d5f235e97fb5e8bdbc782L395-R395

.synchronous = false,
};

struct sockaddr_storage zclient_addr;
socklen_t zclient_addr_len;
Expand All @@ -69,7 +70,6 @@ struct zclient *zclient_new(struct event_loop *master,
zclient->handlers = handlers;
zclient->n_handlers = n_handlers;

zclient->receive_notify = opt->receive_notify;
zclient->synchronous = opt->synchronous;

return zclient;
Expand Down Expand Up @@ -392,10 +392,7 @@ enum zclient_send_status zclient_send_hello(struct zclient *zclient)
stream_putc(s, zclient->redist_default);
stream_putw(s, zclient->instance);
stream_putl(s, zclient->session_id);
if (zclient->receive_notify)
stream_putc(s, 1);
else
stream_putc(s, 0);
stream_putc(s, 0); /* receive_notify - removed */
if (zclient->synchronous)
stream_putc(s, 1);
else
Expand Down
4 changes: 0 additions & 4 deletions lib/zclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,6 @@ struct zclient {
/* Privileges to change socket values */
struct zebra_privs_t *privs;

/* Do we care about failure events for route install? */
bool receive_notify;

/* Is this a synchronous client? */
bool synchronous;

Expand Down Expand Up @@ -834,7 +831,6 @@ extern char *zclient_evpn_dump_macip_flags(uint8_t flags, char *buf,
enum zebra_neigh_state { ZEBRA_NEIGH_INACTIVE = 0, ZEBRA_NEIGH_ACTIVE = 1 };

struct zclient_options {
bool receive_notify;
bool synchronous;
};

Expand Down