int tipc_core_start_net(unsigned long addr) { int res; if ((res = tipc_net_start(addr)) || (res = tipc_eth_media_start())) { tipc_core_stop_net(); } return res; }
int tipc_core_start_net(unsigned long addr) { int res; res = tipc_net_start(addr); if (!res) res = tipc_eth_media_start(); if (res) tipc_core_stop_net(); return res; }
int tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info) { struct net *net = sock_net(skb->sk); struct tipc_net *tn = net_generic(net, tipc_net_id); struct nlattr *attrs[TIPC_NLA_NET_MAX + 1]; int err; if (!info->attrs[TIPC_NLA_NET]) return -EINVAL; err = nla_parse_nested(attrs, TIPC_NLA_NET_MAX, info->attrs[TIPC_NLA_NET], tipc_nl_net_policy); if (err) return err; if (attrs[TIPC_NLA_NET_ID]) { u32 val; /* Can't change net id once TIPC has joined a network */ if (tn->own_addr) return -EPERM; val = nla_get_u32(attrs[TIPC_NLA_NET_ID]); if (val < 1 || val > 9999) return -EINVAL; tn->net_id = val; } if (attrs[TIPC_NLA_NET_ADDR]) { u32 addr; /* Can't change net addr once TIPC has joined a network */ if (tn->own_addr) return -EPERM; addr = nla_get_u32(attrs[TIPC_NLA_NET_ADDR]); if (!tipc_addr_node_valid(addr)) return -EINVAL; rtnl_lock(); tipc_net_start(net, addr); rtnl_unlock(); } return 0; }
/** * start_net - start TIPC networking sub-systems */ int tipc_core_start_net(unsigned long addr) { int res; tipc_net_start(addr); res = tipc_eth_media_start(); if (res < 0) goto err; res = tipc_ib_media_start(); if (res < 0) goto err; return res; err: tipc_core_stop_net(); return res; }
static struct sk_buff *cfg_set_own_addr(void) { u32 addr; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); addr = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); if (addr == tipc_own_addr) return tipc_cfg_reply_none(); if (!tipc_addr_node_valid(addr)) return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (node address)"); if (tipc_own_addr) return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED " (cannot change node address once assigned)"); tipc_net_start(addr); return tipc_cfg_reply_none(); }