*: use one line init instead of memset and format it

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
This commit is contained in:
Hiroki Shirokura 2021-03-22 00:31:56 +00:00 committed by Mark Stapp
parent 326591dcdb
commit 1bda3e627d
6 changed files with 13 additions and 19 deletions

View File

@ -366,7 +366,7 @@ void vpn_leak_zebra_vrf_sid_update(struct bgp *bgp, afi_t afi)
{
int debug = BGP_DEBUG(vpn, VPN_LEAK_LABEL);
enum seg6local_action_t act;
struct seg6local_context ctx = { {0} };
struct seg6local_context ctx = {};
struct in6_addr *tovpn_sid = NULL;
struct in6_addr *tovpn_sid_ls = NULL;
struct vrf *vrf;

View File

@ -3003,11 +3003,10 @@ static void bgp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
struct bgp *bgp = bgp_get_default();
struct listnode *node;
struct prefix_ipv6 *c;
struct srv6_locator_chunk s6c;
struct srv6_locator_chunk s6c = {};
struct prefix_ipv6 *chunk = NULL;
s = zclient->ibuf;
memset(&s6c, 0, sizeof(s6c));
zapi_srv6_locator_chunk_decode(s, &s6c);
if (zclient->redist_default != s6c.proto) {

View File

@ -441,16 +441,14 @@ enum zclient_send_status zclient_send_localsid(struct zclient *zclient,
enum seg6local_action_t action,
const struct seg6local_context *context)
{
struct prefix_ipv6 p;
struct zapi_route api;
struct nexthop nh;
struct prefix_ipv6 p = {};
struct zapi_route api = {};
struct nexthop nh = {};
memset(&p, 0, sizeof(p));
p.family = AF_INET6;
p.prefixlen = 128;
p.prefix = *sid;
memset(&api, 0, sizeof(api));
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_BGP;
api.instance = 0;
@ -464,7 +462,6 @@ enum zclient_send_status zclient_send_localsid(struct zclient *zclient,
SET_FLAG(api.flags, ZEBRA_FLAG_SEG6LOCAL_ROUTE);
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
memset(&nh, 0, sizeof(nh));
nh.type = NEXTHOP_TYPE_IFINDEX;
nh.ifindex = oif;
nexthop_add_seg6local(&nh, action, context);

View File

@ -316,10 +316,9 @@ DEFPY (install_routes,
sg.r.backup_nhop_group.nexthop = bnhgc->nhg.nexthop;
}
} else if (seg6l_oif) {
struct seg6local_context ctx;
struct seg6local_context ctx = {};
enum seg6local_action_t action;
memset(&ctx, 0, sizeof(struct seg6local_context));
if (seg6l_enddx4) {
action = ZEBRA_SEG6_LOCAL_ACTION_END_DX4;
ctx.nh4 = seg6l_enddx4_nh4;

View File

@ -419,7 +419,7 @@ static enum seg6local_action_t
parse_encap_seg6local(struct rtattr *tb,
struct seg6local_context *ctx)
{
struct rtattr *tb_encap[256] = {0};
struct rtattr *tb_encap[256] = {};
enum seg6local_action_t act = ZEBRA_SEG6_LOCAL_ACTION_UNSPEC;
netlink_parse_rtattr_nested(tb_encap, 256, tb);
@ -443,7 +443,7 @@ parse_encap_seg6local(struct rtattr *tb,
static int parse_encap_seg6(struct rtattr *tb, struct in6_addr *segs)
{
struct rtattr *tb_encap[256] = {0};
struct rtattr *tb_encap[256] = {};
struct seg6_iptunnel_encap *ipt = NULL;
struct in6_addr *segments = NULL;
@ -474,8 +474,8 @@ parse_nexthop_unicast(ns_id_t ns_id, struct rtmsg *rtm, struct rtattr **tb,
mpls_label_t labels[MPLS_MAX_LABELS] = {0};
int num_labels = 0;
enum seg6local_action_t seg6l_act = SEG6_LOCAL_ACTION_UNSPEC;
struct seg6local_context seg6l_ctx = { {0} };
struct in6_addr seg6_segs = { .s6_addr = {0} };
struct seg6local_context seg6l_ctx = {};
struct in6_addr seg6_segs = {};
int num_segs = 0;
vrf_id_t nh_vrf_id = vrf_id;
@ -556,8 +556,8 @@ static uint8_t parse_multipath_nexthops_unicast(ns_id_t ns_id,
mpls_label_t labels[MPLS_MAX_LABELS] = {0};
int num_labels = 0;
enum seg6local_action_t seg6l_act = SEG6_LOCAL_ACTION_UNSPEC;
struct seg6local_context seg6l_ctx = { {0} };
struct in6_addr seg6_segs = { .s6_addr = {0} };
struct seg6local_context seg6l_ctx = {};
struct in6_addr seg6_segs = {};
int num_segs = 0;
struct rtattr *rtnh_tb[RTA_MAX + 1] = {};

View File

@ -2701,10 +2701,9 @@ int zsend_srv6_manager_get_locator_chunk_response(struct zserv *client,
vrf_id_t vrf_id,
struct srv6_locator *loc)
{
struct srv6_locator_chunk chunk;
struct srv6_locator_chunk chunk = {};
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
memset(&chunk, 0, sizeof(chunk));
strlcpy(chunk.locator_name, loc->name, sizeof(chunk.locator_name));
chunk.prefix = loc->prefix;
chunk.block_bits_length = loc->block_bits_length;