mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Set NA router flag if forwarding is enabled.
PiperOrigin-RevId: 546155328
This commit is contained in:
committed by
gVisor bot
parent
e91eeea83f
commit
a76207d81b
@@ -540,6 +540,7 @@ func (e *endpoint) handleICMP(pkt stack.PacketBufferPtr, hasFragmentHeader bool,
|
||||
//
|
||||
na.SetSolicitedFlag(!unspecifiedSource)
|
||||
na.SetOverrideFlag(true)
|
||||
na.SetRouterFlag(e.Forwarding())
|
||||
na.SetTargetAddress(targetAddr)
|
||||
na.Options().Serialize(optsSerializer)
|
||||
packet.SetChecksum(header.ICMPv6Checksum(header.ICMPv6ChecksumParams{
|
||||
|
||||
@@ -259,6 +259,7 @@ func TestNeighborSolicitationResponse(t *testing.T) {
|
||||
naSrc tcpip.Address
|
||||
naDst tcpip.Address
|
||||
performsLinkResolution bool
|
||||
forwardingEnabled bool
|
||||
}{
|
||||
{
|
||||
name: "Unspecified source to solicited-node multicast destination",
|
||||
@@ -391,6 +392,20 @@ func TestNeighborSolicitationResponse(t *testing.T) {
|
||||
nsDst: nicAddr,
|
||||
nsInvalid: true,
|
||||
},
|
||||
{
|
||||
name: "Specified source with 1 source ll to multicast destination with forwarding enabled",
|
||||
nsOpts: header.NDPOptionsSerializer{
|
||||
header.NDPSourceLinkLayerAddressOption(remoteLinkAddr0[:]),
|
||||
},
|
||||
nsSrc: remoteAddr,
|
||||
nsDst: nicAddrSNMC,
|
||||
nsInvalid: false,
|
||||
naDstLinkAddr: remoteLinkAddr0,
|
||||
naSolicited: true,
|
||||
naSrc: nicAddr,
|
||||
naDst: remoteAddr,
|
||||
forwardingEnabled: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
@@ -399,6 +414,10 @@ func TestNeighborSolicitationResponse(t *testing.T) {
|
||||
defer c.cleanup()
|
||||
s := c.s
|
||||
|
||||
if err := s.SetForwardingDefaultAndAllNICs(header.IPv6ProtocolNumber, test.forwardingEnabled); err != nil {
|
||||
t.Fatalf("SetForwardingDefaultAndAllNICs(%t): %s", test.forwardingEnabled, err)
|
||||
}
|
||||
|
||||
e := channel.New(1, 1280, nicLinkAddr)
|
||||
defer e.Close()
|
||||
e.LinkEPCapabilities |= stack.CapabilityResolutionRequired
|
||||
@@ -513,6 +532,7 @@ func TestNeighborSolicitationResponse(t *testing.T) {
|
||||
na := header.NDPNeighborAdvert(pkt.MessageBody())
|
||||
na.SetSolicitedFlag(true)
|
||||
na.SetOverrideFlag(true)
|
||||
na.SetRouterFlag(test.forwardingEnabled)
|
||||
na.SetTargetAddress(test.nsSrc)
|
||||
na.Options().Serialize(ser)
|
||||
pkt.SetChecksum(header.ICMPv6Checksum(header.ICMPv6ChecksumParams{
|
||||
|
||||
Reference in New Issue
Block a user