int new = 0;
if (debug_vrf)
- zlog_debug("VRF_GET: %s(%u)",
- name == NULL ? "(NULL)" : name, vrf_id);
+ zlog_debug("VRF_GET: %s(%u)", name == NULL ? "(NULL)" : name,
+ vrf_id);
/* Nothing to see, move along here */
if (!name && vrf_id == VRF_UNKNOWN)
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- zlog_err("%s: Can't switch to VRF %u (%s)",
- __func__, vrf_id, safe_strerror(errno));
+ zlog_err("%s: Can't switch to VRF %u (%s)", __func__, vrf_id,
+ safe_strerror(errno));
ret = socket(domain, type, protocol);
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- zlog_err("%s: Can't switchback from VRF %u (%s)",
- __func__, vrf_id, safe_strerror(errno));
+ zlog_err("%s: Can't switchback from VRF %u (%s)", __func__,
+ vrf_id, safe_strerror(errno));
errno = save_errno;
if (ret <= 0)
return ret;
if (strlen(vrfname) > VRF_NAMSIZ) {
if (vty)
vty_out(vty,
- "%% VRF name %s invalid: length exceeds %d bytes\n",
- vrfname, VRF_NAMSIZ);
+ "%% VRF name %s invalid: length exceeds %d bytes\n",
+ vrfname, VRF_NAMSIZ);
else
zlog_warn(
- "%% VRF name %s invalid: length exceeds %d bytes\n",
- vrfname, VRF_NAMSIZ);
+ "%% VRF name %s invalid: length exceeds %d bytes\n",
+ vrfname, VRF_NAMSIZ);
return CMD_WARNING_CONFIG_FAILED;
}
return CMD_SUCCESS;
}
-int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf,
- char *pathname, ns_id_t ns_id)
+int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
+ ns_id_t ns_id)
{
struct ns *ns = NULL;
return CMD_WARNING_CONFIG_FAILED;
}
if (vrf->ns_ctxt != NULL) {
- ns = (struct ns *) vrf->ns_ctxt;
+ ns = (struct ns *)vrf->ns_ctxt;
if (ns && 0 != strcmp(ns->name, pathname)) {
if (vty)
vty_out(vty,
- "VRF %u already configured with NETNS %s\n",
- vrf->vrf_id, ns->name);
+ "VRF %u already configured with NETNS %s\n",
+ vrf->vrf_id, ns->name);
else
zlog_warn(
- "VRF %u already configured with NETNS %s",
- vrf->vrf_id, ns->name);
+ "VRF %u already configured with NETNS %s",
+ vrf->vrf_id, ns->name);
return CMD_WARNING_CONFIG_FAILED;
}
}
if (vrf2 == vrf)
return CMD_SUCCESS;
if (vty)
- vty_out(vty, "NS %s is already configured"
+ vty_out(vty,
+ "NS %s is already configured"
" with VRF %u(%s)\n",
- ns->name, vrf2->vrf_id, vrf2->name);
+ ns->name, vrf2->vrf_id, vrf2->name);
else
zlog_warn("NS %s is already configured with VRF %u(%s)",
ns->name, vrf2->vrf_id, vrf2->name);
if (!ns_enable(ns, vrf_update_vrf_id)) {
if (vty)
vty_out(vty, "Can not associate NS %u with NETNS %s\n",
- ns->ns_id, ns->name);
+ ns->ns_id, ns->name);
else
zlog_warn("Can not associate NS %u with NETNS %s",
ns->ns_id, ns->name);
if (vrf_is_mapped_on_netns(vrf_id))
return fd;
#ifdef SO_BINDTODEVICE
- ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, name,
- strlen(name));
+ ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name));
if (ret < 0)
- zlog_debug("bind to interface %s failed, errno=%d",
- name, errno);
+ zlog_debug("bind to interface %s failed, errno=%d", name,
+ errno);
#endif /* SO_BINDTODEVICE */
return ret;
}
int vrf_getaddrinfo(const char *node, const char *service,
- const struct addrinfo *hints,
- struct addrinfo **res, vrf_id_t vrf_id)
+ const struct addrinfo *hints, struct addrinfo **res,
+ vrf_id_t vrf_id)
{
int ret, ret2, save_errno;
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- zlog_err("%s: Can't switch to VRF %u (%s)",
- __func__, vrf_id, safe_strerror(errno));
+ zlog_err("%s: Can't switch to VRF %u (%s)", __func__, vrf_id,
+ safe_strerror(errno));
ret = getaddrinfo(node, service, hints, res);
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- zlog_err("%s: Can't switchback from VRF %u (%s)",
- __func__, vrf_id, safe_strerror(errno));
+ zlog_err("%s: Can't switchback from VRF %u (%s)", __func__,
+ vrf_id, safe_strerror(errno));
errno = save_errno;
return ret;
}
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0) {
- zlog_err("%s: Can't switch to VRF %u (%s)",
- __func__, vrf_id, safe_strerror(errno));
+ zlog_err("%s: Can't switch to VRF %u (%s)", __func__, vrf_id,
+ safe_strerror(errno));
return 0;
}
rc = ioctl(d, request, params);
saved_errno = errno;
ret = vrf_switchback_to_initial();
if (ret < 0)
- zlog_err("%s: Can't switchback from VRF %u (%s)",
- __func__, vrf_id, safe_strerror(errno));
+ zlog_err("%s: Can't switchback from VRF %u (%s)", __func__,
+ vrf_id, safe_strerror(errno));
errno = saved_errno;
return rc;
}
ret = vrf_switch_to_netns(vrf_id);
if (ret < 0)
- zlog_err("%s: Can't switch to VRF %u (%s)",
- __func__, vrf_id, safe_strerror(errno));
+ zlog_err("%s: Can't switch to VRF %u (%s)", __func__, vrf_id,
+ safe_strerror(errno));
ret = sockunion_socket(su);
save_errno = errno;
ret2 = vrf_switchback_to_initial();
if (ret2 < 0)
- zlog_err("%s: Can't switchback from VRF %u (%s)",
- __func__, vrf_id, safe_strerror(errno));
+ zlog_err("%s: Can't switchback from VRF %u (%s)", __func__,
+ vrf_id, safe_strerror(errno));
errno = save_errno;
if (ret <= 0)