RemoveInterfaceAddr implements inet.Stack.RemoveInterfaceAddr.
(idx int32, addr inet.InterfaceAddr)
| 683 | |
| 684 | // RemoveInterfaceAddr implements inet.Stack.RemoveInterfaceAddr. |
| 685 | func (s *Stack) RemoveInterfaceAddr(idx int32, addr inet.InterfaceAddr) error { |
| 686 | protocolAddress, err := convertAddr(addr) |
| 687 | if err != nil { |
| 688 | return err |
| 689 | } |
| 690 | |
| 691 | // Remove addresses matching the address and prefix. |
| 692 | nicID := tcpip.NICID(idx) |
| 693 | if err := s.Stack.RemoveAddress(nicID, protocolAddress.AddressWithPrefix.Address); err != nil { |
| 694 | return syserr.TranslateNetstackError(err).ToError() |
| 695 | } |
| 696 | |
| 697 | // Remove the corresponding local network route if it exists. |
| 698 | localRoute := tcpip.Route{ |
| 699 | Destination: protocolAddress.AddressWithPrefix.Subnet(), |
| 700 | Gateway: tcpip.Address{}, // No gateway for local network. |
| 701 | NIC: nicID, |
| 702 | } |
| 703 | s.Stack.RemoveRoutes(func(rt tcpip.Route) bool { |
| 704 | return rt.Equal(localRoute) |
| 705 | }) |
| 706 | |
| 707 | return nil |
| 708 | } |
| 709 | |
| 710 | // TCPReceiveBufferSize implements inet.Stack.TCPReceiveBufferSize. |
| 711 | func (s *Stack) TCPReceiveBufferSize() (inet.TCPBufferSize, error) { |
nothing calls this directly
no test coverage detected