#include "zebra/zebra_errors.h"
#include "zebra/zebra_vxlan.h"
#include "zebra/zebra_evpn_mh.h"
+#include "zebra/zebra_l2.h"
extern struct zebra_privs_t zserv_privs;
uint32_t link_idx;
unsigned int mtu;
struct rtattr *rta_info, *rta_data;
+ const struct zebra_l2info_gre *gre_info;
if (buflen < sizeof(*req))
return 0;
req->n.nlmsg_flags = NLM_F_REQUEST;
req->ifi.ifi_index = dplane_ctx_get_ifindex(ctx);
+
+ gre_info = dplane_ctx_gre_get_info(ctx);
+ if (!gre_info)
+ return 0;
+
req->ifi.ifi_change = 0xFFFFFFFF;
link_idx = dplane_ctx_gre_get_link_ifindex(ctx);
mtu = dplane_ctx_gre_get_mtu(ctx);
rta_info = nl_attr_nest(&req->n, buflen, IFLA_LINKINFO);
if (!rta_info)
return 0;
+
if (!nl_attr_put(&req->n, buflen, IFLA_INFO_KIND, "gre", 3))
return 0;
+
rta_data = nl_attr_nest(&req->n, buflen, IFLA_INFO_DATA);
- if (!rta_info)
+ if (!rta_data)
return 0;
+
if (!nl_attr_put32(&req->n, buflen, IFLA_GRE_LINK, link_idx))
return 0;
+
+ if (gre_info->vtep_ip.s_addr &&
+ !nl_attr_put32(&req->n, buflen, IFLA_GRE_LOCAL,
+ gre_info->vtep_ip.s_addr))
+ return 0;
+
+ if (gre_info->vtep_ip_remote.s_addr &&
+ !nl_attr_put32(&req->n, buflen, IFLA_GRE_REMOTE,
+ gre_info->vtep_ip_remote.s_addr))
+ return 0;
+
+ if (gre_info->ikey &&
+ !nl_attr_put32(&req->n, buflen, IFLA_GRE_IKEY,
+ gre_info->ikey))
+ return 0;
+ if (gre_info->okey &&
+ !nl_attr_put32(&req->n, buflen, IFLA_GRE_IKEY,
+ gre_info->okey))
+ return 0;
+
nl_attr_nest_end(&req->n, rta_data);
nl_attr_nest_end(&req->n, rta_info);
struct dplane_gre_ctx {
uint32_t link_ifindex;
unsigned int mtu;
+ struct zebra_l2info_gre info;
};
/*
* The context block used to exchange info about route updates across
return ctx->u.gre.mtu;
}
+const struct zebra_l2info_gre *
+dplane_ctx_gre_get_info(const struct zebra_dplane_ctx *ctx)
+{
+ DPLANE_CTX_VALID(ctx);
+
+ return &ctx->u.gre.info;
+}
+
/* Accessors for PBR rule information */
int dplane_ctx_rule_get_sock(const struct zebra_dplane_ctx *ctx)
{
* Common helper api for GRE set
*/
enum zebra_dplane_result
-dplane_gre_set(struct interface *ifp, struct interface *ifp_link, unsigned int mtu)
+dplane_gre_set(struct interface *ifp, struct interface *ifp_link,
+ unsigned int mtu, const struct zebra_l2info_gre *gre_info)
{
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
struct zebra_dplane_ctx *ctx;
ctx->u.gre.link_ifindex = ifp_link->ifindex;
else
ctx->u.gre.link_ifindex = 0;
-
+ if (gre_info)
+ memcpy(&ctx->u.gre.info, gre_info, sizeof(ctx->u.gre.info));
ctx->u.gre.mtu = mtu;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
dplane_ctx_gre_get_link_ifindex(const struct zebra_dplane_ctx *ctx);
unsigned int
dplane_ctx_gre_get_mtu(const struct zebra_dplane_ctx *ctx);
+const struct zebra_l2info_gre *
+dplane_ctx_gre_get_info(const struct zebra_dplane_ctx *ctx);
/* Namespace info - esp. for netlink communication */
const struct zebra_dplane_info *dplane_ctx_get_ns(
*/
enum zebra_dplane_result
dplane_gre_set(struct interface *ifp, struct interface *ifp_link,
- unsigned int mtu);
+ unsigned int mtu, const struct zebra_l2info_gre *gre_info);
/* Forward ref of zebra_pbr_rule */
struct zebra_pbr_rule;