Skip to content

dpvs-agent 接口 /vs/{VipPort}/laddr 越界问题 #1019

@aiwyn

Description

@aiwyn

请求如下:

curl -X 'DELETE' \
  'http://127.0.0.1:9090/v2/vs/1.1.1.1-80-tcp/laddr' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "addr": "2.2.2.2/32",
  "device": "bond0"
}'

SetAddr 方法会报出越界

runtime error: slice bounds out of range [12:0]
goroutine 96 [running]:
net/http.(*conn).serve.func1()
	/mnt/go/go1.20/src/net/http/server.go:1854 +0xbf
panic({0xa8b240, 0xc000344030})
	/mnt/go/go1.20/src/runtime/panic.go:890 +0x263
github.com/dpvs-agent/pkg/ipc/types.(*LocalAddrDetail).SetAddr(0xc0002403c0, {0xc0008ce090, 0xf})
	/data/DUOWAN_BUILD/private-yw_team-dpvs-new/14/dpvs-new/tools/dpvs-agent/pkg/ipc/types/laddr.go:301 +0x17d
github.com/dpvs-agent/cmd/ipvs.(*delVsLaddr).Handle(0xc0004087f8, {0xc00056c300?, {0xc00089624e?, 0xbcdf20?}, 0xc0001a8160?})
	/data/DUOWAN_BUILD/private-yw_team-dpvs-new/14/dpvs-new/tools/dpvs-agent/cmd/ipvs/delete_vs_vip_port_laddr.go:50 +0x24a
github.com/dpvs-agent/restapi/operations/virtualserver.(*DeleteVsVipPortLaddr).ServeHTTP(0xc000408eb8, {0xbd3350, 0xc00057a000}, 0xc00056c300)
	/data/DUOWAN_BUILD/private-yw_team-dpvs-new/14/dpvs-new/tools/dpvs-agent/restapi/operations/virtualserver/delete_vs_vip_port_laddr.go:53 +0x183
github.com/go-openapi/runtime/middleware.NewOperationExecutor.func1({0xbd3350, 0xc00057a000}, 0xc00056c300)
	/mnt/cache/go1.20/pkg/mod/github.com/go-openapi/[email protected]/middleware/operation.go:28 +0x59
net/http.HandlerFunc.ServeHTTP(0xacd901?, {0xbd3350?, 0xc00057a000?}, 0xc000577700?)
	/mnt/go/go1.20/src/net/http/server.go:2122 +0x2f
github.com/go-openapi/runtime/middleware.NewRouter.func1({0xbd3350, 0xc00057a000}, 0xc00056c100)
	/mnt/cache/go1.20/pkg/mod/github.com/go-openapi/[email protected]/middleware/router.go:78 +0x257
net/http.HandlerFunc.ServeHTTP(0xc0005779d8?, {0xbd3350?, 0xc00057a000?}, 0x4705de?)
	/mnt/go/go1.20/src/net/http/server.go:2122 +0x2f
github.com/go-openapi/runtime/middleware.SwaggerUI.func1({0xbd3350, 0xc00057a000}, 0xc00056c100)
	/mnt/cache/go1.20/pkg/mod/github.com/go-openapi/[email protected]/middleware/swaggerui.go:95 +0x271
net/http.HandlerFunc.ServeHTTP(0xf8cb00?, {0xbd3350?, 0xc00057a000?}, 0x4243f7a9de8?)
	/mnt/go/go1.20/src/net/http/server.go:2122 +0x2f
github.com/go-openapi/runtime/middleware.Spec.func1({0xbd3350, 0xc00057a000}, 0xc000577ad0?)
	/mnt/cache/go1.20/pkg/mod/github.com/go-openapi/[email protected]/middleware/spec.go:46 +0x18c
net/http.HandlerFunc.ServeHTTP(0x0?, {0xbd3350?, 0xc00057a000?}, 0x71b9f4?)
	/mnt/go/go1.20/src/net/http/server.go:2122 +0x2f
net/http.serverHandler.ServeHTTP({0xbd18a0?}, {0xbd3350, 0xc00057a000}, 0xc00056c100)
	/mnt/go/go1.20/src/net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc000374000, {0xbd3758, 0xc0003dc5d0})
	/mnt/go/go1.20/src/net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
	/mnt/go/go1.20/src/net/http/server.go:3089 +0x5ed

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions