Skip to content

Commit 0d90ed9

Browse files
srv6-mobile: Fix the localsid length issue on vnet/srv6
Fix the following issue. 1. The localsid length was not stored in sr localsid structure. 2. SRv6 mobile test cases were modified based on the new sr localsid CLI syntax. Type: fix Signed-off-by: Tetsuya Murakami <[email protected]> Change-Id: Ieb7620c35439e90a599802a7e0dba61a39707349
1 parent 9e722bd commit 0d90ed9

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/plugins/srv6-mobile/extra/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN set -eux; \
1515
python3-cffi \
1616
asciidoc \
1717
xmlto \
18+
libssl-dev \
1819
netcat; \
1920
rm -rf /var/lib/apt/lists/*; \
2021
mv /usr/sbin/tcpdump /usr/bin/tcpdump

src/plugins/srv6-mobile/extra/Dockerfile.j2.release

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RUN set -eux; \
1717
tcpdump \
1818
python3-cffi \
1919
python2.7 \
20+
libssl-dev \
2021
netcat; \
2122
rm -rf /var/lib/apt/lists/*; \
2223
mv /usr/sbin/tcpdump /usr/bin/tcpdump

src/plugins/srv6-mobile/test/test_srv6_mobile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def test_srv6_mobile(self):
236236
pkts = self.create_packets([("A::1", "B::1"), ("C::1", "D::1")])
237237

238238
self.vapi.cli(
239-
"sr localsid prefix {}/64 behavior end.m.gtp6.e"
239+
"sr localsid address {}/64 behavior end.m.gtp6.e"
240240
.format(pkts[0]['IPv6'].dst))
241241
self.vapi.cli(
242242
"ip route add a1::/64 via {}".format(self.ip6_nhop))
@@ -316,7 +316,7 @@ def test_srv6_mobile(self):
316316
self.vapi.cli("set sr encaps source addr A1::1")
317317
self.vapi.cli("sr policy add bsid D4:: next D2:: next D3::")
318318
self.vapi.cli(
319-
"sr localsid prefix 2001::/64 behavior end.m.gtp6.d D4::/64")
319+
"sr localsid address 2001::/64 behavior end.m.gtp6.d D4::/64")
320320
self.vapi.cli("ip route add D2::/64 via {}".format(self.ip6_nhop))
321321

322322
self.logger.info(self.vapi.cli("show sr policies"))

src/vnet/srv6/sr_localsid.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ sr_cli_localsid (char is_del, ip6_address_t * localsid_addr,
144144
pref_length = plugin->prefix_length;
145145
}
146146

147+
if (localsid_prefix_len != 0)
148+
{
149+
pref_length = localsid_prefix_len;
150+
}
151+
147152
/* Check whether there exists a FIB entry with such address */
148153
fib_prefix_t pfx = {
149154
.fp_proto = FIB_PROTOCOL_IP6,
@@ -152,11 +157,7 @@ sr_cli_localsid (char is_del, ip6_address_t * localsid_addr,
152157

153158
pfx.fp_addr.as_u64[0] = localsid_addr->as_u64[0];
154159
pfx.fp_addr.as_u64[1] = localsid_addr->as_u64[1];
155-
156-
if (pref_length != 0)
157-
{
158-
pfx.fp_len = pref_length;
159-
}
160+
pfx.fp_len = pref_length;
160161

161162
/* Lookup the FIB index associated to the table id provided */
162163
u32 fib_index = fib_table_find (FIB_PROTOCOL_IP6, fib_table);

0 commit comments

Comments
 (0)