Home | History | Annotate | Download | only in ip

Lines Matching full:nsid

39 /* This socket is used to get nsid */
141 int nsid;
146 #define NSID_HASH_NSID(nsid) (nsid & (NSIDMAP_SIZE - 1))
152 static struct nsid_cache *netns_map_get_by_nsid(int nsid)
154 uint32_t h = NSID_HASH_NSID(nsid);
160 if (c->nsid == nsid)
167 static int netns_map_add(int nsid, const char *name)
172 if (netns_map_get_by_nsid(nsid) != NULL)
180 c->nsid = nsid;
183 h = NSID_HASH_NSID(nsid);
204 int nsid;
223 nsid = get_netnsid_from_name(entry->d_name);
225 if (nsid >= 0)
226 netns_map_add(nsid, entry->d_name);
232 static int netns_get_name(int nsid, char *name)
249 if (nsid == id) {
267 int nsid;
288 nsid = rta_getattr_u32(tb[NETNSA_NSID]);
289 fprintf(fp, "nsid %u ", nsid);
291 c = netns_map_get_by_nsid(nsid);
297 /* During 'ip monitor nsid', no chance to have new nsid in cache. */
299 if (netns_get_name(nsid, name) == 0) {
301 netns_map_add(nsid, name);
679 static int set_netnsid_from_name(const char *name, int nsid)
699 addattr32(&req.n, 1024, NETNSA_NSID, nsid);
711 int netns, nsid;
718 fprintf(stderr, "No nsid specified\n");
722 nsid = atoi(argv[1]);
732 return set_netnsid_from_name(name, nsid);