Skip to content

Commit

Permalink
interfaces-plugin: disable IPv4 address properties change callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
zinccyy committed Oct 6, 2022
1 parent b194860 commit 9b7e76c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int interfaces_interface_ipv4_address_change_netmask(void* priv, sr_session_ctx_
break;
}

return error;
return -1;
}

void interfaces_interface_ipv4_address_change_netmask_free(void* priv)
Expand Down Expand Up @@ -60,7 +60,7 @@ int interfaces_interface_ipv4_address_change_prefix_length(void* priv, sr_sessio
break;
}

return error;
return -1;
}

void interfaces_interface_ipv4_address_change_prefix_length_free(void* priv)
Expand Down Expand Up @@ -92,7 +92,7 @@ int interfaces_interface_ipv4_address_change_ip(void* priv, sr_session_ctx_t* se
break;
}

return error;
return -1;
}

void interfaces_interface_ipv4_address_change_ip_free(void* priv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
int interfaces_interface_ipv4_address_change_netmask_init(void* priv);
int interfaces_interface_ipv4_address_change_netmask(void* priv, sr_session_ctx_t* session, const srpc_change_ctx_t* change_ctx);
void interfaces_interface_ipv4_address_change_netmask_free(void* priv);

int interfaces_interface_ipv4_address_change_prefix_length_init(void* priv);
int interfaces_interface_ipv4_address_change_prefix_length(void* priv, sr_session_ctx_t* session, const srpc_change_ctx_t* change_ctx);
void interfaces_interface_ipv4_address_change_prefix_length_free(void* priv);

int interfaces_interface_ipv4_address_change_ip_init(void* priv);
int interfaces_interface_ipv4_address_change_ip(void* priv, sr_session_ctx_t* session, const srpc_change_ctx_t* change_ctx);
void interfaces_interface_ipv4_address_change_ip_free(void* priv);
Expand Down
13 changes: 13 additions & 0 deletions src/interfaces/src/plugin/subscription/change.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// change API
#include "plugin/api/interfaces/change.h"
#include "plugin/api/interfaces/interface/change.h"
#include "plugin/api/interfaces/interface/ipv4/address/change.h"
#include "plugin/api/interfaces/interface/ipv4/change.h"

int interfaces_subscription_change_interfaces_interface(sr_session_ctx_t* session, uint32_t subscription_id, const char* module_name, const char* xpath, sr_event_t event, uint32_t request_id, void* private_data)
Expand Down Expand Up @@ -58,6 +59,18 @@ int interfaces_subscription_change_interfaces_interface(sr_session_ctx_t* sessio
SRPC_SAFE_CALL_ERR_COND(rc, rc < 0, snprintf(change_xpath_buffer, sizeof(change_xpath_buffer), "%s/ipv4/address", xpath), error_out);
SRPC_SAFE_CALL_ERR(rc, srpc_iterate_changes(ctx, session, change_xpath_buffer, interfaces_interface_ipv4_change_address, interfaces_change_interface_init, interfaces_change_interface_free), error_out);

// ipv4/address/ip
SRPC_SAFE_CALL_ERR_COND(rc, rc < 0, snprintf(change_xpath_buffer, sizeof(change_xpath_buffer), "%s/ipv4/address/ip", xpath), error_out);
SRPC_SAFE_CALL_ERR(rc, srpc_iterate_changes(ctx, session, change_xpath_buffer, interfaces_interface_ipv4_address_change_ip, interfaces_change_interface_init, interfaces_change_interface_free), error_out);

// ipv4/address/prefix-length
SRPC_SAFE_CALL_ERR_COND(rc, rc < 0, snprintf(change_xpath_buffer, sizeof(change_xpath_buffer), "%s/ipv4/address/prefix-length", xpath), error_out);
SRPC_SAFE_CALL_ERR(rc, srpc_iterate_changes(ctx, session, change_xpath_buffer, interfaces_interface_ipv4_address_change_prefix_length, interfaces_change_interface_init, interfaces_change_interface_free), error_out);

// ipv4/address/netmask
SRPC_SAFE_CALL_ERR_COND(rc, rc < 0, snprintf(change_xpath_buffer, sizeof(change_xpath_buffer), "%s/ipv4/address/netmask", xpath), error_out);
SRPC_SAFE_CALL_ERR(rc, srpc_iterate_changes(ctx, session, change_xpath_buffer, interfaces_interface_ipv4_address_change_netmask, interfaces_change_interface_init, interfaces_change_interface_free), error_out);

// ipv4/neighbor
SRPC_SAFE_CALL_ERR_COND(rc, rc < 0, snprintf(change_xpath_buffer, sizeof(change_xpath_buffer), "%s/ipv4/neighbor", xpath), error_out);
SRPC_SAFE_CALL_ERR(rc, srpc_iterate_changes(ctx, session, change_xpath_buffer, interfaces_interface_ipv4_change_neighbor, interfaces_change_interface_init, interfaces_change_interface_free), error_out);
Expand Down

0 comments on commit 9b7e76c

Please sign in to comment.