id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c163200
log.Debug("Kernel does not support CIDR maps, using hash table instead.") typeMap = bpf.BPF_MAP_TYPE_HASH fd, isNewMap, err = bpf.OpenOrCreateMap( path, typeMap, uint32(unsafe.Sizeof(uint32(0))+uintptr(bytes)), uint32(LPM_MAP_VALUE_SIZE), maxelem, bpf.BPF_F_NO_PREALLOC, 0, ) if err != nil { ...
c163201
connection pairs for which cascading close was // requested in Accept. for _, pair := range pairs { pair.Rx.Close() } }
c163202
message", c.direction())) select { case <-c.close: flowdebug.Log(scopedLog, fmt.Sprintf("%s connection is closed; dropping message", c.direction())) case c.queue <- msg: flowdebug.Log(scopedLog, fmt.Sprintf("Enqueued %s message", c.direction())) } }
c163203
c.conn.Write call in writeQueuedMessages. if !c.Closed() { scopedLog.Debug("Closing socket") c.conn.Close() } // Call connectionPair.close() concurrently so that this call doesn't block // while waiting for the other connection in the pair to close. go c.afterClose() }
c163204
{ o.SetTimeout(timeout) return o }
c163205
*GetIdentityIDParams { o.SetContext(ctx) return o }
c163206
{ o.SetHTTPClient(client) return o }
c163207
string) *GetIdentityIDParams { o.SetID(id) return o }
c163208
client: c.RESTClient(), ns: namespace, } }
c163209
time.Duration) *GetEndpointIDLogParams { o.SetTimeout(timeout) return o }
c163210
context.Context) *GetEndpointIDLogParams { o.SetContext(ctx) return o }
c163211
*http.Client) *GetEndpointIDLogParams { o.SetHTTPClient(client) return o }
c163212
string) *GetEndpointIDLogParams { o.SetID(id) return o }
c163213
fmt.Sprintf("XLATE_%s [%s]:%d Created=%s HostLocal=%d\n", which, n.Addr, n.Port, NatDumpCreated(start, n.Created), n.HostLocal) }
c163214
byteorder.NetworkToHost(n.Port).(uint16) return &x }
c163215
n.NodeElement.PrimaryAddress.IPV4.IP } return n.NodeElement.PrimaryAddress.IPV6.IP }
c163216
return n.NodeElement.HealthEndpointAddress.IPV4.IP } return n.NodeElement.HealthEndpointAddress.IPV6.IP }
c163217
= false addresses[n.NodeElement.HealthEndpointAddress.IPV6] = false } for _, elem := range n.NodeElement.SecondaryAddresses { addresses[elem] = false } return addresses }
c163218
convertOptions(ep.Options.Opts) }
c163219
scopedLog.Warning("C header file not found. Ignoring endpoint") continue } scopedLog.Debug("Found endpoint C header file") strEp, err := common.GetCiliumVersionString(cHeaderFile) if err != nil { scopedLog.WithError(err).Warn("Unable to read the C header file") continue } ep, err := ParseEndpo...
c163220
return err } m.modulesList = modulesList return nil }
c163221
return set.SliceSubsetOf(expectedNames, m.modulesList) }
c163222
range diff { if _, err := exec.WithTimeout( defaults.ExecTimeout, moduleLoader(), unloadedModule).CombinedOutput( nil, false); err != nil { return fmt.Errorf("could not load module %s: %s", unloadedModule, err) } } return nil }
c163223
struct{}, f func()) { wg.Add(1) go func() { defer wg.Done() <-ch f() }() }
c163224
d.TriggerPolicyUpdates(true, "one or more identities created or deleted") }
c163225
eventqueue.NewEvent(p) resChan := d.policy.RepositoryChangeQueue.Enqueue(polAddEvent) res, ok := <-resChan if ok { pRes := res.(*PolicyAddResult) return pRes.newRev, pRes.err } return 0, fmt.Errorf("policy addition event was cancelled") }
c163226
resChan := d.policy.RepositoryChangeQueue.Enqueue(policyDeleteEvent) res, ok := <-resChan if ok { ress := res.(*PolicyDeleteResult) return ress.newRev, ress.err } return 0, fmt.Errorf("policy deletion event cancelled") }
c163227
} parser = gopacket.NewDecodingLayerParser( layers.LayerTypeEthernet, &cache.eth, &cache.ip4, &cache.ip6, &cache.icmp4, &cache.icmp6, &cache.tcp, &cache.udp) } }
c163228
fmt.Println(gopacket.LayerString(&cache.icmp4)) case layers.LayerTypeICMPv6: fmt.Println(gopacket.LayerString(&cache.icmp6)) default: fmt.Println("Unknown layer") } } if parser.Truncated { fmt.Println(" Packet has been truncated") } } else { fmt.Print(hex.Dump(data)) } }
c163229
case layers.LayerTypeTCP: ret.TCP = gopacket.LayerString(&cache.tcp) src, dst := cache.tcp.TransportFlow().Endpoints() ret.L4 = &Flow{Src: src.String(), Dst: dst.String()} case layers.LayerTypeUDP: ret.UDP = gopacket.LayerString(&cache.udp) src, dst := cache.udp.TransportFlow().Endpoints() ret.L4 ...
c163230
lblStr := maskedIPToLabelString(&cidr.IP, ones) return labels.ParseLabel(lblStr) }
c163231
if parsedIP.To4() != nil { bits = net.IPv4len * 8 } parsedPrefix = &net.IPNet{IP: parsedIP, Mask: net.CIDRMask(bits, bits)} } return ipNetToLabel(parsedPrefix), nil }
c163232
in pod") if !SidecarIstioProxyImageRegexp.MatchString(container.Image) { continue } scopedLog.Debugf("istio-proxy container runs Cilium-compatible image: %s", container.Image) for _, mount := range container.VolumeMounts { if mount.MountPath != "/var/run/cilium" { continue } scopedLog.Debug("...
c163233
k8sLabels = map[string]string{} } for k, v := range k8sNs.GetLabels() { k8sLabels[policy.JoinPath(k8sConst.PodNamespaceMetaLabels, k)] = v } k8sLabels[k8sConst.PodNamespaceLabel] = namespace if result.Spec.ServiceAccountName != "" { k8sLabels[k8sConst.PolicyLabelServiceAccount] = result.Spec.ServiceAccountN...
c163234
!= nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163235
staticData { dp.WriteEndpointConfig(result, epCfg) } else { dp.WriteTemplateConfig(result, epCfg) } return result.String(), nil }
c163236
o == name { return true } } return false }
c163237
{ _, newVal, err := ParseKeyValue(l, k, v) if err != nil { return nil, err } if err := l.Validate(k, v); err != nil { return nil, err } o[k] = newVal } return o, nil }
c163238
make(models.ConfigurationMap) return &immutableCfg }
c163239
if v == OptionDisabled { mutableCfg[k] = fmt.Sprintf("Disabled") } else { mutableCfg[k] = fmt.Sprintf("Enabled") } } else { mutableCfg[k] = config.Format(v) } } } o.optsMU.RUnlock() return &mutableCfg }
c163240
o.Opts[key] = value o.optsMU.Unlock() }
c163241
} o.optsMU.Lock() o.Opts[key] = intValue o.optsMU.Unlock() }
c163242
if err != nil { return err } // Ignore validation if value is identical if oldVal, ok := o.Opts[k]; ok && oldVal == newVal { continue } if err := o.Library.Validate(k, v); err != nil { return err } } return nil }
c163243
dependency := range opt.Requires { o.enable(dependency) } } } o.Opts[name] = OptionEnabled }
c163244
OptionSetting) { o.enable(name) o.Opts[name] = value }
c163245
range *o.Library { if opt.RequiresOption(name) && o.Opts[key] != OptionDisabled { o.disable(key) } } } }
c163246
if not enabled already */ if !ok || val == OptionDisabled { o.set(k, optVal) changes = append(changes, changedOptions{key: k, value: optVal}) } } } o.optsMU.Unlock() for _, change := range changes { changed(change.key, change.value, data) } return len(changes) }
c163247
l { newLabels[prefix+k] = Label{ Key: prefix + v.Key, Value: v.Value, Source: v.Source, } } return newLabels }
c163248
== lbl2.Key && lbl1.Value == lbl2.Value { continue } } return false } return true }
c163249
if v.Source == source { lbls[k] = v } } return lbls }
c163250
l.IsAllLabel() || l.Equals(target) }
c163251
if lbl := ParseLabel(v); lbl.Key != "" { lbls[lbl.Key] = lbl } } return lbls }
c163252
lbls = append(lbls, ParseSelectLabel(base[i])) } return lbls.Sort() }
c163253
{ res = append(res, v.String()) } return res }
c163254
fmt.Sprintf("%x", sha512.Sum512_256(l.SortedList())) }
c163255
in the kvstore depends on this (see // kvstore.prefixMatchesKey()) return fmt.Sprintf(`%s:%s=%s;`, l.Source, l.Key, l.Value) }
c163256
} sort.Strings(keys) result := "" for _, k := range keys { result += l[k].FormatForKVStore() } return []byte(result) }
c163257
{ labels = append(labels, v) } return labels.Sort() }
c163258
l { if lbl.Source == LabelSourceReserved { return true } } return false }
c163259
stopCh: make(chan struct{}), } go fq.run() return fq }
c163260
err != nil { if !f.waitFunc(retries) { break } } else { break } } } } }
c163261
ctx.Err(); err != nil { return fmt.Errorf("serializer %s", err) } return nil }
c163262
<- queuedFunction{f: f, waitFunc: waitFunc} }
c163263
Subsystem: "triggers", Name: p.Name + "_folds", Help: "Current level of trigger folds", }) if err := metrics.Register(t.triggerFolds); err != nil { metrics.Unregister(t.triggerReasons) return nil, fmt.Errorf("unable to register prometheus collector: %s", err) } t.callDurations = prometh...
c163264
sleepTime := time.Since(t.lastTrigger.Add(t.params.MinInterval)) return sleepTime < 0, sleepTime * -1 }
c163265
metrics.Unregister(t.triggerFolds) metrics.Unregister(t.callDurations) } }
c163266
v2.New(g.factory, g.namespace, g.tweakListOptions) }
c163267
&PutServiceID{Context: ctx, Handler: handler} }
c163268
watchers[typeURL] = w if resType.AckObserver != nil { ackObservers[typeURL] = resType.AckObserver } } // TODO: Unregister the watchers when stopping the server. return &Server{watchers: watchers, ackObservers: ackObservers} }
c163269
} if req.GetTypeUrl() == "" { req.TypeUrl = defaultTypeURL } streamLog.WithFields(getXDSRequestFields(req)).Debug("received request from xDS stream") select { case <-stopRecv: streamLog.Debug("stopping xDS stream handling") return case reqCh <- req: } } }() return s.processReque...
c163270
be Enqueued until Enqueueing blocks. events: make(chan *Event, numBufferedEvents), close: make(chan struct{}), drain: make(chan struct{}), } }
c163271
make(chan struct{}), stats: eventStatistics{}, } }
c163272
the events channel, as events are consumed off of the events // channel asynchronously! If the EventQueue is closed before this // event is processed, then it will be cancelled. ev.stats.waitEnqueue.Start() q.events <- ev ev.stats.waitEnqueue.End(true) ev.stats.waitConsumeOffQueue.Start() return ev.even...
c163273
in most scenarios, this should exit // fairly quickly. q.closeWaitGroup.Wait() // Signal that the queue has been drained. close(q.close) // This will cause Run() to receive a nil event. close(q.events) }) }
c163274
idCache: cache.GetIdentityCache(), selectors: make(map[string]identitySelector), } }
c163275
matter. This makes testing easier, but may help // identifying changes easier also otherwise. sort.Slice(selections, func(i, j int) bool { return selections[i] < selections[j] }) l.setSelections(&selections) }
c163276
struct{}{} // Find all matching identities from the identity cache. for numericID, lbls := range sc.idCache { if selector.Matches(lbls) { newIDSel.cachedSelections[numericID] = struct{}{} } } // Create the immutable slice representation of the selected // numeric identities newIDSel.updateSelections() ...
c163277
sc.selectors[key] if exists { if idSel.removeUser(user) { delete(sc.selectors, key) } } }
c163278
_, exists := idSel.cachedSelections[numericID]; exists { dels = append(dels, numericID) delete(idSel.cachedSelections, numericID) } } for numericID, lbls := range added { if _, exists := idSel.cachedSelections[numericID]; !exists { if idSel.selector.Matches(lbls) { adds = append(adds...
c163279
{ return selectorCache.AddIdentitySelector(user, selector) }
c163280
&DeleteIPAMIP{Context: ctx, Handler: handler} }
c163281
n.Addr, n.Port, n.Created, n.HostLocal) }
c163282
&PutPolicy{Context: ctx, Handler: handler} }
c163283
!= nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163284
len(ls)) for _, v := range ls { o = append(o, v.DeepCopy()) } return o }
c163285
"body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163286
handled := ws.events[id] return handled }
c163287
if len(q) == 0 { close(q) delete(ws.events, id) } } }
c163288
}).Debug("Found unwatched container") wg.Add(1) go func(wg *sync.WaitGroup, id string) { defer wg.Done() Client().handleCreateWorkload(id, false) }(&wg, contID) } } // Wait for all spawned go routines handling container creations to exit wg.Wait() }
c163289
} if c.EnableIPv6 { ipam.IPv6Allocator = ipallocator.NewCIDRRange(nodeAddressing.IPv6().AllocationCIDR().IPNet) } if c.EnableIPv4 { ipam.IPv4Allocator = ipallocator.NewCIDRRange(nodeAddressing.IPv4().AllocationCIDR().IPNet) } return ipam }
c163290
return nil, Hint(err) } return resp.Payload, nil }
c163291
checking the error type, we don't wrap this * with Hint(...) */ return nil, err } return resp.Payload, nil }
c163292
params := endpoint.NewPutEndpointIDParams().WithID(id).WithEndpoint(ep).WithTimeout(api.ClientTimeout) _, err := c.Endpoint.PutEndpointID(params) return Hint(err) }
c163293
ClientTimeout) _, err := c.Endpoint.PatchEndpointID(params) return Hint(err) }
c163294
_, _, err := c.Endpoint.DeleteEndpointID(params) return Hint(err) }
c163295
c.Endpoint.GetEndpointIDLog(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }
c163296
c.Endpoint.GetEndpointIDHealthz(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }
c163297
c.Endpoint.GetEndpointIDConfig(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }
c163298
if cfg != nil { params.SetEndpointConfiguration(cfg) } _, err := c.Endpoint.PatchEndpointIDConfig(params) return Hint(err) }
c163299
c.Endpoint.GetEndpointIDLabels(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }