34 lines
1.2 KiB
Markdown
34 lines
1.2 KiB
Markdown
Lab 6 Writeup
|
||
=============
|
||
|
||
My name: Catfood
|
||
|
||
My SUNet ID: 998244353
|
||
|
||
I collaborated with: An orange cat
|
||
|
||
This lab took me about `1` hours to do.
|
||
|
||
Program Structure and Design of the Router:
|
||
这个就更没啥东西了,根本不需要理解什么东西,做一个 Longest-Preifx-Match 就结束了。
|
||
|
||
两个接口:
|
||
- `add_route`,就直接无脑塞进队列里面(如果不做什么 trie 优化的话)
|
||
- 另一个 `route_one_datagram`,遍历前面生成的路由表,然后做匹配,也不用考虑什么默认路由之类的东西,找不到就扔掉。匹配完了减少 datagram 的 TTL,无论当前是0还是剪完了到0,都一起扔掉。最后记得判断 `next_hop` 是不是空的,如果是的,那么网卡发送的 `next_hop` 就换成当前数据报的目标 IP 地址就行了。
|
||
|
||
Implementation Challenges:
|
||
|
||
VSCode 的 IntelliSense 炸了两次,然后换了个 clangd。也就写了个巨复杂无比的 decltype 而已啊。
|
||
|
||
Remaining Bugs:
|
||
|
||
测试太简单了,我也不知道。
|
||
|
||
- Optional: I had unexpected difficulty with: [describe]
|
||
|
||
- Optional: I think you could make this lab better by: [describe]
|
||
|
||
- Optional: I was surprised by: [describe]
|
||
|
||
- Optional: I'm not sure about: [describe]
|