Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152951616
D32709.id97871.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D32709.id97871.diff
View Options
Index: sbin/ifconfig/af_inet.c
===================================================================
--- sbin/ifconfig/af_inet.c
+++ sbin/ifconfig/af_inet.c
@@ -175,6 +175,16 @@
errx(1, "%s: bad value", s);
}
+static void
+in_postproc(int s, const struct afswtch *afp, int ifflags)
+{
+ if (sintab[ADDR]->sin_len != 0 && sintab[MASK]->sin_len == 0 &&
+ (ifflags & (IFF_POINTOPOINT | IFF_LOOPBACK)) == 0) {
+ warnx("WARNING: setting interface address without mask "
+ "is deprecated,\ndefault mask may not be correct.");
+ }
+}
+
static void
in_status_tunnel(int s)
{
@@ -222,6 +232,7 @@
.af_af = AF_INET,
.af_status = in_status,
.af_getaddr = in_getaddr,
+ .af_postproc = in_postproc,
.af_status_tunnel = in_status_tunnel,
.af_settunnel = in_set_tunnel,
.af_difaddr = SIOCDIFADDR,
Index: sbin/ifconfig/af_inet6.c
===================================================================
--- sbin/ifconfig/af_inet6.c
+++ sbin/ifconfig/af_inet6.c
@@ -419,7 +419,7 @@
}
static void
-in6_postproc(int s, const struct afswtch *afp)
+in6_postproc(int s, const struct afswtch *afp, int ifflags __unused)
{
if (explicit_prefix == 0) {
/* Aggregatable address architecture defines all prefixes
Index: sbin/ifconfig/ifconfig.h
===================================================================
--- sbin/ifconfig/ifconfig.h
+++ sbin/ifconfig/ifconfig.h
@@ -110,7 +110,8 @@
void (*af_getaddr)(const char *, int);
/* parse prefix method (IPv6) */
void (*af_getprefix)(const char *, int);
- void (*af_postproc)(int s, const struct afswtch *);
+ void (*af_postproc)(int s, const struct afswtch *,
+ int ifflags);
u_long af_difaddr; /* set dst if address ioctl */
u_long af_aifaddr; /* set if address ioctl */
void *af_ridreq; /* */
Index: sbin/ifconfig/ifconfig.c
===================================================================
--- sbin/ifconfig/ifconfig.c
+++ sbin/ifconfig/ifconfig.c
@@ -116,7 +116,7 @@
static void tunnel_status(int s);
static _Noreturn void usage(void);
-static int getifflags(const char *ifname, int us);
+static int getifflags(const char *ifname, int us, bool err_ok);
static struct afswtch *af_getbyname(const char *name);
static struct afswtch *af_getbyfamily(int af);
@@ -603,7 +603,7 @@
if (iflen >= sizeof(name)) {
warnx("%s: interface name too long, skipping", ifname);
} else {
- flags = getifflags(name, -1);
+ flags = getifflags(name, -1, false);
if (!(((flags & IFF_CANTCONFIG) != 0) ||
(downonly && (flags & IFF_UP) != 0) ||
(uponly && (flags & IFF_UP) == 0)))
@@ -1000,7 +1000,7 @@
* Do any post argument processing required by the address family.
*/
if (afp->af_postproc != NULL)
- afp->af_postproc(s, afp);
+ afp->af_postproc(s, afp, getifflags(name, s, true));
/*
* Do deferred callbacks registered while processing
* command-line arguments.
@@ -1179,7 +1179,7 @@
}
static int
-getifflags(const char *ifname, int us)
+getifflags(const char *ifname, int us, bool err_ok)
{
struct ifreq my_ifr;
int s;
@@ -1192,8 +1192,10 @@
} else
s = us;
if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&my_ifr) < 0) {
- Perror("ioctl (SIOCGIFFLAGS)");
- exit(1);
+ if (!err_ok) {
+ Perror("ioctl (SIOCGIFFLAGS)");
+ exit(1);
+ }
}
if (us < 0)
close(s);
@@ -1211,7 +1213,7 @@
struct ifreq my_ifr;
int flags;
- flags = getifflags(name, s);
+ flags = getifflags(name, s, false);
if (value < 0) {
value = -value;
flags &= ~value;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 7:14 AM (16 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31752596
Default Alt Text
D32709.id97871.diff (3 KB)
Attached To
Mode
D32709: ifconfig: warn if setting an Internet address without mask
Attached
Detach File
Event Timeline
Log In to Comment