Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 7 additions & 6 deletions cli/complete.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static struct ec_node *bash_complete_node(struct ec_node *cmdlist) {
EC_NO_ID,
ec_node("any", "prog_name"),
ec_node_option(EC_NO_ID, grcli_options_node()),
cmdlist
ec_node_clone(cmdlist)
)
);
}
Expand Down Expand Up @@ -81,22 +81,23 @@ int bash_complete(struct ec_node *cmdlist) {

if (comp_line == NULL) {
errorf("COMP_LINE is not defined");
goto end;
return ret;
}
if (comp_point == NULL) {
errorf("COMP_POINT is not defined");
goto end;
return ret;
}
if (ec_str_parse_ullint(comp_point, 10, 0, strlen(comp_line), &i) < 0) {
errorf("invalid COMP_POINT value");
goto end;
return ret;
}

gr_strcpy(buf, i, comp_line);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gr_strcpy(buf, i+1, comp_line) ?

memcpy(buf, comp_line, i);
buf[i] = '\0';

if ((cmdlist = bash_complete_node(cmdlist)) == NULL) {
errorf("bash_complete_node: %s", strerror(errno));
goto end;
return ret;
}

if ((vec = ec_strvec_sh_lex_str(buf, EC_STRVEC_TRAILSP, NULL)) == NULL) {
Expand Down
7 changes: 4 additions & 3 deletions modules/l2/cli/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void vxlan_show(struct gr_api_client *c, const struct gr_iface *iface, st
const struct gr_iface_info_vxlan *vxlan = (const struct gr_iface_info_vxlan *)iface->info;

gr_object_field(o, "vni", GR_DISP_INT, "%u", vxlan->vni);
gr_object_field(o, "local", 0, IP4_F, &vxlan->local);
gr_object_field(o, "local", 0, ADDR_F, ADDR_W(vxlan->local.af), &vxlan->local.addr);
gr_object_field(o, "encap_vrf", 0, "%s", iface_name_from_id(c, vxlan->encap_vrf_id));
gr_object_field(o, "dst_port", GR_DISP_INT, "%u", vxlan->dst_port);
gr_object_field(o, "mac", 0, ETH_F, &vxlan->mac);
Expand All @@ -30,9 +30,10 @@ vxlan_list_info(struct gr_api_client *c, const struct gr_iface *iface, char *buf
snprintf(
buf,
len,
"vni=%u local=" IP4_F " encap_vrf=%s",
"vni=%u local=" ADDR_F " encap_vrf=%s",
vxlan->vni,
&vxlan->local,
ADDR_W(vxlan->local.af),
&vxlan->local.addr,
iface_name_from_id(c, vxlan->encap_vrf_id)
);
}
Expand Down