Skip to content

Commit

Permalink
daemon: validate cni request container id
Browse files Browse the repository at this point in the history
Signed-off-by: l1b0k <[email protected]>
  • Loading branch information
l1b0k committed May 17, 2024
1 parent 0531a1b commit 36899a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,12 @@ func (n *networkService) GetIPInfo(ctx context.Context, r *rpc.GetInfoRequest) (
Msg: "Unexpected network type, maybe daemon mode changed",
}
}

if oldRes.ContainerID != nil {
if r.K8SPodInfraContainerId != *oldRes.ContainerID {
log.Info("cni request not match stored resource, ignored", "old", *oldRes.ContainerID)
return reply, nil

Check warning on line 467 in daemon/daemon.go

View check run for this annotation

Codecov / codecov/patch

daemon/daemon.go#L464-L467

Added lines #L464 - L467 were not covered by tests
}
}
netConf := make([]*rpc.NetConf, 0)

err = json.Unmarshal([]byte(oldRes.NetConf), &netConf)
Expand Down

0 comments on commit 36899a8

Please sign in to comment.