K Segment Routing

Segment Routing over IPv6 is a next-generation IP bearer protocol.
In traditional IP routing, an IP packet sent from a source host goes through multiple routers and then reaches the destination host. Each router checks the destination IP address inside the IP packet header. Then sent the packet to the next router which is closer to the destination. Technically, we call the next closest router “next hop”. Of course, the “next hop” has to be a neighbor of the current router in the graph.
Routers typically maintain a routing table, lists the next hop to particular network destinations. Whenever a new IP packet comes, a router examines the packet header’s destination IP address and compares it against a routing table to determine the packet’s best next hop.
No wonder looking up routing tables takes time, if an IP packet goes through K routers to reach the destination, the looking up process will happen K times at each router. That’s one reason why there is high latency between two distant hosts.
In a segment routed network, an IP packet may be prepended a header that contains a list of “segments”, which are instructions that are executed on subsequent nodes in the network. These instructions may be forwarding instructions, such as an instruction to forward a packet to a specific destination or interface.
We can consider the internet as a directed graph.
For example, consider the following topology.

±+ #2 ±+ #1 ±+
|A±------------>|C±--------->|D|
+++ +++ ±+
| |
| |
| |
| |
| |
| |
#1| |
| |#2
| |
| |
| |
v |
±+ |
|B|<--------------+
±+
Router A has two out-edges, its #1 out edge is connected to Router B and its #2 out edge is connected to Router C.
Router C has two out-edges, too. Its #1 out edge is connected to Router D and its #2 out edge is connected to Router B.
Suppose A is going to send a packet to Router D. The only path in this graph is A->C->D. The link used is the #2 out edge of A, and the #1 out edge of C.
A is going to receive a list of instructions along with the packet if segment routing protocol is enabled:
The first instruction is to forward the package by #2 out-edge of the current vertex (Router A), the second instruction is to forward the package by #1 out-edge of the current vertex (Router C). Hence, the routers will check the instructions in the packet header to decide the next hop. The routing table looking up is no longer needed.
Now we have a network log recording the SRv6 packet headers used during last month. Unfortunately, the destination addresses get lost, can you recover them from the forward instructions?
Input
There are T test cases in this problem.
The first line has one integer T.
For each test case:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Prime me

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值