update the folder organisation

This commit is contained in:
Hanzhang ma 2024-11-27 18:35:15 +01:00
parent 6d14b30e89
commit cab7babbb1
4 changed files with 1067 additions and 725 deletions

87
Blatt02/ARP.drawio Normal file
View File

@ -0,0 +1,87 @@
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.7.17 Chrome/128.0.6613.36 Electron/32.0.1 Safari/537.36" version="24.7.17">
<diagram name="Page-1" id="c7488fd3-1785-93aa-aadb-54a6760d102a">
<mxGraphModel dx="988" dy="570" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" background="none" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="W-n-PndQ-2xYdpGvvika-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-3" target="W-n-PndQ-2xYdpGvvika-4" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-3" value="" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.annotation_2;align=left;labelPosition=right;pointerEvents=1;" parent="1" vertex="1">
<mxGeometry x="170" y="350" width="50" height="100" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-4" target="W-n-PndQ-2xYdpGvvika-6" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-4" value="通知caller扔掉包" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0;" parent="1" vertex="1">
<mxGeometry x="300" y="440" width="100" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-6" value="生成一个Ethernet Packet&lt;div&gt;(type field =&lt;br style=&quot;font-size: 8px;&quot;&gt;ether_type$ADDR_RESOLUTION&lt;/div&gt;" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0;fontSize=8;align=center;" parent="1" vertex="1">
<mxGeometry x="500" y="435" width="150" height="70" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-8" target="W-n-PndQ-2xYdpGvvika-10" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-8" value="设置ar$hrd为ares_hrd$Ethernet,&lt;div&gt;ar$pro为protocol type&lt;/div&gt;" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0;fontSize=8;align=center;" parent="1" vertex="1">
<mxGeometry x="500" y="550" width="150" height="70" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=-0.081;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-6" target="W-n-PndQ-2xYdpGvvika-8" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-10" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="575.1111111111111" y="770.0555555555554" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-10" value="设置ar$hrd为ares_hrd$Ethernet,&lt;div&gt;ar$pro为protocol type&lt;/div&gt;&lt;div&gt;ar$hln为6,MAC地址的字节数&lt;/div&gt;&lt;div&gt;ar$pln为地址协议的长度&lt;/div&gt;&lt;div&gt;ar$op为ares_op$REQUEST&lt;/div&gt;&lt;div&gt;ar$sha为48位网络地址&lt;/div&gt;&lt;div&gt;ar$spa是协议地址(ipv4)&lt;/div&gt;&lt;div&gt;ar$tpa是机器尝试访问的协议地址&lt;/div&gt;&lt;div&gt;ar$tha不需要特别设定&lt;/div&gt;&lt;div&gt;ar$tha可以设置成广播地址&lt;/div&gt;" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0;fontSize=8;align=center;" parent="1" vertex="1">
<mxGeometry x="500" y="680" width="150" height="110" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-13" target="W-n-PndQ-2xYdpGvvika-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-13" value="有在ar$hrd的硬件类型吗支持这个硬件类型吗" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="200" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-14" target="W-n-PndQ-2xYdpGvvika-17" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-14" value="这个包的协议是在ar$pro中吗支持这个协议类型吗可能检查地址长度" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="390" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-15" value="如果Merge_flag是false&lt;div&gt;发送方协议地址,&lt;/div&gt;&lt;div&gt;发送方硬件地址&lt;/div&gt;&lt;div&gt;存入ARP&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="580" y="230" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-16" target="W-n-PndQ-2xYdpGvvika-15" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-16" target="W-n-PndQ-2xYdpGvvika-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-16" value="这个包是目的协议地址吗?" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="580" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-17" value="把标志位Merge_flag设置为False&lt;div&gt;在ARP缓存表中查找发送方协议地址&lt;br&gt;如果存在更新ip-mac表&lt;/div&gt;&lt;div&gt;把标志位Merge_flag设置为true&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="390" y="210" width="120" height="100" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-18" target="W-n-PndQ-2xYdpGvvika-19" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-18" target="W-n-PndQ-2xYdpGvvika-20" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-18" value="opcode是ares_op$REQUEST吗" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="770" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-19" value="交换硬件和协议部分,把本地硬件和协议地址放到发送区&lt;div&gt;设置ar$op部分为ares_op$REPLY&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="770" y="230" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-20" value="发送" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="960" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.029;entryY=0.516;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-14" target="W-n-PndQ-2xYdpGvvika-16" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

87
Blatt02/ARP2.drawio Normal file
View File

@ -0,0 +1,87 @@
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.7.17 Chrome/128.0.6613.36 Electron/32.0.1 Safari/537.36" version="24.7.17">
<diagram name="Page-1" id="c7488fd3-1785-93aa-aadb-54a6760d102a">
<mxGraphModel dx="687" dy="394" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" background="none" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="W-n-PndQ-2xYdpGvvika-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-3" target="W-n-PndQ-2xYdpGvvika-4" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-3" value="" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.annotation_2;align=left;labelPosition=right;pointerEvents=1;" parent="1" vertex="1">
<mxGeometry x="170" y="350" width="50" height="100" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-4" target="W-n-PndQ-2xYdpGvvika-6" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-4" value="通知caller扔掉包" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0;" parent="1" vertex="1">
<mxGeometry x="300" y="440" width="100" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-6" value="生成一个Ethernet Packet&lt;div&gt;(type field =&lt;br style=&quot;font-size: 8px;&quot;&gt;ether_type$ADDR_RESOLUTION&lt;/div&gt;" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0;fontSize=8;align=center;" parent="1" vertex="1">
<mxGeometry x="500" y="435" width="150" height="70" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-8" target="W-n-PndQ-2xYdpGvvika-10" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-8" value="设置ar$hrd为ares_hrd$Ethernet,&lt;div&gt;ar$pro为protocol type&lt;/div&gt;" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0;fontSize=8;align=center;" parent="1" vertex="1">
<mxGeometry x="500" y="550" width="150" height="70" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=-0.081;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-6" target="W-n-PndQ-2xYdpGvvika-8" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-10" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="575.1111111111111" y="770.0555555555554" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-10" value="设置ar$hrd为ares_hrd$Ethernet,&lt;div&gt;ar$pro为protocol type&lt;/div&gt;&lt;div&gt;ar$hln为6,MAC地址的字节数&lt;/div&gt;&lt;div&gt;ar$pln为地址协议的长度&lt;/div&gt;&lt;div&gt;ar$op为ares_op$REQUEST&lt;/div&gt;&lt;div&gt;ar$sha为48位网络地址&lt;/div&gt;&lt;div&gt;ar$spa是协议地址(ipv4)&lt;/div&gt;&lt;div&gt;ar$tpa是机器尝试访问的协议地址&lt;/div&gt;&lt;div&gt;ar$tha不需要特别设定&lt;/div&gt;&lt;div&gt;ar$tha可以设置成广播地址&lt;/div&gt;" style="shape=parallelogram;html=1;strokeWidth=2;perimeter=parallelogramPerimeter;whiteSpace=wrap;rounded=1;arcSize=12;size=0;fontSize=8;align=center;" parent="1" vertex="1">
<mxGeometry x="500" y="680" width="150" height="110" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-13" target="W-n-PndQ-2xYdpGvvika-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-13" value="有在ar$hrd的硬件类型吗支持这个硬件类型吗" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="200" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-14" target="W-n-PndQ-2xYdpGvvika-17" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-14" value="这个包的协议是在ar$pro中吗支持这个协议类型吗可能检查地址长度" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="390" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-15" value="如果Merge_flag是false&lt;div&gt;发送方协议地址,&lt;/div&gt;&lt;div&gt;发送方硬件地址&lt;/div&gt;&lt;div&gt;存入ARP&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="580" y="230" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-16" target="W-n-PndQ-2xYdpGvvika-15" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-16" target="W-n-PndQ-2xYdpGvvika-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-16" value="这个包是目的协议地址吗?" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="580" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-17" value="把标志位Merge_flag设置为False&lt;div&gt;在ARP缓存表中查找发送方协议地址&lt;br&gt;如果存在更新ip-mac表&lt;/div&gt;&lt;div&gt;把标志位Merge_flag设置为true&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="390" y="210" width="120" height="100" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-18" target="W-n-PndQ-2xYdpGvvika-19" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-18" target="W-n-PndQ-2xYdpGvvika-20" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-18" value="opcode是ares_op$REQUEST吗" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="770" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-19" value="交换硬件和协议部分,把本地硬件和协议地址放到发送区&lt;div&gt;设置ar$op部分为ares_op$REPLY&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="770" y="230" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-20" value="发送" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="960" y="110" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="W-n-PndQ-2xYdpGvvika-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.029;entryY=0.516;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="W-n-PndQ-2xYdpGvvika-14" target="W-n-PndQ-2xYdpGvvika-16" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@ -194,3 +194,171 @@ buf :FF FF FF FF FF FF AE AB 32 09 8E B4 08 06 00 01 08 00 06 04 00 01 AE AB 32
![image-20241119153648360](https://lsky.mhrooz.xyz/2024/11/19/cf14356ea79d8.png)
root@pc1:~# tcpdump -i eth1
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
10:53:47.911087 IP6 2001:db8:5::2 > ff02::1:ff00:1: ICMP6, neighbor solicitation, who has 2001:db8:5::1, length 32
10:53:47.911189 IP6 2001:db8:5::1 > 2001:db8:5::2: ICMP6, neighbor advertisement, tgt is 2001:db8:5::1, length 32
10:53:47.912325 IP6 2001:db8:5::2 > 2001:db8:5::1: ICMP6, echo request, id 56760, seq 1, length 64
10:53:47.912349 IP6 2001:db8:5::1 > 2001:db8:5::2: ICMP6, echo reply, id 56760, seq 1, length 64
10:53:48.904692 IP6 2001:db8:5::2 > 2001:db8:5::1: ICMP6, echo request, id 56760, seq 2, length 64
10:53:48.904719 IP6 2001:db8:5::1 > 2001:db8:5::2: ICMP6, echo reply, id 56760, seq 2, length 64
10:53:49.906078 IP6 2001:db8:5::2 > 2001:db8:5::1: ICMP6, echo request, id 56760, seq 3, length 64
10:53:49.906103 IP6 2001:db8:5::1 > 2001:db8:5::2: ICMP6, echo reply, id 56760, seq 3, length 64
10:53:50.907512 IP6 2001:db8:5::2 > 2001:db8:5::1: ICMP6, echo request, id 56760, seq 4, length 64
10:53:50.907538 IP6 2001:db8:5::1 > 2001:db8:5::2: ICMP6, echo reply, id 56760, seq 4, length 64
10:53:51.908904 IP6 2001:db8:5::2 > 2001:db8:5::1: ICMP6, echo request, id 56760, seq 5, length 64
10:53:51.908929 IP6 2001:db8:5::1 > 2001:db8:5::2: ICMP6, echo reply, id 56760, seq 5, length 64
10:53:52.926411 IP6 fe80::216:3eff:fe00:2 > 2001:db8:5::2: ICMP6, neighbor solicitation, who has 2001:db8:5::2, length 32
10:53:52.927121 IP6 2001:db8:5::2 > fe80::216:3eff:fe00:2: ICMP6, neighbor advertisement, tgt is 2001:db8:5::2, length 24
13:14:32.958532 IP6 2001:db8:5::1 > 2001:db8:5::2: ICMP6, neighbor advertisement, tgt is 2001:db8:5::2, length 32
0x0000: 0016 3e00 0004 0016 3e00 0602 86dd 6000 ..>.....>.....`.
0x0010: 0000 0020 3aff 2001 0db8 0005 0000 0000 ....:...........
0x0020: 0000 0000 0001 2001 0db8 0005 0000 0000 ................
0x0030: 0000 0000 0002 8800 484c 6000 0000 2001 ........HL`.....
0x0040: 0db8 0005 0000 0000 0000 0000 0002 0201 ................
0x0050: 0016 3e00 0602 ..>...
```
13:14:32.958532 IP6 2001:db8:5::1 > 2001:db8:5::2: ICMP6, neighbor advertisement, tgt is 2001:db8:5::2, length 32
0x0000: 0016 3e00 0004 0016 3e00 0602 86dd 6000 ..>.....>.....`.
0x0010: 0000 0020 3aff 2001 0db8 0005 0000 0000 ....:...........
0x0020: 0000 0000 0001 2001 0db8 0005 0000 0000 ................
0x0030: 0000 0000 0002 8800 484c 6000 0000 2001 ........HL`.....
0x0040: 0db8 0005 0000 0000 0000 0000 0002 0201 ................
0x0050: 0016 3e00 0602 ..>...
```
00:16:3e:00:00:02
这个包是一个 **ICMPv6 邻居通告Neighbor Advertisement, NA** 消息,表明发送方(`2001:db8:5::1`)告知接收方(`2001:db8:5::2`),其目标地址(`tgt`的链路层MAC信息。
以下是对这个包的逐字段详细分析:
------
### **1. 数据包的结构**
ICMPv6 邻居通告消息由以下几部分组成:
| **字段** | **长度** | **解释** |
| ------------------- | -------- | ------------------------------------------------------ |
| **以太网帧头** | 14 字节 | 包括源 MAC 地址、目标 MAC 地址和以太网类型。 |
| **IPv6 头** | 40 字节 | IPv6 源地址、目的地址,及与数据包相关的信息。 |
| **ICMPv6 头** | 4 字节 | 包括类型Type、代码Code、校验和Checksum。 |
| **ICMPv6 数据部分** | 可变长度 | 邻居通告消息的具体内容,包括目标地址和链路层地址选项。 |
------
### **2. 分析具体字段**
#### **以太网帧头**
```
0x0000: 0016 3e00 0004 0016 3e00 0602 86dd
```
| 偏移量 | 字段 | 值 | 解释 |
| -------- | ------------- | ------------------- | --------------------------------------- |
| `0x0000` | 目标 MAC 地址 | `00:16:3e:00:00:04` | 目标设备的链路层地址(目的 MAC 地址)。 |
| `0x0006` | 源 MAC 地址 | `00:16:3e:00:06:02` | 源设备的链路层地址(发送方 MAC 地址)。 |
| `0x000c` | 以太网类型 | `0x86dd` | 表示接下来的数据是 IPv6 数据包。 |
------
#### **IPv6 头部**
```
0x0010: 6000 0000 0020 3aff 2001 0db8 0005 0000
0x0020: 0000 0000 0001 2001 0db8 0005 0000 0000
0x0030: 0000 0000 0002
```
| 偏移量 | 字段 | 值 | 解释 |
| -------- | ---------------- | --------------- | -------------------------------------------- |
| `0x0010` | 版本/流量类/流标 | `6000 0000` | IPv6 版本号6流量类别0流标0。 |
| `0x0014` | 载荷长度 | `0020` | 载荷长度 32 字节。 |
| `0x0016` | 下一头部类型 | `3a` | 表示下一头部为 ICMPv658。 |
| `0x0017` | 跳数限制 | `ff` | 初始跳数设置为 255避免跨链路转发。 |
| `0x0018` | 源地址 | `2001:db8:5::1` | 发送方 IPv6 地址。 |
| `0x0028` | 目的地址 | `2001:db8:5::2` | 接收方 IPv6 地址。 |
------
#### **ICMPv6 头部**
```
0x0030: 8800 484c
```
| 偏移量 | 字段 | 值 | 解释 |
| -------- | ------------ | ------ | ------------------------------------------------ |
| `0x0030` | 类型Type | `88` | 表示这是一个邻居通告Neighbor Advertisement。 |
| `0x0031` | 代码Code | `00` | 固定为 0邻居通告无子代码。 |
| `0x0032` | 校验和 | `484c` | 校验和,确保 ICMPv6 数据的完整性。 |
------
#### **ICMPv6 数据部分**
```
0x0034: 6000 0000 2001 0db8 0005 0000 0000 0000 0002
0x0050: 0201 0016 3e00 0602
```
##### **(a) 邻居通告标志和目标地址**
```
0x0034: 6000 0000 2001 0db8 0005 0000 0000 0000 0002
```
| 偏移量 | 字段 | 值 | 解释 |
| -------- | -------- | --------------- | ---------------------------------- |
| `0x0034` | 目标地址 | `2001:db8:5::2` | 目标设备的 IPv6 地址,告知请求方。 |
##### **(b) 链路层地址选项**
```
0x0050: 0201 0016 3e00 0602
```
| 偏移量 | 字段 | 值 | 解释 |
| -------- | -------- | ------------------- | ---------------------------------------------------- |
| `0x0050` | 选项类型 | `02` | 链路层地址选项Target Link-Layer Address Option。 |
| `0x0051` | 选项长度 | `01` | 长度为 1单位8 字节)。 |
| `0x0052` | MAC 地址 | `00:16:3e:00:06:02` | 目标设备的链路层地址MAC 地址)。 |
------
### **3. 总结这个包的含义**
1. **包类型**
- 这是一个 **ICMPv6 邻居通告NA** 数据包。
2. **发送方信息**
- IPv6 地址:`2001:db8:5::1`。
- MAC 地址:`00:16:3e:00:06:02`。
3. **接收方信息**
- 目标 IPv6 地址:`2001:db8:5::2`。
- 目标链路层地址MAC`00:16:3e:00:04`。
4. **作用**
- 通知目标设备(`2001:db8:5::2`IPv6 地址 `2001:db8:5::1` 解析为 MAC 地址 `00:16:3e:00:06:02`
5. **网络流程**
- 这是对之前邻居请求NS消息的回复目标设备将更新其邻居表以便后续通信。
------
### **补充**
- **邻居通告的用途**
- 用于响应邻居请求。
- 通知链路上的其他设备该地址的链路层信息。
- **校验关键点**
- 确认 IPv6 头部和 ICMPv6 数据是否正确匹配。
- 确保链路层地址和目标地址一致。
如果你需要进一步分析或有其他问题,请随时补充!