MCPcopy Index your code
hub / github.com/google/gvisor / CreateStack

Method CreateStack

runsc/boot/loader.go:1792–1816  ·  view source on GitHub ↗

CreateStack implements kernel.NetworkStackCreator.CreateStack.

()

Source from the content-addressed store, hash-verified

1790
1791// CreateStack implements kernel.NetworkStackCreator.CreateStack.
1792func (c *sandboxNetstackCreator) CreateStack() (inet.Stack, error) {
1793 s, err := c.newEmptySandboxNetworkStack()
1794 if err != nil {
1795 return nil, err
1796 }
1797
1798 // Setup loopback.
1799 n := &Network{Stack: s.Stack}
1800 nicID := s.Stack.NextNICID()
1801 if nicID != linux.LOOPBACK_IFINDEX {
1802 return nil, fmt.Errorf("loopback device should always have index %d, got %d", linux.LOOPBACK_IFINDEX, nicID)
1803 }
1804 link := DefaultLoopbackLink
1805 linkEP := ethernet.New(loopback.New())
1806 opts := stack.NICOptions{
1807 Name: link.Name,
1808 DeliverLinkPackets: true,
1809 }
1810
1811 if err := n.createNICWithAddrs(nicID, linkEP, opts, link.Addresses); err != nil {
1812 return nil, err
1813 }
1814
1815 return s, nil
1816}
1817
1818// signal sends a signal to one or more processes in a container. If PID is 0,
1819// then the container init process is used. Depending on the SignalDeliveryMode

Callers

nothing calls this directly

Calls 6

createNICWithAddrsMethod · 0.95
NewFunction · 0.92
NewFunction · 0.92
NextNICIDMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected