LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File net-tools-1.60-obsolete.diff of Package net-tools (Project home:pwieczorkiewicz:branches:openSUSE:Leap:42.1:Update)

Index: net-tools-1.60/arp.c
===================================================================
--- arp.c
+++ arp.c
@@ -514,6 +514,10 @@ static void arp_disp(char *name, char *i
     printf(_("on %s\n"), dev);
 }
 
+static void obsolescence_warning(void)
+{
+	fprintf(stderr,_("arp is obsolete: please use `ip neigh` instead.\n"));
+}
 
 /* Display the contents of the ARP cache in the kernel. */
 static int arp_show(char *name)
@@ -601,6 +605,7 @@ static int arp_show(char *name)
 	}
     }
     (void) fclose(fp);
+    obsolescence_warning();
     return (0);
 }
 
@@ -662,6 +667,8 @@ int main(int argc, char **argv)
     textdomain("net-tools");
 #endif
 
+    obsolescence_warning();
+
     /* Initialize variables... */
     if ((hw = get_hwtype(DFLT_HW)) == NULL) {
 	fprintf(stderr, _("%s: hardware type not supported!\n"), DFLT_HW);
Index: net-tools-1.60/ifconfig.c
===================================================================
--- ifconfig.c
+++ ifconfig.c
@@ -225,6 +225,19 @@ static int set_netmask(int skfd, struct
     return 0;
 }
 
+/*
+ * This is called twice on purpose. Once at the start of the program,
+ * so that users piping it into |less will see it on the first page
+ * (if there is lots of output), and once again at the end of the program,
+ * for users that do not pipe it into anything, seeing the last page
+ * (also with lots of output).
+ */
+static void obsolescence_warning(void)
+{
+	fprintf(stderr,_("ifconfig is obsolete: please use `ip addr` or `ip link`. "
+	       "For statistics, use `ip -s link`.\n"));
+}
+
 int main(int argc, char **argv)
 {
     struct sockaddr sa, sa_netmask; 
@@ -253,6 +266,8 @@ int main(int argc, char **argv)
     textdomain("net-tools");
 #endif
 
+    obsolescence_warning();
+
     /* Find any options. */
     argc--;
     argv++;
@@ -295,6 +310,8 @@ int main(int argc, char **argv)
     if (argc == 0) {
 	int err = if_print((char *) NULL);
 	(void) close(skfd);
+	if (err == 0)
+	    obsolescence_warning();
 	exit(err < 0);
     }
     /* No. Fetch the interface name. */
@@ -987,6 +1004,9 @@ int main(int argc, char **argv)
 	spp++;
     }
 
+    if (goterr == 0)
+	obsolescence_warning();
+
     return (goterr);
 }
 
Index: net-tools-1.60/ipmaddr.c
===================================================================
--- ipmaddr.c
+++ ipmaddr.c
@@ -396,6 +396,9 @@ int main(int argc, char **argv)
 	textdomain("net-tools");
 #endif
 
+	fprintf(stderr,_("Note: multicast address configuration should "
+	       "be done through `ip maddr` instead.\n"));
+
 	basename = strrchr(argv[0], '/');
 	if (basename == NULL)
 		basename = argv[0];
Index: net-tools-1.60/iptunnel.c
===================================================================
--- iptunnel.c
+++ iptunnel.c
@@ -587,6 +587,9 @@ int main(int argc, char **argv)
 	textdomain("net-tools");
 #endif
 
+	fprintf(stderr,_("Note: tunnel configuration should "
+	       "be done through `ip tunnel` instead.\n"));
+
 	basename = strrchr(argv[0], '/');
 	if (basename == NULL)
 		basename = argv[0];
Index: net-tools-1.60/netstat.c
===================================================================
--- netstat.c
+++ netstat.c
@@ -1989,6 +1989,34 @@ static void usage(void)
     exit(E_USAGE);
 }
 
