Skip to content

Commit

Permalink
interfaces-plugin: iterate IPv6 address changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zinccyy committed Oct 12, 2022
1 parent f23c952 commit 0303f27
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int interfaces_interface_ipv6_address_change_prefix_length(void* priv, sr_sessio
break;
}

return error;
return -1;
}

void interfaces_interface_ipv6_address_change_prefix_length_free(void* priv)
Expand Down Expand Up @@ -60,7 +60,7 @@ int interfaces_interface_ipv6_address_change_ip(void* priv, sr_session_ctx_t* se
break;
}

return error;
return -1;
}

void interfaces_interface_ipv6_address_change_ip_free(void* priv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
int interfaces_interface_ipv6_address_change_prefix_length_init(void* priv);
int interfaces_interface_ipv6_address_change_prefix_length(void* priv, sr_session_ctx_t* session, const srpc_change_ctx_t* change_ctx);
void interfaces_interface_ipv6_address_change_prefix_length_free(void* priv);

int interfaces_interface_ipv6_address_change_ip_init(void* priv);
int interfaces_interface_ipv6_address_change_ip(void* priv, sr_session_ctx_t* session, const srpc_change_ctx_t* change_ctx);
void interfaces_interface_ipv6_address_change_ip_free(void* priv);
Expand Down
12 changes: 11 additions & 1 deletion src/interfaces/src/plugin/subscription/change.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "change.h"
#include "plugin/api/interfaces/interface/ipv4/neighbor/change.h"
#include "plugin/common.h"
#include "plugin/context.h"

Expand All @@ -13,6 +12,9 @@
#include "plugin/api/interfaces/interface/change.h"
#include "plugin/api/interfaces/interface/ipv4/address/change.h"
#include "plugin/api/interfaces/interface/ipv4/change.h"
#include "plugin/api/interfaces/interface/ipv4/neighbor/change.h"
#include "plugin/api/interfaces/interface/ipv6/address/change.h"
#include "plugin/api/interfaces/interface/ipv6/neighbor/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 @@ -75,6 +77,14 @@ int interfaces_subscription_change_interfaces_interface(sr_session_ctx_t* sessio
// ipv4/neighbor/link-layer-address
SRPC_SAFE_CALL_ERR_COND(rc, rc < 0, snprintf(change_xpath_buffer, sizeof(change_xpath_buffer), "%s/ipv4/neighbor/link-layer-address", xpath), error_out);
SRPC_SAFE_CALL_ERR(rc, srpc_iterate_changes(ctx, session, change_xpath_buffer, interfaces_interface_ipv4_neighbor_change_link_layer_address, interfaces_change_interface_init, interfaces_change_interface_free), error_out);

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

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

goto out;
Expand Down

0 comments on commit 0303f27

Please sign in to comment.