Commit 4f37ea07 authored by Martina Ferrari's avatar Martina Ferrari

Merge tag 'upstream/1.60+git20161116.90da8a01' into debian/sid

upstream/1.60+git20161116.90da8a01
parents 91f981fa 90da8a01
......@@ -33,15 +33,27 @@ SBINDIR ?= /sbin
NET_LIB_PATH = lib
NET_LIB_NAME = net-tools
PROGS := ifconfig hostname arp netstat route rarp slattach plipconfig nameif
PROGS := ifconfig netstat route nameif
-include config.make
ifeq ($(HAVE_ARP_TOOLS),1)
PROGS += arp rarp
endif
ifeq ($(HAVE_HOSTNAME_TOOLS),1)
PROGS += hostname
endif
ifeq ($(HAVE_IP_TOOLS),1)
PROGS += iptunnel ipmaddr
endif
ifeq ($(HAVE_MII),1)
PROGS += mii-tool
endif
ifeq ($(HAVE_PLIP_TOOLS),1)
PROGS += plipconfig
endif
ifeq ($(HAVE_SERIAL_TOOLS),1)
PROGS += slattach
endif
# Compiler and Linker Options
CFLAGS ?= -O2 -g
......@@ -158,40 +170,40 @@ subdirs: libdir
@for i in $(SUBDIRS:$(NET_LIB_PATH)/=); do $(MAKE) -C $$i || exit $$? ; done
ifconfig: $(NET_LIB) ifconfig.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ ifconfig.o $(NLIB) $(LDLIBS)
nameif: $(NET_LIB) nameif.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ nameif.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ nameif.o $(NLIB) $(LDLIBS)
hostname: hostname.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ hostname.o $(DNLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ hostname.o $(DNLIB) $(LDLIBS)
route: $(NET_LIB) route.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ route.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ route.o $(NLIB) $(LDLIBS)
arp: $(NET_LIB) arp.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ arp.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ arp.o $(NLIB) $(LDLIBS)
rarp: $(NET_LIB) rarp.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rarp.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ rarp.o $(NLIB) $(LDLIBS)
slattach: $(NET_LIB) slattach.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ slattach.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ slattach.o $(NLIB) $(LDLIBS)
plipconfig: $(NET_LIB) plipconfig.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ plipconfig.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ plipconfig.o $(NLIB) $(LDLIBS)
netstat: $(NET_LIB) netstat.o statistics.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ netstat.o statistics.o $(NLIB) $(SELIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ netstat.o statistics.o $(NLIB) $(SELIB) $(LDLIBS)
iptunnel: $(NET_LIB) iptunnel.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ iptunnel.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ iptunnel.o $(NLIB) $(LDLIBS)
ipmaddr: $(NET_LIB) ipmaddr.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ ipmaddr.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ ipmaddr.o $(NLIB) $(LDLIBS)
mii-tool: $(NET_LIB) mii-tool.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB) $(LDLIBS)
installbin:
@echo
......@@ -201,29 +213,39 @@ installbin:
@echo
install -m 0755 -d ${BASEDIR}${SBINDIR}
install -m 0755 -d ${BASEDIR}${BINDIR}
install -m 0755 arp ${BASEDIR}${SBINDIR}
install -m 0755 hostname ${BASEDIR}${BINDIR}
install -m 0755 ifconfig ${BASEDIR}${BINDIR}
install -m 0755 nameif ${BASEDIR}${SBINDIR}
install -m 0755 netstat ${BASEDIR}${BINDIR}
install -m 0755 plipconfig $(BASEDIR)${SBINDIR}
install -m 0755 rarp ${BASEDIR}${SBINDIR}
install -m 0755 route ${BASEDIR}${BINDIR}
install -m 0755 slattach $(BASEDIR)${SBINDIR}
ifeq ($(HAVE_IP_TOOLS),1)
install -m 0755 ipmaddr $(BASEDIR)${SBINDIR}
install -m 0755 iptunnel $(BASEDIR)${SBINDIR}
endif
ifeq ($(HAVE_MII),1)
install -m 0755 mii-tool $(BASEDIR)${SBINDIR}
ifeq ($(HAVE_ARP_TOOLS),1)
install -m 0755 arp ${BASEDIR}${SBINDIR}
install -m 0755 rarp ${BASEDIR}${SBINDIR}
endif
ifeq ($(HAVE_HOSTNAME_TOOLS),1)
install -m 0755 hostname ${BASEDIR}${BINDIR}
ln -fs hostname $(BASEDIR)${BINDIR}/dnsdomainname
ifeq ($(HAVE_HOSTNAME_SYMLINKS),1)
ln -fs hostname $(BASEDIR)${BINDIR}/ypdomainname
ln -fs hostname $(BASEDIR)${BINDIR}/nisdomainname
ln -fs hostname $(BASEDIR)${BINDIR}/domainname
endif
ifeq ($(HAVE_AFDECnet),1)
ln -fs hostname $(BASEDIR)${BINDIR}/nodename
endif
endif
ifeq ($(HAVE_IP_TOOLS),1)
install -m 0755 ipmaddr $(BASEDIR)${SBINDIR}
install -m 0755 iptunnel $(BASEDIR)${SBINDIR}
endif
ifeq ($(HAVE_MII),1)
install -m 0755 mii-tool $(BASEDIR)${SBINDIR}
endif
ifeq ($(HAVE_PLIP_TOOLS),1)
install -m 0755 plipconfig $(BASEDIR)${SBINDIR}
endif
ifeq ($(HAVE_SERIAL_TOOLS),1)
install -m 0755 slattach $(BASEDIR)${SBINDIR}
endif
savebin:
@for i in ${BASEDIR}${SBINDIR}/arp ${BASEDIR}${SBINDIR}/ifconfig \
......
......@@ -90,6 +90,11 @@ bool 'InfiniBand hardware support' HAVE_HWIB y
* Other Features.
*
bool 'IP Masquerading support' HAVE_FW_MASQUERADE y
bool 'Build arp and rarp' HAVE_ARP_TOOLS y
bool 'Build hostname' HAVE_HOSTNAME_TOOLS y
bool 'Install hostname NIS/YP symlinks' HAVE_HOSTNAME_SYMLINKS y
bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS y
bool 'Build mii-tool' HAVE_MII y
bool 'Build plipconfig' HAVE_PLIP_TOOLS y
bool 'Build slattach' HAVE_SERIAL_TOOLS y
bool 'SELinux support' HAVE_SELINUX n
......@@ -31,6 +31,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
......@@ -139,6 +140,7 @@ static void showhname(char *hname, int c)
#endif
socklen_t len;
char **addrp;
bool isfirst = true;
/* We use -1 so we can guarantee the buffer is NUL terminated. */
len = sizeof(addr) - 1;
......@@ -179,14 +181,24 @@ static void showhname(char *hname, int c)
switch (c) {
case 'a':
while (hp->h_aliases[0])
printf("%s ", *hp->h_aliases++);
while (hp->h_aliases[0]) {
if (isfirst) {
printf("%s", *hp->h_aliases++);
isfirst = false;
} else
printf(" %s", *hp->h_aliases++);
}
printf("\n");
break;
case 'i':
for (addrp = hp->h_addr_list; *addrp; ++addrp) {
if (inet_ntop(hp->h_addrtype, *addrp, addr, len))
printf("%s ", addr);
if (inet_ntop(hp->h_addrtype, *addrp, addr, len)) {
if (isfirst) {
printf("%s", addr);
isfirst = false;
} else
printf(" %s", addr);
}
else if (errno == EAFNOSUPPORT)
fprintf(stderr, _("%s: protocol family not supported\n"),
program_name);
......
......@@ -1008,6 +1008,8 @@ int main(int argc, char **argv)
/*
* Don't do the set_flag() if the address is an alias with a - at the
* end, since it's deleted already! - Roman
* Same goes if they used address 0.0.0.0 as the kernel uses this to
* destroy aliases.
*
* Should really use regex.h here, not sure though how well it'll go
* with the cross-platform support etc.
......@@ -1015,10 +1017,18 @@ int main(int argc, char **argv)
{
char *ptr;
short int found_colon = 0;
short int bring_up = 1;
for (ptr = ifr.ifr_name; *ptr; ptr++ )
if (*ptr == ':') found_colon++;
if (!(found_colon && *(ptr - 1) == '-'))
if (found_colon) {
if (ptr[-1] == '-')
bring_up = 0;
else if (ap->af == AF_INET && sin->sin_addr.s_addr == 0)
bring_up = 0;
}
if (bring_up)
goterr |= set_flag(ifr.ifr_name, (IFF_UP | IFF_RUNNING));
}
......
......@@ -26,11 +26,15 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <net/if_arp.h>
/* We only care about linux/if_tunnel.h. Unfortunately, older Linux headers
* (pre linux-4.8) did not include all the proper headers leading to missing
* structs and types.
*/
#include <linux/types.h>
#include <linux/ip.h>
#include <linux/if_tunnel.h>
#include "config.h"
......
......@@ -48,6 +48,9 @@
#define _PATH_PROCNET_DEV "/proc/net/dev"
#define _PATH_PROCNET_RARP "/proc/net/rarp"
#define _PATH_ETHERS "/etc/ethers"
#define _PATH_PROCNET_ROSE "/proc/net/rose"
#define _PATH_PROCNET_ROSE_NEIGH "/proc/net/rose_neigh"
#define _PATH_PROCNET_ROSE_NODES "/proc/net/rose_nodes"
#define _PATH_PROCNET_ROSE_ROUTE "/proc/net/rose_routes"
#define _PATH_PROCNET_X25 "/proc/net/x25"
#define _PATH_PROCNET_X25_ROUTE "/proc/net/x25/route"
......
......@@ -11,6 +11,9 @@
* Copyright 1999 Bernd Eckenfels, Germany
* base on Code from Jonathan Naylor <jsn@Cs.Nott.AC.UK>
*
* Bernard Pidoux f6bvp@amsat.org added ROSE_NEIGH proc
* completing ROSE routing table - November 2009.
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software
......@@ -41,28 +44,48 @@
int ROSE_rprint(int options)
{
FILE *f = NULL;
char buffer[256];
int use;
FILE *f1, *f2;
char buffer1[256], buffer2[256];
int i, neigh, use;
f=fopen(_PATH_PROCNET_ROSE_ROUTE, "r");
if (f == NULL) {
perror(_PATH_PROCNET_ROSE_ROUTE);
printf(_("ROSE not configured in this system.\n")); /* xxx */
f2 = fopen(_PATH_PROCNET_ROSE_NEIGH, "r");
f1 = fopen(_PATH_PROCNET_ROSE_NODES, "r");
if (f1 == NULL) {
perror(_PATH_PROCNET_ROSE_NODES);
fprintf(stderr, _("ROSE not configured in this system.\n")); /* xxx */
return 1;
}
printf(_("Kernel ROSE routing table\n"));
printf(_("Destination Iface Use\n"));
if (fgets(buffer, 256, f))
printf(_("Destination neigh1 callsign device neigh2 callsign device neigh3 callsign device\n"));
if (fgets(buffer1, 256, f1))
/* eat line */;
while (fgets(buffer, 256, f)) {
buffer[9] = 0;
buffer[14] = 0;
use = atoi(buffer + 15);
printf("%-9s %-5s %5d\n",
buffer, buffer + 10, use);
while (fgets(buffer1, 256, f1)) {
buffer1[10] = 0; /* address */
buffer1[15] = 0; /* mask */
buffer1[17] = 0; /* use */
buffer1[23] = 0; /* neigh 1 */
buffer1[29] = 0; /* neigh 2 */
buffer1[35] = 0; /* neigh 3 */
use = atoi(buffer1 + 16);
neigh = atoi(buffer1 + 18);
printf("%-10s ", buffer1);
for (i = 0; i < use; i++) {
neigh = atoi(buffer1 + 6 * (i + 3));
printf("%05d ", neigh);
rewind(f2);
if (fgets(buffer2, 256, f2))
/* eat line */;
while (fgets(buffer2, 256, f2)) {
buffer2[15] = 0;
buffer2[21] = 0;
if (atoi(buffer2) == neigh)
printf("%-10s %-4s", buffer2 + 6, buffer2 + 16);
}
}
printf("\n");
}
fclose(f);
fclose(f1);
fclose(f2);
return 0;
}
......
......@@ -39,6 +39,32 @@ else
LANGS = en_US
endif
IGNORE_CMDS = ""
ifneq ($(HAVE_ARP_TOOLS),1)
IGNORE_CMDS += |arp.?|rarp.?
endif
ifneq ($(HAVE_HOSTNAME_TOOLS),1)
IGNORE_CMDS += |dnsdomainname.?|hostname.?
endif
ifneq ($(HAVE_HOSTNAME_SYMLINKS),1)
IGNORE_CMDS += |domainname.?|nisdomainname.?|ypdomainname.?
endif
ifneq ($(HAVE_AFDECnet),1)
IGNORE_CMDS += |nodename.?
endif
ifneq ($(HAVE_IP_TOOLS),1)
IGNORE_CMDS += |ipmaddr.?|iptunnel.?
endif
ifneq ($(HAVE_MII),1)
IGNORE_CMDS += |mii-tool.?
endif
ifneq ($(HAVE_PLIP_TOOLS),1)
IGNORE_CMDS += |plipconfig.?
endif
ifneq ($(HAVE_SERIAL_TOOLS),1)
IGNORE_CMDS += |slattach.?
endif
all:
clean:
......@@ -57,11 +83,11 @@ install:
else \
MAN_DIR=${BASEDIR}${mandir}/$$LANG/man$$SECTION; \
fi ; \
CMDS=`ls *.$$SECTION`; \
[ -z "$$CMDS" ] && continue; \
$(INSTALL) -d -m 755 $$MAN_DIR; \
for CMD in $$CMDS; do \
$(INSTALL) -m 644 $$CMD $$MAN_DIR; \
for CMD in *.$$SECTION; do \
[ -e $$CMD ] || continue; \
case $$CMD in $(IGNORE_CMDS)) continue;; esac; \
$(INSTALL) -m 644 $$CMD $$MAN_DIR || exit 1; \
done; \
done; \
cd ..; \
......
......@@ -60,9 +60,9 @@ The name of the interface. This is usually a driver name followed by
a unit number, for example
.B eth0
for the first Ethernet interface. If your kernel supports alias interfaces,
you can specify them with
you can specify them with syntax like
.B eth0:0
for the first alias of eth0. You can use them to assign a second address. To
for the first alias of eth0. You can use them to assign more addresses. To
delete an alias interface use
.BR "ifconfig eth0:0 down" .
Note: for every scope (i.e. same net with address/netmask combination) all
......@@ -70,7 +70,13 @@ aliases are deleted, if you delete the first (primary).
.TP
.B up
This flag causes the interface to be activated. It is implicitly
specified if an address is assigned to the interface.
specified if an address is assigned to the interface; you can suppress this
behavior when using an alias interface by appending an
.BR "-"
to the alias (e.g.
.BR "eth0:0-" ).
It is also suppressed when using the IPv4 0.0.0.0 address as the kernel will
use this to implicitly delete alias interfaces.
.TP
.B down
This flag causes the driver for this interface to be shut down.
......
......@@ -143,7 +143,7 @@ les démons de routage).
.TP
.B mss M
Spécifie le MSS (Maximum Segment Size, Taille maximum de segment) de TCP,
pour les connexions empreintant cette route. Ce n'est normalement utilisé
pour les connexions empruntant cette route. Ce n'est normalement utilisé
que pour des optimisations fines des configurations de routage.
......
......@@ -555,6 +555,55 @@ static int netrom_info(void)
}
#endif
#if HAVE_AFROSE
static const char * const rose_state[] =
{
N_("LISTENING"),
N_("CONN SENT"),
N_("DISC SENT"),
N_("ESTABLISHED"),
};
static int rose_info(void)
{
FILE *f;
char buffer[256], dev[6];
int ret, st, lci, neigh;
char src_addr[10], src_call[9], dest_addr[10], dest_call[9];
f = fopen(_PATH_PROCNET_ROSE, "r");
if (f == NULL) {
if (errno != ENOENT) {
perror(_PATH_PROCNET_ROSE);
return (-1);
}
if (flag_arg || flag_ver)
ESYSNOT("netstat", "AF ROSE");
if (flag_arg)
return (1);
else
return (0);
}
printf(_("Active ROSE sockets\n"));
printf(_("dest_addr dest_call src_addr src_call dev lci neigh state\n"));
if (fgets(buffer, 256, f))
/* eat line */;
while (fgets(buffer, 256, f)) {
ret = sscanf(buffer, "%s %s %s %s %s %d %d %d",
dest_addr, dest_call, src_addr, src_call, dev, &lci, &neigh, &st);
if (ret != 8) {
printf(_("Problem reading data from %s\n"), _PATH_PROCNET_ROSE);
continue;
}
printf("%-10s %-9s %-10s %-9s %-5s %3d %5d %s\n",
dest_addr, dest_call, src_addr, src_call, dev, lci, neigh, _(rose_state[st]));
}
fclose(f);
return 0;
}
#endif
/* These enums are used by IPX too. :-( */
enum {
TCP_ESTABLISHED = 1,
......@@ -1177,7 +1226,7 @@ static int notnull(const struct sockaddr_storage *sas)
static void udp_do_one(int lnr, const char *line,const char *prot)
{
char local_addr[64], rem_addr[64];
char local_addr[128], rem_addr[128];
char *udp_state, timers[64];
int num, local_port, rem_port, d, state, timer_run, uid, timeout;
struct sockaddr_storage localsas, remsas;
......@@ -1291,7 +1340,7 @@ static int udplite_info(void)
static void raw_do_one(int lnr, const char *line,const char *prot)
{
char local_addr[64], rem_addr[64];
char local_addr[128], rem_addr[128];
char timers[64];
int num, local_port, rem_port, d, state, timer_run, uid, timeout;
struct sockaddr_storage localsas, remsas;
......@@ -2369,7 +2418,7 @@ int main
#endif
}
if (!flag_arg || flag_rose) {
#if 0 && HAVE_AFROSE
#if HAVE_AFROSE
i = rose_info();
if (i)
return (i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment