Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 12:51:15 +02:00
commit 27c9d80f51
10493 changed files with 1885777 additions and 0 deletions

View File

@@ -0,0 +1,200 @@
#
# Copyright (C) 2006-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=linux-atm
PKG_VERSION:=2.5.2
PKG_RELEASE:=8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/$(PKG_NAME)
PKG_HASH:=9645481a2b16476b59220aa2d6bc5bc41043f291326c9b37581018fbd16dd53a
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_LICENSE:=GPL-2.0+
PKG_CPE_ID:=cpe:/a:linux-atm:linux-atm
PKG_FIXUP:=autoreconf
PKG_FLAGS:=nonshared
include $(INCLUDE_DIR)/package.mk
ATM_DEBUG_BINS:=aread awrite atmdiag atmdump atmswitch saaldump \
sonetdiag svc_recv svc_send ttcp_atm
ATM_DEBUG_SBINS:=atmaddr atmloop atmtcp esi atmsigd bus \
ilmid ilmidiag lecs les mpcd zeppelin
ATM_DEBUG_TOOLS:=$(ATM_DEBUG_BINS) $(ATM_DEBUG_SBINS)
define Package/linux-atm
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Linux ATM library
URL:=http://linux-atm.sourceforge.net/
endef
define Package/linux-atm/description
This package contains a library for accessing the Linux ATM subsystem.
endef
define Package/linux-atm/Default
SECTION:=net
CATEGORY:=Network
DEPENDS:=+linux-atm
URL:=http://linux-atm.sourceforge.net/
SUBMENU:=Linux ATM tools
endef
define Package/atm-tools
$(call Package/linux-atm/Default)
TITLE:=Linux ATM tools
endef
define Package/atm-tools/description
This package contains the Linux ATM tools.
endef
define Package/atm-diagnostics
$(call Package/linux-atm/Default)
TITLE:=Linux ATM Diagnostics
endef
define Package/atm-diagnostics/description
This package contains the Linux ATM diagnostics.
endef
define Package/atm-debug-tools
$(call Package/linux-atm/Default)
TITLE:=Linux ATM debugging tools
endef
define Package/atm-debug-tools/description
This package contains the Linux ATM debugging tools.
endef
define Package/br2684ctl
$(call Package/linux-atm/Default)
TITLE:=ATM Ethernet bridging configuration utility
endef
define Package/br2684ctl/description
Support for AAL5 encapsulation (RFC-1483/RFC-2684) over ATM.
endef
define GenAtmPlugin
define Package/$(1)
$(call Package/linux-atm/Default)
TITLE:=Linux ATM tool $(2)
endef
define Package/$(1)/description
Linux ATM tool $(2).
endef
endef
$(foreach t,$(ATM_DEBUG_TOOLS),$(eval $(call GenAtmPlugin,atm-$(t),$(t))))
TARGET_CFLAGS += -I$(LINUX_DIR)/user_headers/include
define Build/Configure
$(call Build/Configure/Default)
# prevent autoheader invocation
touch $(PKG_BUILD_DIR)/stamp-h.in
endef
unexport PREFIX
define Build/Compile
# src/qgen is built with HOSTCC, which does not really like our LDFLAGS
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/src/qgen \
LDFLAGS="" \
all
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) OBJCOPY=$(TARGET_CROSS)objcopy all
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr
$(CP) \
$(PKG_INSTALL_DIR)/usr/include \
$(PKG_INSTALL_DIR)/usr/lib \
$(1)/usr/
endef
define Package/linux-atm/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libatm.so* $(1)/usr/lib/
endef
define Package/atm-tools/install
$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmarp{,d} $(1)/usr/sbin/
endef
define BuildAtmPlugin
define Package/$(1)/install
$(INSTALL_DIR) $$(1)/usr/$(3)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/$(3)/$(2) $$(1)/usr/$(3)
endef
$$(eval $$(call BuildPackage,$(1)))
endef
define Package/atm-debug-tools/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmaddr $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmloop $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmtcp $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/esi $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aread $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/awrite $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmdiag $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmdump $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmsigd $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bus $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ilmid $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ilmidiag $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lecs $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/les $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mpcd $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zeppelin $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmswitch $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/saaldump $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sonetdiag $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/svc_recv $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/svc_send $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ttcp_atm $(1)/usr/bin/
endef
define Package/atm-diagnostics/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aread $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/awrite $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmdiag $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmdump $(1)/usr/bin/
endef
define Package/br2684ctl/install
$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/hotplug.d/atm $(1)/usr/sbin $(1)/lib/netifd
$(INSTALL_BIN) ./files/br2684-up $(1)/lib/netifd/br2684-up
$(INSTALL_BIN) ./files/br2684ctl $(1)/etc/init.d/
$(INSTALL_CONF) ./files/atm.hotplug $(1)/etc/hotplug.d/atm/00-trigger
$(INSTALL_BIN) \
./files/br2684ctl_wrap \
$(PKG_INSTALL_DIR)/usr/sbin/br2684ctl \
$(1)/usr/sbin/
endef
$(eval $(call BuildPackage,linux-atm))
$(eval $(call BuildPackage,atm-tools))
$(eval $(call BuildPackage,atm-debug-tools))
$(eval $(call BuildPackage,atm-diagnostics))
$(eval $(call BuildPackage,br2684ctl))
$(foreach t,$(ATM_DEBUG_BINS),$(eval $(call BuildAtmPlugin,atm-$(t),$(t),bin)))
$(foreach t,$(ATM_DEBUG_SBINS),$(eval $(call BuildAtmPlugin,atm-$(t),$(t),sbin)))

