Skip to content

Commit

Permalink
Merge pull request #23 from vjardin/vlan_wildcard
Browse files Browse the repository at this point in the history
VLAN encap: none
  • Loading branch information
acassen authored Feb 20, 2024
2 parents 265a5b6 + 620d454 commit c8a07a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
18 changes: 11 additions & 7 deletions src/gtp_switch_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ DEFUN(gtpc_force_pgw_selection,

DEFUN(gtpu_ipip,
gtpu_ipip_cmd,
"gtpu-ipip traffic-selector (A.B.C.D|X:X:X:X) local (A.B.C.D|X:X:X:X) remote (A.B.C.D|X:X:X:X) vlan <1-4095>",
"gtpu-ipip traffic-selector (A.B.C.D|X:X:X:X) local (A.B.C.D|X:X:X:X) remote (A.B.C.D|X:X:X:X) [vlan <1-4095>]",
"GTP Userplane IPIP tunnel\n"
"GTP-U local L3 destination address\n"
"IPv4 Address\n"
Expand Down Expand Up @@ -260,8 +260,8 @@ DEFUN(gtpu_ipip,
return CMD_WARNING;
}

if (argc == 4) {
VTY_GET_INTEGER_RANGE("Vlan ID", vlan, argv[3], 1, 4095);
if (argc == 5) {
VTY_GET_INTEGER_RANGE("Vlan ID", vlan, argv[4], 1, 4095);
if (vlan) {} ; /* dummy test */
}

Expand Down Expand Up @@ -513,12 +513,16 @@ gtp_config_write(vty_t *vty)
vty_out(vty, " pgw-force-selection %s%s"
, inet_sockaddrtos(&ctx->pgw_addr)
, VTY_NEWLINE);
if (__test_bit(GTP_FL_IPTNL_BIT, &ctx->flags))
vty_out(vty, " gtpu-ipip traffic-selector %u.%u.%u.%u local %u.%u.%u.%u remote %u.%u.%u.%u%s"
if (__test_bit(GTP_FL_IPTNL_BIT, &ctx->flags)) {
vty_out(vty, " gtpu-ipip traffic-selector %u.%u.%u.%u local %u.%u.%u.%u remote %u.%u.%u.%u"
, NIPQUAD(ctx->iptnl.selector_addr)
, NIPQUAD(ctx->iptnl.local_addr)
, NIPQUAD(ctx->iptnl.remote_addr)
, VTY_NEWLINE);
, NIPQUAD(ctx->iptnl.remote_addr));
if (ctx->iptnl.encap_vlan_id)
vty_out(vty, " vlan %u"
, ctx->iptnl.encap_vlan_id);
vty_out(vty, "%s", VTY_NEWLINE);
}
if (ctx->iptnl.flags & IPTNL_FL_TRANSPARENT_INGRESS_ENCAP)
vty_out(vty, " gtpu-ipip transparent-ingress-encap%s", VTY_NEWLINE);
if (ctx->iptnl.flags & IPTNL_FL_TRANSPARENT_EGRESS_ENCAP)
Expand Down
14 changes: 8 additions & 6 deletions src/gtp_xdp_iptnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ gtp_xdp_iptnl_vty(vty_t *vty, struct bpf_map *map)
return -1;
}

vty_out(vty, "+------------------+------------------+------------------+-------+%s"
"| Selector Address | Local Address | Remote Address | Flags |%s"
"+------------------+------------------+------------------+-------+%s"
vty_out(vty, "+------------------+------------------+------------------+-------+----+----+%s"
"| Selector Address | Local Address | Remote Address | Flags |encV|decV|%s"
"+------------------+------------------+------------------+-------+----+----+%s"
, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);

/* Walk hashtab */
Expand All @@ -185,16 +185,18 @@ gtp_xdp_iptnl_vty(vty_t *vty, struct bpf_map *map)
continue;
}

vty_out(vty, "| %16s | %16s | %16s | %5d |%s"
vty_out(vty, "| %16s | %16s | %16s | %5d |%4d|%4d|%s"
, inet_ntoa2(r[0].selector_addr, sip)
, inet_ntoa2(r[0].local_addr, lip)
, inet_ntoa2(r[0].remote_addr, rip)
, r[0].flags
, r[0].encap_vlan_id
, r[0].decap_vlan_id
, VTY_NEWLINE);
}

vty_out(vty, "+------------------+------------------+------------------+-------+%s"
vty_out(vty, "+------------------+------------------+------------------+-------+----+----+%s"
, VTY_NEWLINE);
free(r);
return 0;
}
}

0 comments on commit c8a07a1

Please sign in to comment.