Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 46082
Collapse All | Expand All

(-)nameif.c (-10 / +8 lines)
Lines 3-9 Link Here
3
 * Writen 2000 by Andi Kleen.
3
 * Writen 2000 by Andi Kleen.
4
 * Subject to the Gnu Public License, version 2.  
4
 * Subject to the Gnu Public License, version 2.  
5
 * TODO: make it support token ring etc.
5
 * TODO: make it support token ring etc.
6
 * $Id: nameif.c,v 1.1 2000/10/18 17:26:29 ak Exp $
6
 * $Id: net-tools-1.60-cleanup-list-handling.patch,v 1.1 2004/03/29 07:34:04 seemant Exp $
7
 */ 
7
 */ 
8
#ifndef _GNU_SOURCE 
8
#ifndef _GNU_SOURCE 
9
#define _GNU_SOURCE
9
#define _GNU_SOURCE
Lines 117-123 Link Here
117
}
117
}
118
118
119
struct change { 
119
struct change { 
120
	struct change *next,**pprev;
120
	struct change *next;
121
	int found;
121
	char ifname[IFNAMSIZ+1];
122
	char ifname[IFNAMSIZ+1];
122
	unsigned char mac[6];
123
	unsigned char mac[6];
123
}; 
124
}; 
Lines 139-148 Link Here
139
			ch->ifname, pos); 
140
			ch->ifname, pos); 
140
	if (parsemac(p,ch->mac) < 0) 
141
	if (parsemac(p,ch->mac) < 0) 
141
		complain(_("cannot parse MAC `%s' at %s"), p, pos); 
142
		complain(_("cannot parse MAC `%s' at %s"), p, pos); 
142
	if (clist) 
143
		clist->pprev = &ch->next;
144
	ch->next = clist;
143
	ch->next = clist;
145
	ch->pprev = &clist;
146
	clist = ch;
144
	clist = ch;
147
	return 0; 
145
	return 0; 
148
}
146
}
Lines 200-206 Link Here
200
198
201
void usage(void)
199
void usage(void)
202
{
200
{
203
	fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}")); 
201
	fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n")); 
204
	exit(1); 
202
	exit(1); 
205
}
203
}
206
204
Lines 277-297 Link Here
277
		ch = lookupmac(mac); 
275
		ch = lookupmac(mac); 
278
		if (!ch) 
276
		if (!ch) 
279
			continue;
277
			continue;
280
			
278
		
281
		*ch->pprev = ch->next;
279
		ch->found = 1;	
282
		if (strcmp(p, ch->ifname)) { 
280
		if (strcmp(p, ch->ifname)) { 
283
			if (setname(p, ch->ifname) < 0)  
281
			if (setname(p, ch->ifname) < 0)  
284
				complain(_("cannot change name of %s to %s: %s"),
282
				complain(_("cannot change name of %s to %s: %s"),
285
						p, ch->ifname, strerror(errno)); 
283
						p, ch->ifname, strerror(errno)); 
286
		} 
284
		} 
287
		free(ch);
288
	} 
285
	} 
289
	fclose(ifh); 
286
	fclose(ifh); 
290
	
287
	
291
	while (clist) { 
288
	while (clist) { 
292
		struct change *ch = clist;
289
		struct change *ch = clist;
293
		clist = clist->next;
290
		clist = clist->next;
294
		warning(_("interface '%s' not found"), ch->ifname); 
291
		if (!ch->found)
292
			warning(_("interface '%s' not found"), ch->ifname); 
295
		free(ch); 
293
		free(ch); 
296
	}
294
	}
297
295

Return to bug 46082