Skip to content

net_if_ipv4_addr_add's addr pointer param should be const qualified #93168

@alister-advatek

Description

@alister-advatek

Summary

net_if_ipv4_addr_add doesn't change its addr param.
net_if_ipv4_set_netmask_by_addr and net_if_ipv4_set_gw have const qualified their addr params.
Const qualifying improves the code because it conveys to readers that the param is a function input.
Const qualifying allows app developers to implement similar quality in their code, e.g. they may pass a const qualified struct pointer of their network config to their function that configures those.

Describe the solution you'd like

Const qualify the addr param, e.g.:

struct net_if_addr *net_if_ipv4_addr_add(struct net_if *iface,
					 const struct in_addr *addr,
					 enum net_addr_type addr_type,
					 uint32_t vlifetime)

Alternatives

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions