id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c163000
return maps(e, ipv4, ipv6) }
c163001
mapEntriesAny = mapInfo[m.mapType].maxEntries } } fmt.Fprintf(fw, "#define CT_MAP_SIZE_TCP %d\n", mapEntriesTCP) fmt.Fprintf(fw, "#define CT_MAP_SIZE_ANY %d\n", mapEntriesAny) }
c163002
*PatchPrefilterOK { o.Payload = payload return o }
c163003
models.Error) *PatchPrefilterInvalidCIDR { o.Payload = payload return o }
c163004
models.Error) *PatchPrefilterFailure { o.Payload = payload return o }
c163005
&GetEndpointIDLog{Context: ctx, Handler: handler} }
c163006
{ if traceEnabled { log.WithError(err).WithFields(fields).Debugf(format) } }
c163007
if ipv6Address == nil { ipv6Address = makeIPv6HostIP() } } if ipv6AllocRange == nil && ipv4AllocRange != nil { // The IPv6 allocation should be derived from the IPv4 allocation. ip := ipv4AllocRange.IP v6range := fmt.Sprintf("%s%02x%02x:%02x%02x:0:0/%d", option.Config.IPv6ClusterAllocCIDRBase...
c163008
return &net.IPNet{ IP: ipv4AllocRange.IPNet.IP.Mask(mask), Mask: mask, } }
c163009
128) return cidr.NewCIDR(&net.IPNet{ IP: ipv6AllocRange.IPNet.IP.Mask(mask), Mask: mask, }) }
c163010
defaults.IPv6NodePrefixLen) } copy := *net ipv6AllocRange = cidr.NewCIDR(&copy) return nil }
c163011
if option.Config.EnableIPv6 && ipv6AllocRange == nil { return fmt.Errorf("IPv6 allocation CIDR is not configured. Please specificy --ipv6-range") } if option.Config.EnableIPv4 && ipv4AllocRange == nil { return fmt.Errorf("IPv4 allocation CIDR is not configured. Please specificy --ipv4-range") } return nil }
c163012
ipv4InternalAddress, ipv4AllocRange) } ones, _ := ipv4AllocRange.Mask.Size() if ipv4ClusterCidrMaskSize > ones { return fmt.Errorf("IPv4 per node allocation prefix (%s) must be inside cluster prefix (%s)", ipv4AllocRange, GetIPv4ClusterRange()) } } return nil }
c163013
ip.Equal(GetInternalIPv4()) || ip.Equal(GetExternalIPv4()) }
c163014
ip.Equal(GetIPv6Router()) }
c163015
if option.Config.EnableIPv4 { a.IPV4 = &models.NodeAddressingElement{ Enabled: option.Config.EnableIPv4, IP: GetInternalIPv4().String(), AllocRange: GetIPv4AllocRange().String(), } } return a }
c163016
return ipv4GW, ipv6Router } return getCiliumHostIPsFromNetDev(option.Config.HostDevice) }
c163017
return acquireGlobalID(l3n4Addr, baseID) } return serviceIDAlloc.acquireLocalID(l3n4Addr, baseID) }
c163018
getGlobalID(id) } return serviceIDAlloc.getLocalID(id) }
c163019
return deleteGlobalID(id) } return serviceIDAlloc.deleteLocalID(id) }
c163020
err := backendIDAlloc.lookupLocalID(l3n4Addr) return loadbalancer.BackendID(id), err }
c163021
e.timestamp = time.Now() e.lock.Unlock() }
c163022
{ if res.Status.Addressing == nil || (res.Status.Addressing.IPV4 == nil && res.Status.Addressing.IPV6 == nil) { scopedLog.Fatal("Invalid addressing information from daemon") } d.conf = *res.Status break } } if err := connector.SufficientAddressing(d.conf.Addressing); err != nil { scopedLog.With...
c163023
handleMethod("NetworkDriver.DeleteEndpoint", driver.deleteEndpoint) handleMethod("NetworkDriver.EndpointOperInfo", driver.infoEndpoint) handleMethod("NetworkDriver.Join", driver.joinEndpoint) handleMethod("NetworkDriver.Leave", driver.leaveEndpoint) handleMethod("IpamDriver.GetCapabilities", driver.ipamCapabiliti...
c163024
{ return (*policy.SelectorPolicy)(atomic.LoadPointer(&cip.policy)) }
c163025
fields. atomic.StorePointer(&cip.policy, unsafe.Pointer(policy)) }
c163026
datapath deltas instead. // Changing this requires shifting IdentityCache management // responsibilities from the caller into this package. return cip.getPolicy().DistillPolicy(owner, cache) }
c163027
{ o.Payload = payload return o }
c163028
*GetEndpointIDHealthzOK { o.Payload = payload return o }
c163029
launcher.setStdout(stdout) // Wait for the process to exit in the background to release all // resources go func() { err := cmd.Wait() log.WithFields(logrus.Fields{ "exitCode": err, "cmd": cmdStr, }).Debug("Process exited") }() return nil }
c163030
log.WithError(err).WithField("pid", launcher.process.Pid).Error("process.Kill()") } launcher.process = nil }
c163031
launcher.Mutex.Lock() launcher.target = target launcher.Mutex.Unlock() }
c163032
arg := launcher.target launcher.Mutex.RUnlock() return arg }
c163033
launcher.args = args launcher.Mutex.Unlock() }
c163034
launcher.Mutex.RUnlock() return args }
c163035
launcher.process = proc launcher.Mutex.Unlock() }
c163036
proc := launcher.process launcher.Mutex.RUnlock() return proc }
c163037
launcher.stdout = stdout launcher.Mutex.Unlock() }
c163038
stdout := launcher.stdout launcher.Mutex.RUnlock() return stdout }
c163039
{ policyName = np.Name } ns := k8sUtils.ExtractNamespace(&np.ObjectMeta) return k8sCiliumUtils.GetPolicyLabels(ns, policyName, policyUID, resourceTypeNetworkPolicy) }
c163040
} portRule := api.PortRule{ Ports: []api.PortProtocol{ {Port: portStr, Protocol: protocol}, }, } portRules = append(portRules, portRule) } return portRules }
c163041
// try the 1.1 socket conn, err = net.Dial("unix", defaults.MonitorSockPath1_0) if err == nil { return conn, listener.Version1_0, nil } errors = append(errors, defaults.MonitorSockPath1_0+": "+err.Error()) return nil, listener.VersionUnsupported, fmt.Errorf("Cannot find or open a supported node-monitor socke...
c163042
to call lostEvent to match // the earlier behaviour, despite it not being wholly correct. log.WithError(err).WithField("type", pl.Type).Warn("Unknown payload type") format.LostEvent(pl.Lost, pl.CPU) } } }
c163043
err != nil { return nil, err } return &pl, nil }, nil case listener.Version1_2: var ( pl payload.Payload dec = gob.NewDecoder(conn) ) // This implemenents the newer 1.2 API. Each listener maintains its own gob // session, and type information is only ever sent once. return func() (*paylo...
c163044
!= nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163045
v := range i { result[k] = v } return result }
c163046
= true } i[key] = value + 1 return changed }
c163047
key) return true } i[key] = value - 1 return false }
c163048
append(result, key) } sort.Sort(sort.Reverse(sort.IntSlice(result))) return result }
c163049
&PatchPrefilter{Context: ctx, Handler: handler} }
c163050
nil { res = append(res, err) } if err := m.validateRealized(formats); err != nil { res = append(res, err) } if err := m.validateSecurityRelevant(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163051
Flags: flags, InnerID: innerID, OwnerProgType: ProgTypeUnspec, }, name: path.Base(name), dumpParser: dumpParser, } return m }
c163052
time.Sleep(errorResolverSchedulerDelay) mapControllers.UpdateController(m.controllerName(), controller.ControllerParams{ DoFunc: m.resolveErrors, RunInterval: errorResolverSchedulerMinInterval, }, ) }() }
c163053
return "", err } return m.path, nil }
c163054
m.path == other.path && m.NonPersistent == other.NonPersistent }
c163055
false m.scopedLogger().Debug("End of parallel mode") } }
c163056
m.fd, unsafe.Pointer(&nextKey[0]), unsafe.Pointer(&value[0]), ) if err != nil { return err } k, v, err := m.dumpParser(nextKey, value) if err != nil { return err } if cb != nil { cb(k, v) } copy(key, nextKey) } return nil }
c163057
m.exist() if err != nil { return err } if found { return m.DumpWithCallback(cb) } return nil }
c163058
} else { entry, ok := m.cache[k] if !ok { m.cache[k] = &cacheEntry{ Key: key, } entry = m.cache[k] } entry.DesiredAction = Delete entry.LastError = err m.scheduleErrorResolver() } }
c163059
log.WithFields(logrus.Fields{logfields.Path: m.path, "name": m.name}) }
c163060
= DeleteElement(m.fd, unsafe.Pointer(&nextKey[0])) k, _, err2 := m.dumpParser(nextKey, []byte{}) if err2 == nil { m.deleteCacheEntry(k, err) } else { log.WithError(err2).Warningf("Unable to correlate iteration key %v with cache entry. Inconsistent cache.", nextKey) } if err != nil { return err }...
c163061
metricMapOps.WithLabelValues(m.commonName(), metricOpGetNextKey, metrics.Error2Outcome(err)).Inc() return err }
c163062
key); err != nil { return fmt.Errorf("Unable to convert key: %s", err) } } if len(bValue) > 0 { if err := binary.Read(valueBuf, byteorder.Native, value); err != nil { return fmt.Errorf("Unable to convert value: %s", err) } } return nil }
c163063
if entry.LastError != nil { model.LastError = entry.LastError.Error() } if entry.Value != nil { model.Value = entry.Value.String() } mapModel.Cache[i] = model i++ } } return mapModel }
c163064
case err == io.EOF || err == io.ErrUnexpectedEOF: log.Fatal("Agent pipe unexpectedly closed, shutting down") case err != nil: log.WithError(err).Fatal("Unable to read cilium agent events from pipe") } m.send(&p) } }
c163065
go m.connectionHandler1_0(ctx, server1_0) go m.connectionHandler1_2(ctx, server1_2) // start agent event pipe reader go m.agentPipeReader(ctx, agentPipe) return m, nil }
c163066
lock and check the number of listeners. // This guards against an older generation listener calling the // current generation perfReaderCancel if len(m.listeners) == 0 { m.perfReaderCancel() } }
c163067
by .DumpStats() // also grab the callbacks we need to avoid locking again. These methods never change. m.Lock() m.monitorEvents = monitorEvents receiveEvent := m.receiveEvent lostEvent := m.lostEvent errorEvent := m.errorEvent m.Unlock() last := time.Now() for !isCtxDone(stopCtx) { todo, err := monitorEven...
c163068
err := json.Marshal(ms) if err != nil { log.WithError(err).Error("Error marshalling JSON") return } fmt.Println(string(mp)) }
c163069
!= nil: conn.Close() fallthrough case isCtxDone(parentCtx) && conn == nil: return case err != nil: log.WithError(err).Warn("Error accepting connection") continue } m.registerNewListener(parentCtx, conn, listener.Version1_0) } }
c163070
defer m.Unlock() for ml := range m.listeners { ml.Enqueue(pl) } }
c163071
Configuration{ standardMTU: mtu, tunnelMTU: mtu - (TunnelOverhead + encryptOverhead), encryptMTU: mtu - encryptOverhead, encapEnabled: encapEnabled, encryptEnabled: encryptEnabled, } if conf.tunnelMTU < 0 { conf.tunnelMTU = 0 } return conf }
c163072
into the manager. ep.UnconditionalRLock() mutex.Lock() // Now that the endpoint has its ID, it can be created with a name based on // its ID, and its eventqueue can be safely started. Ensure that it is only // started once it is exposed to the endpointmanager so that it will be // stopped when the endpoint is r...
c163073
return lookupDockerEndpoint(eid), nil case endpointid.ContainerNamePrefix: return lookupDockerContainerName(eid), nil case endpointid.PodNamePrefix: return lookupPodNameLocked(eid), nil case endpointid.IPv4Prefix: return lookupIPv4(eid), nil case endpointid.IPv6Prefix: return lookupIPv6(eid), nil d...
c163074
ep := lookupCiliumID(id) mutex.RUnlock() return ep }
c163075
ep := lookupContainerID(id) mutex.RUnlock() return ep }
c163076
ep := lookupIPv4(ipv4) mutex.RUnlock() return ep }
c163077
ep := lookupIPv6(ipv6) mutex.RUnlock() return ep }
c163078
= lookupIPv4(addr) } else { ep = lookupIPv6(addr) } mutex.RUnlock() return ep }
c163079
:= lookupPodNameLocked(name) mutex.RUnlock() return ep }
c163080
{ delete(endpointsAux, endpointid.NewID(endpointid.DockerEndpointPrefix, ep.DockerEndpointID)) } if ep.IPv4.IsSet() { delete(endpointsAux, endpointid.NewID(endpointid.IPv4Prefix, ep.IPv4.String())) } if ep.IPv6.IsSet() { delete(endpointsAux, endpointid.NewID(endpointid.IPv6Prefix, ep.IPv6.String())) } i...
c163081
endpoints = map[uint16]*endpoint.Endpoint{} endpointsAux = map[string]*endpoint.Endpoint{} }
c163082
ok := endpoints[id]; ok { return ep } return nil }
c163083
endpointsAux[endpointid.NewID(endpointid.IPv4Prefix, ep.IPv4.String())] = ep } if ep.IPv6.IsSet() { endpointsAux[endpointid.NewID(endpointid.IPv6Prefix, ep.IPv6.String())] = ep } if ep.ContainerName != "" { endpointsAux[endpointid.NewID(endpointid.ContainerNamePrefix, ep.ContainerName)] = ep } if podName...
c163084
endpoints due to %s", regenMetadata.Reason) for _, ep := range eps { go regenerateEndpointBlocking(owner, ep, regenMetadata, &wg) } return &wg }
c163085
*sync.WaitGroup) { wg.Add(len(endpointIDs)) for endpointID := range endpointIDs { ep := endpoints[endpointID] go func() { regenerateEndpointNonBlocking(owner, ep, regenMetadata) wg.Done() }() } }
c163086
if !e.Options.IsEnabled(option.ConntrackLocal) { return true } } return false }
c163087
0, len(endpoints)) for _, ep := range endpoints { eps = append(eps, ep) } mutex.RUnlock() return eps }
c163088
ep.SetDesiredIngressPolicyEnabled(alwaysEnforce) ep.SetDesiredEgressPolicyEnabled(alwaysEnforce) if ep.ID != 0 { return fmt.Errorf("Endpoint ID is already set to %d", ep.ID) } return Insert(ep) }
c163089
select { case <-ctx.Done(): return ctx.Err() case <-eps[i].WaitForPolicyRevision(ctx, rev, nil): if ctx.Err() != nil { return ctx.Err() } } } return nil }
c163090
:= range eps { eps[i].WaitForPolicyRevision(ctx, rev, done) } return nil }
c163091
models.Error) *DeleteServiceIDFailure { o.Payload = payload return o }
c163092
api s.interrupt = make(chan os.Signal, 1) return s }
c163093
s.handler = configureAPI(s.api) } }
c163094
args...) } else { log.Printf(f, args...) } }
c163095
&& s.api.Logger != nil { s.api.Logger(f, args...) os.Exit(1) } else { log.Fatalf(f, args...) } }
c163096
if err != nil { return err } h, p, err := swag.SplitHostPort(listener.Addr().String()) if err != nil { return err } s.Host = h s.Port = p s.httpServerL = listener } if s.hasScheme(schemeHTTPS) { tlsListener, err := net.Listen("tcp", net.JoinHostPort(s.TLSHost, strconv.Itoa(s.TLSPort))) if ...
c163097
nil { return nil, err } } return s.domainSocketL, nil }
c163098
nil { return nil, err } } return s.httpServerL, nil }
c163099
nil { return nil, err } } return s.httpsServerL, nil }