View File

@@ -0,0 +1 @@
ubus call service event '{ "type": "hotplug.atm", "data": { "name": "'"$DEVICENAME"'" } }'

View File

@@ -0,0 +1,3 @@
#!/bin/sh
. /lib/functions/network.sh
network_ready_device "$1"

View File

@@ -0,0 +1,84 @@
#!/bin/sh /etc/rc.common
START=50
USE_PROCD=1
start_daemon() {
local cfg="$1"
local atmdev disabled
config_get_bool disabled "$cfg" disabled 0
[ "$disabled" -eq 1 ] && return
config_get atmdev "$cfg" atmdev 0
local nameprefix
config_get nameprefix "$cfg" nameprefix "nas"
local unit
config_get unit "$cfg" unit 0
local vpi
config_get vpi "$cfg" vpi 8
local vci
config_get vci "$cfg" vci 35
local encaps
config_get encaps "$cfg" encaps
case "$encaps" in
1|vc) encaps=1;;
*) encaps=0;;
esac
local payload
config_get payload "$cfg" payload
case "$payload" in
0|routed) payload=0;;
*) payload=1;;
esac
local qos
config_get qos "$cfg" qos
local sendsize
config_get sendsize "$cfg" sendsize
found=
for device in /sys/class/atm/*; do
[ -d "$device" ] || break
[ "$(cat $device/atmindex)" = "$atmdev" ] || continue
found=1
break
done
[ -n "$found" ] || return
local circuit="$atmdev.$vpi.$vci"
procd_open_instance
procd_set_param command \
/usr/sbin/br2684ctl_wrap "${nameprefix}${unit}" \
-n "$nameprefix" -c "$unit" -e "$encaps" -p "$payload" \
-a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"} \
-S /lib/netifd/br2684-up
procd_close_instance
}
service_triggers() {
local script=$(readlink "$initscript")
local name=$(basename ${script:-$initscript})
procd_open_trigger
procd_add_raw_trigger hotplug.atm 2000 /etc/init.d/$name reload
procd_add_config_trigger "config.change" "network" /etc/init.d/$name reload
procd_close_trigger
}
start_service() {
config_load network
config_foreach start_daemon atm-bridge
}

View File

@@ -0,0 +1,5 @@
#!/bin/sh
. /lib/functions/network.sh
device="$1"; shift
network_defer_device "$device"
exec /usr/sbin/br2684ctl "$@"

View File

@@ -0,0 +1,319 @@
--- a/src/mpoad/mpcd.8
+++ b/src/mpoad/mpcd.8
@@ -28,7 +28,7 @@ mpcd \- ATM MPOA (Multi\-Protocol Over A
.B ]]
.SH DESCRIPTION
MPOA client
-.SM(MPC) is responsible for creating and receiving
+.SM (MPC) is responsible for creating and receiving
internetwork layer shortcuts. Using these shortcuts MPCs forward
unicast internetwork layer packets effectively over ATM without need
for routing protocols.
@@ -43,7 +43,7 @@ accepts shortcuts and packets arriving o
shortcuts is done with the help of
.SM MPOA
server
-.SM(MPS).
+.SM (MPS).
.PP
Just as the Linux
.SM LAN
--- a/src/led/zeppelin.8
+++ b/src/led/zeppelin.8
@@ -99,7 +99,7 @@ Ring and ATM parts of the ELAN, so using
recommended. Token Ring support has received less testing than its
Ethernet counterpart.
.SH FILES
-.IP \fI/var/run/lec[interface number].pid\fP
+.IP \fI/var/run/lec[interface\ number].pid\fP
The file containing the process id of zeppelin.
.SH BUGS
John Bonham died 1980 and Led Zeppelin broke.
--- a/src/sigd/atmsigd.conf.4
+++ b/src/sigd/atmsigd.conf.4
@@ -125,7 +125,7 @@ a comment. The `#' character cannot be e
.P
If an option is specified in \fBatmsigd.conf\fP and on the command
line, the command line has priority.
-.COMPATIBILITY
+.SH COMPATIBILITY
Certain options used by past versions of \fBatmsigd\fP but no longer documented
on the man page are still recognized and supported, but they also yield a
warning message. Future versions of \fBatmsigd\fP will not recognize those
--- a/src/arpd/io.c
+++ b/src/arpd/io.c
@@ -277,7 +277,8 @@ static void accept_new(void)
struct atm_qos qos;
ENTRY *entry;
VCC *vcc;
- int fd,len,size,error;
+ int fd,error;
+ socklen_t len,size;
len = sizeof(addr);
if ((fd = accept(incoming,(struct sockaddr *) &addr,&len)) < 0) {
@@ -614,7 +615,8 @@ int ip_itf_info(int number,uint32_t *ip,
int get_local(int fd,struct sockaddr_atmsvc *addr)
{
- int length,result;
+ int result;
+ size_t length;
length = sizeof(struct sockaddr_atmsvc);
result = getsockname(fd,(struct sockaddr *) addr,&length);
--- a/src/arpd/table.c
+++ b/src/arpd/table.c
@@ -101,7 +101,8 @@ static void dump_vcc(VCC *vcc)
char addr_buf[MAX_ATM_ADDR_LEN+1];
char qos_buf[MAX_ATM_QOS_LEN+1];
struct atm_qos qos;
- int size,sndbuf;
+ int sndbuf;
+ socklen_t size;
size = sizeof(addr);
if (getpeername(vcc->fd,(struct sockaddr *) &addr,&size) < 0) {
--- a/src/ilmid/asn1/asn_int.c
+++ b/src/ilmid/asn1/asn_int.c
@@ -185,7 +185,7 @@ FILE* f _AND_
AsnInt* v _AND_
unsigned short int indent)
{
- fprintf(f,"%d", *v);
+ fprintf(f,"%ld", *v);
}
@@ -370,5 +370,5 @@ FILE* f _AND_
UAsnInt* v _AND_
unsigned short int indent)
{
- fprintf(f,"%u", *v);
+ fprintf(f,"%lu", *v);
}
--- a/src/ilmid/asn1/asn_oid.c
+++ b/src/ilmid/asn1/asn_oid.c
@@ -127,7 +127,7 @@ unsigned short int indent)
if (firstArcNum > 2)
firstArcNum = 2;
- fprintf(f,"%u %u", firstArcNum, arcNum - (firstArcNum * 40));
+ fprintf(f,"%d %lu", firstArcNum, arcNum - (firstArcNum * 40));
for (; i < v->octetLen ; )
{
@@ -136,7 +136,7 @@ unsigned short int indent)
arcNum = (arcNum << 7) + (v->octs[i] & 0x7f);
i++;
- fprintf(f," %u", arcNum);
+ fprintf(f," %lu", arcNum);
}
fprintf(f,"}");
--- a/src/lane/connect.c
+++ b/src/lane/connect.c
@@ -258,7 +258,8 @@ static int
data_handler(const Event_t *event, void *funcdata)
{
Conn_t *tmp, *newconn;
- int fd, nbytes;
+ int fd;
+ socklen_t nbytes;
static char buffer[BUFSIZE];
LaneControl_t *ctmp;
struct sockaddr_atmsvc addr;
--- a/src/lane/connect_bus.c
+++ b/src/lane/connect_bus.c
@@ -170,7 +170,8 @@ static int
data_handler(const Event_t *event, void *funcdata)
{
Conn_t *tmp, *newconn;
- int fd, nbytes;
+ int fd;
+ socklen_t nbytes;
static char buffer[BUFSIZE];
struct sockaddr_atmsvc addr;
--- a/src/lane/lane_atm.c
+++ b/src/lane/lane_atm.c
@@ -138,7 +138,7 @@ atm_connect_back(const AtmAddr_t *our_ad
struct atm_blli blli;
struct atm_qos qos;
int fd, ret;
- int len = sizeof(address);
+ socklen_t len = sizeof(address);
fd = socket(PF_ATMSVC, SOCK_DGRAM, 0);
if (fd <0) {
--- a/src/lane/lecs.c
+++ b/src/lane/lecs.c
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
int just_dump=0;
fd_set fds;
struct sockaddr_atmsvc client;
- int len;
+ socklen_t len;
unsigned char buffer[P_SIZE];
while(i!=-1) {
--- a/src/lib/ans.c
+++ b/src/lib/ans.c
@@ -41,7 +41,7 @@
static int ans(const char *text,int wanted,void *result,int res_len)
{
unsigned char answer[MAX_ANSWER];
- unsigned char name[MAX_NAME];
+ char name[MAX_NAME];
unsigned char *pos,*data,*found;
int answer_len,name_len,data_len,found_len;
int questions,answers;
--- a/src/lib/sdu2cell.c
+++ b/src/lib/sdu2cell.c
@@ -15,7 +15,8 @@ int sdu2cell(int s,int sizes,const int *
{
struct atm_qos qos;
int trailer,total,cells;
- int size,i;
+ int i;
+ socklen_t size;
size = sizeof(qos);
if (getsockopt(s,SOL_AAL,SO_ATMQOS,&qos,&size) < 0) return -1;
--- a/src/lib/unix.c
+++ b/src/lib/unix.c
@@ -63,8 +63,8 @@ int un_attach(const char *path)
int un_recv_connect(int s,void *buf,int size)
{
struct sockaddr_un addr;
- int addr_size;
int len;
+ socklen_t addr_size;
addr_size = sizeof(addr);
len = recvfrom(s,buf,size,0,(struct sockaddr *) &addr,&addr_size);
--- a/src/maint/atmtcp.c
+++ b/src/maint/atmtcp.c
@@ -817,7 +817,8 @@ int main(int argc,char **argv)
}
else if (!strcmp(ARG,"listen") ||
(do_background = !strcmp(ARG,"listen-bg"))) {
- int fd,port,addr_len;
+ int fd,port;
+ socklen_t addr_len;
int *fd2 = alloc_t(int);
if ((fd = socket(PF_INET,SOCK_STREAM,0)) < 0) {
--- a/src/maint/hediag.c
+++ b/src/maint/hediag.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
--- a/src/mpoad/io.c
+++ b/src/mpoad/io.c
@@ -521,7 +521,8 @@ static int msg_from_mps(int slot)
static int accept_conn(int slot)
{
struct sockaddr_atmsvc sa;
- int i, new_fd, sa_len;
+ int i, new_fd;
+ socklen_t sa_len;
sa_len = sizeof(sa);
new_fd = accept(fds[slot].fd, (struct sockaddr *)&sa, &sa_len);
--- a/src/sigd/io.c
+++ b/src/sigd/io.c
@@ -355,7 +355,7 @@ int get_pvc(int itf,int *vci)
error = 0;
if (bind(s,(struct sockaddr *) &addr,sizeof(addr)) < 0) error = errno;
else {
- int size;
+ socklen_t size;
size = sizeof(addr);
if (getsockname(s,(struct sockaddr *) &addr,&size) < 0)
--- a/src/test/ttcp.c
+++ b/src/test/ttcp.c
@@ -92,7 +92,8 @@ struct sockaddr_in frominet;
struct sockaddr_atmsvc satm;
struct atm_qos qos;
-int domain, fromlen;
+int domain;
+socklen_t fromlen;
int fd; /* fd of network socket */
int buflen = 8 * 1024; /* length of buffer */
@@ -466,7 +467,7 @@ int no_check = 0;
{
struct sockaddr_atmsvc peer;
- int peerlen = sizeof(peer);
+ socklen_t peerlen = sizeof(peer);
if (getpeername(fd, (struct sockaddr *) &peer,
&peerlen) < 0) {
err("getpeername");
@@ -498,7 +499,7 @@ int no_check = 0;
/* set socket buffer size */
#if defined(SO_SNDBUF) || defined(SO_RCVBUF)
if (sockbufsize) {
- int len;
+ socklen_t len;
if (trans) {
/* set send socket buffer if we are transmitting */
@@ -663,7 +664,7 @@ int no_check = 0;
exit(0);
usage:
- fprintf(stderr, Usage);
+ fprintf(stderr, "%s", Usage);
exit(1);
}
--- a/src/arpd/arp.c
+++ b/src/arpd/arp.c
@@ -17,6 +17,7 @@
#include <netinet/in.h> /* for ntohs, etc. */
#define _LINUX_NETDEVICE_H /* very crude hack for glibc2 */
#include <linux/types.h>
+#include <linux/if.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <atm.h>
--- a/src/arpd/itf.c
+++ b/src/arpd/itf.c
@@ -14,6 +14,7 @@
#include <sys/socket.h>
#define _LINUX_NETDEVICE_H /* glibc2 */
#include <linux/types.h>
+#include <linux/if.h>
#include <linux/if_arp.h>
#include "atmd.h"
--- a/src/maint/atmdump.c
+++ b/src/maint/atmdump.c
@@ -14,6 +14,7 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
+#include <linux/sockios.h>
#include <netinet/in.h> /* for htonl and ntohl */
#include <atm.h>
--- a/src/maint/saaldump.c
+++ b/src/maint/saaldump.c
@@ -15,6 +15,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <linux/sockios.h>
#include <atm.h>
#include "pdu.h"

View File

@@ -0,0 +1,179 @@
--- a/src/qgen/Makefile.am
+++ b/src/qgen/Makefile.am
@@ -2,7 +2,7 @@ noinst_PROGRAMS = qgen
qgen_SOURCES = common.c common.h file.c file.h first.c ql_y.y ql_l.l qgen.c \
qgen.h second.c third.c
-qgen_LDADD = -lfl
+qgen_LDADD =
COMPILE = @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@
LINK = @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@ -o $@
--- a/src/qgen/Makefile.in
+++ b/src/qgen/Makefile.in
@@ -204,7 +204,7 @@ top_srcdir = @top_srcdir@
qgen_SOURCES = common.c common.h file.c file.h first.c ql_y.y ql_l.l qgen.c \
qgen.h second.c third.c
-qgen_LDADD = -lfl
+qgen_LDADD =
COMPILE = @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@
LINK = @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@ -o $@
--- a/src/sigd/Makefile.am
+++ b/src/sigd/Makefile.am
@@ -8,7 +8,7 @@ atmsigd_XTRAS = mess.o $(top_builddir)/s
$(top_builddir)/src/q2931/qd.dump.o \
$(top_builddir)/src/lib/libatm.la \
$(top_builddir)/src/saal/libsaal.a
-atmsigd_LDADD = $(atmsigd_XTRAS) -lfl
+atmsigd_LDADD = $(atmsigd_XTRAS)
atmsigd_DEPENDENCIES = mess.c $(atmsigd_XTRAS)
CLEANFILES = mess.c
--- a/src/sigd/Makefile.in
+++ b/src/sigd/Makefile.in
@@ -245,7 +245,7 @@ atmsigd_XTRAS = mess.o $(top_builddir)/s
$(top_builddir)/src/lib/libatm.la \
$(top_builddir)/src/saal/libsaal.a
-atmsigd_LDADD = $(atmsigd_XTRAS) -lfl
+atmsigd_LDADD = $(atmsigd_XTRAS)
atmsigd_DEPENDENCIES = mess.c $(atmsigd_XTRAS)
CLEANFILES = mess.c
sysconf_DATA = atmsigd.conf
--- a/src/switch/debug/debug.c
+++ b/src/switch/debug/debug.c
@@ -20,6 +20,11 @@
#define PRV(call) ((FAB *) (call)->fab)
+int yywrap(void)
+{
+ return 1;
+}
+
typedef struct _fab {
CALL *next; /* relay.c may not keep track of calls, but WE are */
--- a/src/switch/debug/Makefile.am
+++ b/src/switch/debug/Makefile.am
@@ -5,7 +5,7 @@ INCLUDES = -I$(srcdir)/../../q2931
sw_debug_SOURCES = debug.c
sw_debug_XTRAS = $(top_builddir)/src/switch/libsw.a \
$(top_builddir)/src/lib/libatm.la
-sw_debug_LDADD = $(sw_debug_XTRAS) -lfl
+sw_debug_LDADD = $(sw_debug_XTRAS)
sw_debug_DEPENDENCIES = $(sw_debug_XTRAS)
--- a/src/switch/debug/Makefile.in
+++ b/src/switch/debug/Makefile.in
@@ -200,7 +200,8 @@ sw_debug_SOURCES = debug.c
sw_debug_XTRAS = $(top_builddir)/src/switch/libsw.a \
$(top_builddir)/src/lib/libatm.la
-sw_debug_LDADD = $(sw_debug_XTRAS) -lfl
+sw_debug_LDADD = $(sw_debug_XTRAS)
+
sw_debug_DEPENDENCIES = $(sw_debug_XTRAS)
EXTRA_DIST = demo README
all: all-am
--- a/src/switch/tcp/Makefile.am
+++ b/src/switch/tcp/Makefile.am
@@ -5,7 +5,7 @@ INCLUDES = -I$(srcdir)/../../q2931
sw_tcp_SOURCES = tcpsw.c
sw_tcp_XTRAS = $(top_builddir)/src/switch/libsw.a \
$(top_builddir)/src/lib/libatm.la
-sw_tcp_LDADD = $(sw_tcp_XTRAS) -lfl
+sw_tcp_LDADD = $(sw_tcp_XTRAS)
sw_tcp_DEPENDENCIES = $(sw_tcp_XTRAS)
EXTRA_DIST = mkfiles README
--- a/src/switch/tcp/Makefile.in
+++ b/src/switch/tcp/Makefile.in
@@ -200,7 +200,7 @@ sw_tcp_SOURCES = tcpsw.c
sw_tcp_XTRAS = $(top_builddir)/src/switch/libsw.a \
$(top_builddir)/src/lib/libatm.la
-sw_tcp_LDADD = $(sw_tcp_XTRAS) -lfl
+sw_tcp_LDADD = $(sw_tcp_XTRAS)
sw_tcp_DEPENDENCIES = $(sw_tcp_XTRAS)
EXTRA_DIST = mkfiles README
all: all-am
--- a/src/switch/tcp/tcpsw.c
+++ b/src/switch/tcp/tcpsw.c
@@ -35,6 +35,10 @@
#define MAX_PACKET (ATM_MAX_AAL5_PDU+sizeof(struct atmtcp_hdr))
#define BUFFER_SIZE (MAX_PACKET*2)
+int yywrap(void)
+{
+ return 1;
+}
typedef struct _table {
struct _link *out; /* output port */
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -20,7 +20,7 @@ br_SOURCES = br.c
bw_SOURCES = bw.c
isp_SOURCES = isp.c isp.h ispl_y.y ispl_l.l
isp_XTRAS = $(LDADD)
-isp_LDADD = $(isp_XTRAS) -lfl
+isp_LDADD = $(isp_XTRAS)
isp_DEPENDENCIES = $(isp_XTRAS)
window_SOURCES = window.c
--- a/src/test/Makefile.in
+++ b/src/test/Makefile.in
@@ -283,7 +283,7 @@ br_SOURCES = br.c
bw_SOURCES = bw.c
isp_SOURCES = isp.c isp.h ispl_y.y ispl_l.l
isp_XTRAS = $(LDADD)
-isp_LDADD = $(isp_XTRAS) -lfl
+isp_LDADD = $(isp_XTRAS)
isp_DEPENDENCIES = $(isp_XTRAS)
window_SOURCES = window.c
CLEANFILES = errnos.inc
--- a/src/test/ispl_l.l
+++ b/src/test/ispl_l.l
@@ -18,6 +18,11 @@
#include "ispl_y.h"
+int yywrap(void)
+{
+ return 1;
+}
+
static int lineno = 1;
%}
--- a/src/qgen/ql_l.l
+++ b/src/qgen/ql_l.l
@@ -11,6 +11,11 @@
#include "ql_y.h"
+int yywrap(void)
+{
+ return 1;
+}
+
typedef struct _tree {
struct _tree *left,*right;
const char str[0];
--- a/src/sigd/cfg_l.l
+++ b/src/sigd/cfg_l.l
@@ -16,6 +16,10 @@
#include "cfg_y.h"
+int yywrap(void)
+{
+ return 1;
+}
static int lineno = 1;
static int token; /* f@#%ing flex doesn't grok return after BEGIN */

View File

@@ -0,0 +1,40 @@
--- a/src/extra/Makefile.am
+++ b/src/extra/Makefile.am
@@ -7,6 +7,8 @@ EXTRA_DIST = linux-atm.spec.in \
BUILT_SOURCES = pca200e.bin pca200e_ecd.bin2 sba200e_ecd.bin2
CLEANFILES = pca200e.bin pca200e_ecd.bin2 sba200e_ecd.bin2
+OBJCOPY = objcopy
+
install-exec-hook:
$(MKDIR_P) $(DESTDIR)/lib/firmware
$(INSTALL_DATA) $(srcdir)/pca200e.bin $(DESTDIR)/lib/firmware
@@ -14,7 +16,7 @@ install-exec-hook:
$(INSTALL_DATA) $(srcdir)/sba200e_ecd.bin2 $(DESTDIR)/lib/firmware
%.bin %.bin2: %.data
- objcopy -Iihex $< -Obinary $@.gz
+ $(OBJCOPY) -Iihex $< -Obinary $@.gz
gzip -n -df $@.gz
--- a/src/extra/Makefile.in
+++ b/src/extra/Makefile.in
@@ -187,6 +187,8 @@ CLEANFILES = pca200e.bin pca200e_ecd.bin
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
+OBJCOPY = objcopy
+
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
@@ -385,7 +387,7 @@ install-exec-hook:
$(INSTALL_DATA) $(srcdir)/sba200e_ecd.bin2 $(DESTDIR)/lib/firmware
%.bin %.bin2: %.data
- objcopy -Iihex $< -Obinary $@.gz
+ $(OBJCOPY) -Iihex $< -Obinary $@.gz
gzip -n -df $@.gz
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@@ -0,0 +1,70 @@
--- a/src/ilmid/io.c
+++ b/src/ilmid/io.c
@@ -48,6 +48,14 @@
be manually configured (after ilmid has
registered the "official" address) - HACK */
+#ifndef SUN_LEN
+# include <string.h> /* For prototype of `strlen'. */
+
+/* Evaluate to actual length of the `sockaddr_un' structure. */
+# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
+ + strlen ((ptr)->sun_path))
+#endif
+
extern SysGroup *remsys;
extern State ilmi_state;
static short atm_itf = -1; /* bad value */
--- a/src/mpoad/io.c
+++ b/src/mpoad/io.c
@@ -10,14 +10,7 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/param.h> /* for OPEN_MAX */
-#if __GLIBC__ >= 2
#include <sys/poll.h>
-#else /* ugly hack to make it compile on RH 4.2 - WA */
-#include <syscall.h>
-#include <linux/poll.h>
-#define SYS_poll 168
-_syscall3(int,poll,struct pollfd *,ufds,unsigned int,nfds,int,timeout);
-#endif
#include <atm.h>
#include <linux/types.h>
#include <linux/atmioc.h>
--- a/src/sigd/atmsigd.c
+++ b/src/sigd/atmsigd.c
@@ -283,12 +283,11 @@ static void setup_signals(void)
/* ------------------------------- main ... ------------------------------- */
-static void trace_on_exit(int status,void *dummy)
+static void trace_on_exit(void)
{
char path[PATH_MAX+1];
FILE *file;
- if (!status) return;
if (!dump_dir) file = stderr;
else {
sprintf(path,"atmsigd.%d.trace.exit",getpid());
@@ -517,7 +516,7 @@ int main(int argc,char **argv)
exit(0);
}
}
- (void) on_exit(trace_on_exit,NULL);
+ (void) atexit(trace_on_exit);
poll_loop();
close_all();
for (sig = entities; sig; sig = sig->next) stop_saal(&sig->saal);
--- a/src/test/align.c
+++ b/src/test/align.c
@@ -24,7 +24,7 @@
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/errno.h>
+#include <errno.h>
#include <atm.h>

View File

@@ -0,0 +1,63 @@
--- a/src/br2684/br2684ctl.c
+++ b/src/br2684/br2684ctl.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -43,6 +44,7 @@ struct br2684_params {
int lastsock, lastitf;
+static char *up_script;
void fatal(const char *str, int err)
@@ -185,6 +187,8 @@ int assign_vcc(char *astr, int encap, in
void start_interface(struct br2684_params* params)
{
+ char *cmd;
+
if (params->astr==NULL) {
syslog(LOG_ERR, "Required ATM parameters not specified.");
exit(1);
@@ -193,13 +197,18 @@ void start_interface(struct br2684_param
create_br(params->itfnum, params->payload);
assign_vcc(params->astr, params->encap, params->payload, params->sndbuf,
params->reqqos);
+ if (up_script) {
+ asprintf(&cmd, "%s nas%d", up_script, lastitf);
+ system(cmd);
+ free(cmd);
+ }
}
void usage(char *s)
{
printf("usage: %s [-b] [[-c number] [-e 0|1] [-s sndbuf] [-q qos] [-p 0|1] "
- "[-a [itf.]vpi.vci]*]*\n", s);
+ "[-a [itf.]vpi.vci]*]* [-S script]\n", s);
printf(" encapsulations: 0=llc, 1=vcmux\n payloads: 0=routed, 1=bridged\n");
exit(1);
}
@@ -225,7 +234,7 @@ int main (int argc, char **argv)
openlog (LOG_NAME,LOG_OPTION,LOG_FACILITY);
if (argc>1)
- while ((c = getopt(argc, argv,"q:a:bc:e:s:p:?h")) !=EOF)
+ while ((c = getopt(argc, argv,"q:a:bc:e:s:S:p:?h")) !=EOF)
switch (c) {
case 'q':
printf ("optarg : %s",optarg);
@@ -258,6 +267,9 @@ int main (int argc, char **argv)
params.sndbuf=8192;
}
break;
+ case 'S':
+ up_script = optarg;
+ break;
case 'p': /* payload type: routed (0) or bridged (1) */
#ifdef BR2684_FLAG_ROUTED
params.payload = atoi(optarg);

View File

@@ -0,0 +1,74 @@
--- a/src/br2684/br2684ctl.c
+++ b/src/br2684/br2684ctl.c
@@ -45,6 +45,7 @@ struct br2684_params {
int lastsock, lastitf;
static char *up_script;
+const char *itfname = "nas";
void fatal(const char *str, int err)
@@ -73,7 +74,7 @@ int create_pidfile(int num)
if (num < 0) return -1;
- snprintf(name, 32, "/var/run/br2684ctl-nas%d.pid", num);
+ snprintf(name, 32, "/var/run/br2684ctl-%s%d.pid", itfname, num);
pidfile = fopen(name, "w");
if (pidfile == NULL) return -1;
fprintf(pidfile, "%d", getpid());
@@ -102,7 +103,7 @@ int create_br(int itfnum, int payload)
ni.media |= BR2684_FLAG_ROUTED;
#endif
ni.mtu = 1500;
- sprintf(ni.ifname, "nas%d", itfnum);
+ sprintf(ni.ifname, "%s%d", itfname, itfnum);
err=ioctl (lastsock, ATM_NEWBACKENDIF, &ni);
if (err == 0)
@@ -167,7 +168,7 @@ int assign_vcc(char *astr, int encap, in
be.backend_num = ATM_BACKEND_BR2684;
be.ifspec.method = BR2684_FIND_BYIFNAME;
- sprintf(be.ifspec.spec.ifname, "nas%d", lastitf);
+ sprintf(be.ifspec.spec.ifname, "%s%d", itfname, lastitf);
be.fcs_in = BR2684_FCSIN_NO;
be.fcs_out = BR2684_FCSOUT_NO;
be.fcs_auto = 0;
@@ -198,7 +199,7 @@ void start_interface(struct br2684_param
assign_vcc(params->astr, params->encap, params->payload, params->sndbuf,
params->reqqos);
if (up_script) {
- asprintf(&cmd, "%s nas%d", up_script, lastitf);
+ asprintf(&cmd, "%s %s%d", up_script, itfname, lastitf);
system(cmd);
free(cmd);
}
@@ -207,7 +208,7 @@ void start_interface(struct br2684_param
void usage(char *s)
{
- printf("usage: %s [-b] [[-c number] [-e 0|1] [-s sndbuf] [-q qos] [-p 0|1] "
+ printf("usage: %s [-b] [-n name] [[-c number] [-e 0|1] [-s sndbuf] [-q qos] [-p 0|1] "
"[-a [itf.]vpi.vci]*]* [-S script]\n", s);
printf(" encapsulations: 0=llc, 1=vcmux\n payloads: 0=routed, 1=bridged\n");
exit(1);
@@ -234,7 +235,7 @@ int main (int argc, char **argv)
openlog (LOG_NAME,LOG_OPTION,LOG_FACILITY);
if (argc>1)
- while ((c = getopt(argc, argv,"q:a:bc:e:s:S:p:?h")) !=EOF)
+ while ((c = getopt(argc, argv,"q:a:bn:c:e:s:S:p:?h")) !=EOF)
switch (c) {
case 'q':
printf ("optarg : %s",optarg);
@@ -247,6 +248,9 @@ int main (int argc, char **argv)
case 'b':
background=1;
break;
+ case 'n':
+ itfname = optarg;
+ break;
case 'c':
/* temporary, to make it work with multiple interfaces: */
if (params.itfnum>=0) start_interface(&params);

View File

@@ -0,0 +1,52 @@
This fixes the following compile problem with kernel 4.20:
In file included from arp.c:20:0:
include/linux/if_arp.h:121:16: error: 'IFNAMSIZ' undeclared here (not in a function)
char arp_dev[IFNAMSIZ];
^~~~~~~~
make[7]: *** [Makefile:459: arp.o] Error 1
This is caused by commit 6a12709da354 ("net: if_arp: use define instead
of hard-coded value") in the upstream Linux kernel which is integrated
in Linux 4.20.
--- a/src/oamd/io.c
+++ b/src/oamd/io.c
@@ -20,7 +20,6 @@
#include <net/if.h>
#include <netinet/in.h>
#include <atm.h>
-#define _LINUX_NETDEVICE_H /* glibc2 */
#include <linux/types.h>
#include <linux/if_arp.h>
--- a/src/arpd/itf.c
+++ b/src/arpd/itf.c
@@ -12,7 +12,6 @@
#include <sys/types.h>
#include <linux/atmclip.h>
#include <sys/socket.h>
-#define _LINUX_NETDEVICE_H /* glibc2 */
#include <linux/types.h>
#include <linux/if.h>
#include <linux/if_arp.h>
--- a/src/arpd/io.c
+++ b/src/arpd/io.c
@@ -21,7 +21,6 @@
#include <atm.h>
#include <linux/atmclip.h> /* for CLIP_DEFAULT_IDLETIMER */
#include <linux/atmarp.h>
-#define _LINUX_NETDEVICE_H /* glibc2 */
#include <linux/types.h>
#include <linux/if_arp.h>
--- a/src/arpd/arp.c
+++ b/src/arpd/arp.c
@@ -15,7 +15,6 @@
#include <sys/types.h>
#include <sys/socket.h> /* for linux/if_arp.h */
#include <netinet/in.h> /* for ntohs, etc. */
-#define _LINUX_NETDEVICE_H /* very crude hack for glibc2 */
#include <linux/types.h>
#include <linux/if.h>
#include <linux/if_arp.h>

View File

@@ -0,0 +1,30 @@
--- a/src/include/atmd.h
+++ b/src/include/atmd.h
@@ -10,6 +10,7 @@
#include <stdint.h>
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
--- a/src/lib/unix.c
+++ b/src/lib/unix.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
--- a/src/sigd/kernel.c
+++ b/src/sigd/kernel.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include <assert.h>

View File

@@ -0,0 +1,82 @@
--- a/src/arpd/io.c
+++ b/src/arpd/io.c
@@ -615,7 +615,7 @@ int ip_itf_info(int number,uint32_t *ip,
int get_local(int fd,struct sockaddr_atmsvc *addr)
{
int result;
- size_t length;
+ socklen_t length;
length = sizeof(struct sockaddr_atmsvc);
result = getsockname(fd,(struct sockaddr *) addr,&length);
--- a/src/led/conn.c
+++ b/src/led/conn.c
@@ -405,7 +405,7 @@ Conn_t *accept_conn(Conn_t *conn)
{
Conn_t *new;
struct sockaddr_atmsvc addr;
- size_t len;
+ socklen_t len;
int fd;
char buff[MAX_ATM_ADDR_LEN+1];
@@ -538,7 +538,7 @@ static int handle_accept(Conn_t *conn)
*/
static int handle_data(Conn_t *conn)
{
- char buff[MAX_CTRL_FRAME];
+ unsigned char buff[MAX_CTRL_FRAME];
int retval;
retval = recv_frame(conn, buff, sizeof(buff));
--- a/src/led/frames.c
+++ b/src/led/frames.c
@@ -312,7 +312,7 @@ static void handle_ready_ind(Conn_t *con
* dependant handler functions.
* Returns < 0 for serious error
*/
-int handle_frame(Conn_t *conn, char *buff, int size)
+int handle_frame(Conn_t *conn, unsigned char *buff, int size)
{
struct ctrl_frame *frame;
--- a/src/led/frames.h
+++ b/src/led/frames.h
@@ -13,7 +13,7 @@ int validate_frame(unsigned char *buff,
void send_ready_ind(Conn_t *conn);
void send_register_req(void);
-int handle_frame(Conn_t *conn, char *buff, int size);
+int handle_frame(Conn_t *conn, unsigned char *buff, int size);
uint32_t send_flush_req(Conn_t *conn);
void parse_tlvs(uint16_t opcode, unsigned char *tlvp, int numtlvs, int sizeoftlvs);
--- a/src/led/join.c
+++ b/src/led/join.c
@@ -43,7 +43,7 @@ static int read_join_rsp(char *buff, int
static int parse_join_rsp(unsigned char *buff, int size);
static int get_bus_addr(struct sockaddr_atmsvc *addr);
-static int read_bus_arp(Conn_t *conn, struct sockaddr_atmsvc *addr, char *buff, int buffsize);
+static int read_bus_arp(Conn_t *conn, struct sockaddr_atmsvc *addr, unsigned char *buff, int buffsize);
/*
* 5.1, Initial state
@@ -693,7 +693,7 @@ static int get_bus_addr(struct sockaddr_
fd_set rfds;
struct timeval tv;
int n = 0, retval, timeout;
- char buff[MAX_CTRL_FRAME];
+ unsigned char buff[MAX_CTRL_FRAME];
timeout = 4; /* wait response for 4 seconds */
lec_params.c7c_current_timeout = 1;
@@ -740,7 +740,7 @@ static int get_bus_addr(struct sockaddr_
* Tries to read BUS ATM address in *addr
* returns < 0 for error, 0 for not found > 0 for success
*/
-static int read_bus_arp(Conn_t *conn, struct sockaddr_atmsvc *addr, char *buff, int buffsize)
+static int read_bus_arp(Conn_t *conn, struct sockaddr_atmsvc *addr, unsigned char *buff, int buffsize)
{
int frame_size;
struct ctrl_frame *frame;