[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-inetutils] [PATCH] Fix ifconfig unknown format bug
From: |
Kim Max |
Subject: |
[bug-inetutils] [PATCH] Fix ifconfig unknown format bug |
Date: |
Tue, 29 Jun 2010 09:35:38 +0400 |
User-agent: |
Mutt/1.4.2.3i |
diff -uprN inetutils-1.8-vanila/ifconfig/changeif.c
inetutils-1.8/ifconfig/changeif.c
--- inetutils-1.8-vanila/ifconfig/changeif.c 2010-05-15 15:48:38.000000000
+0400
+++ inetutils-1.8/ifconfig/changeif.c 2010-06-29 08:46:36.000000000 +0400
@@ -209,6 +209,17 @@ set_flags (int sfd, struct ifreq *ifr, i
#endif
}
+static int
+format_check(const char *ftempl)
+{
+ if (!ftempl)
+ {
+ error(0, errno, "unknown format");
+ return -1;
+ }
+ return 0;
+}
+
int
configure_if (int sfd, struct ifconfig *ifp)
{
@@ -219,7 +230,8 @@ configure_if (int sfd, struct ifconfig *
strncpy (ifr.ifr_name, ifp->name, IFNAMSIZ);
ifr.ifr_name[IFNAMSIZ - 1] = '\0';
- if (ifp->valid & IF_VALID_ADDR)
+ err = format_check(ifp->format);
+ if (!err && ifp->valid & IF_VALID_ADDR)
err = set_address (sfd, &ifr, ifp->address);
if (!err && ifp->valid & IF_VALID_NETMASK)
err = set_netmask (sfd, &ifr, ifp->netmask);
diff -uprN inetutils-1.8-vanila/ifconfig/options.c
inetutils-1.8/ifconfig/options.c
--- inetutils-1.8-vanila/ifconfig/options.c 2010-05-15 15:48:38.000000000
+0400
+++ inetutils-1.8/ifconfig/options.c 2010-06-29 08:47:56.000000000 +0400
@@ -384,7 +384,7 @@ parse_opt_set_default_format (const char
}
}
- default_format = format;
+ default_format = NULL;
}
static int
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-inetutils] [PATCH] Fix ifconfig unknown format bug,
Kim Max <=