+static void netstat_obsolescence_warning(void)
+{
+	fprintf(stderr,_("netstat is obsolete: please use `ss` instead.\n"));
+}
+
+static void route_obsolescence_warning(void)
+{
+	fprintf(stderr,_("`netstat -r` is obsolete: "
+	       "please use `ip route` instead.\n"));
+}
+
+static void stat_obsolescence_warning(void)
+{
+	fprintf(stderr,_("`netstat -i` is obsolete: "
+	       "please use `ip -s link` instead.\n"));
+}
+
+static void groups_obsolescence_warning(void)
+{
+	fprintf(stderr,_("`netstat -g` is obsolete: "
+	       "please use `ip maddr` instead.\n"));
+}
+
+static void masq_obsolescence_warning(void)
+{
+	fprintf(stderr,_("`netstat -M` is obsolete: "
+	       "please use `conntrack -L` instead.\n"));
+}
 
 int main
  (int argc, char *argv[]) {
@@ -2152,6 +2180,7 @@ int main
 	+ flag_ax25 + flag_netrom + flag_igmp + flag_x25;
 
     if (flag_mas) {
+	masq_obsolescence_warning();
 #if HAVE_FW_MASQUERADE && HAVE_AFINET
 #if MORE_THAN_ONE_MASQ_AF
 	if (!afname[0])
@@ -2168,6 +2197,7 @@ int main
 	ENOSUPP("netstat.c", "FW_MASQUERADE");
 	i = -1;
 #endif
+	masq_obsolescence_warning();
 	return (i);
     }
 
@@ -2180,6 +2210,8 @@ int main
     if (flag_rou) {
 	int options = 0;
 
+	route_obsolescence_warning();
+
 	if (!afname[0])
 	    strcpy(afname, DFLT_AF);
 
@@ -2198,9 +2230,11 @@ int main
 		break;
 	    sleep(1);
 	}
+	route_obsolescence_warning();
 	return (i);
     }
     if (flag_int) {
+	stat_obsolescence_warning();
 	get_max_ifacename(flag_cacheof);
 	for (;;) {
 	    i = iface_info();
@@ -2208,8 +2242,10 @@ int main
 		break;
 	    sleep(1);
 	}
+	stat_obsolescence_warning();
 	return (i);
     }
+    netstat_obsolescence_warning();
     for (;;) {
 	if (!flag_arg || flag_tcp || flag_udp || flag_sctp || flag_raw) {
 #if HAVE_AFINET
@@ -2261,6 +2297,7 @@ int main
 	}
 
 	if (flag_igmp) {
+	    groups_obsolescence_warning();
 #if HAVE_AFINET6
 	    printf( "IPv6/");
 #endif
@@ -2268,6 +2305,7 @@ int main
 	    printf( _("Interface       RefCnt Group\n") );
 	    printf( "--------------- ------ ---------------------\n" );
 	    i = igmp_info();
+	    groups_obsolescence_warning();
 	    if (i)
 	        return (i);
 	}
@@ -2340,5 +2378,6 @@ int main
 	sleep(1);
 	prg_cache_clear();
     }
+    netstat_obsolescence_warning();
     return (i);
 }
Index: net-tools-1.60/route.c
===================================================================
--- route.c
+++ route.c
@@ -102,6 +102,10 @@ static void version(void)
     exit(E_VERSION);
 }
 
+static void obsolescence_warning(void)
+{
+	fprintf(stderr,_("route is obsolete: please use `ip route` instead.\n"));
+}
 
 int main(int argc, char **argv)
 {
@@ -128,6 +132,9 @@ int main(int argc, char **argv)
     bindtextdomain("net-tools", "/usr/share/locale");
     textdomain("net-tools");
 #endif
+
+    obsolescence_warning();
+
     getroute_init();		/* Set up AF routing support */
     setroute_init();
     afname[0] = '\0';
@@ -218,9 +225,10 @@ int main(int argc, char **argv)
     if (!opt_fc)
 	options |= FLAG_FIB;
 
-    if (what == RTACTION_SHOW)
+    if (what == RTACTION_SHOW) {
 	i = route_info(afname, options);
-    else
+	obsolescence_warning();
+    } else
 	i = route_edit(what, afname, options, ++argv);
 
     if (i == E_OPTERR)