Deleted Added
sdiff udiff text old ( 138593 ) new ( 138671 )
full compact
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 24 unchanged lines hidden (view full) ---

33 The Regents of the University of California. All rights reserved.\n";
34#endif /* not lint */
35
36#ifndef lint
37#if 0
38static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
39#endif
40static const char rcsid[] =
41 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 138593 2004-12-08 19:18:07Z sam $";
42#endif /* not lint */
43
44#include <sys/param.h>
45#include <sys/ioctl.h>
46#include <sys/socket.h>
47#include <sys/sysctl.h>
48#include <sys/time.h>
49#include <sys/module.h>

--- 391 unchanged lines hidden (view full) ---

441
442 for (p = cmds; p != NULL; p = p->c_next)
443 if (strcmp(name, p->c_name) == 0)
444 return p;
445 return NULL;
446#undef N
447}
448
449/* specially-handled comamnds */
450static void setifaddr(const char *, int, int, const struct afswtch *);
451static const struct cmd setifaddr_cmd = DEF_CMD("ifaddr", 0, setifaddr);
452
453static void setifdstaddr(const char *, int, int, const struct afswtch *);
454static const struct cmd setifdstaddr_cmd =
455 DEF_CMD("ifdstaddr", 0, setifdstaddr);
456
457static int
458ifconfig(int argc, char *const *argv, const struct afswtch *afp)
459{
460 int s;
461
462 if (afp == NULL)
463 afp = af_getbyname("inet");
464 ifr.ifr_addr.sa_family =
465 afp->af_af == AF_LINK || afp->af_af == AF_UNSPEC ?
466 AF_INET : afp->af_af;
467 strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);

--- 68 unchanged lines hidden (view full) ---

536 newaddr = 0;
537 }
538 }
539 if (newaddr && (setaddr || setmask)) {
540 strncpy(afp->af_addreq, name, sizeof ifr.ifr_name);
541 if (ioctl(s, afp->af_aifaddr, afp->af_addreq) < 0)
542 Perror("ioctl (SIOCAIFADDR)");
543 }
544 close(s);
545 return(0);
546}
547
548/*ARGSUSED*/
549static void
550setifaddr(const char *addr, int param, int s, const struct afswtch *afp)
551{

--- 464 unchanged lines hidden ---