add samples and IPX service configuration

This commit is contained in:
Mario Fetka
2026-04-30 19:40:14 +02:00
parent 3c718bbabf
commit 75a16f53f4
20 changed files with 1836 additions and 110 deletions

12
.gitignore vendored
View File

@@ -57,3 +57,15 @@
/ipx-utils-*.tar.bz2
/ipx-utils-*.zip
/ipx-utils-*/
# generated config helper outputs
/conf/ipx
/conf/ipx.service
/conf/network-start.sh
/conf/network-stop.sh
# sample binaries
/samples/ipxrcv
/samples/ipxsend
/samples/rip
/samples/sap

View File

@@ -1,16 +1,11 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = po src tools ipxripd
SUBDIRS = po src tools samples ipxripd conf
EXTRA_DIST = \
autogen.sh \
scripts/config.ipx \
scripts/init.ipx \
Samples/ipxrcv.c \
Samples/ipxsend.c \
Samples/rip.c \
Samples/sap.c \
Samples/samples.h
scripts/init.ipx
DISTCLEANFILES = \
po/stamp-po

View File

@@ -1,95 +0,0 @@
#include "samples.h"
struct sap_data
{
uint16_t sap_type;
char sap_name[48];
uint32_t sap_net;
uint8_t sap_node[6];
uint16_t sap_sock;
uint16_t sap_hops;
} __attribute__ ((packed));
int main(int argc, char **argv)
{
int s;
int result;
struct sockaddr_ipx sipx;
char msg[1024];
long val = 0;
char *bptr;
struct sap_data *sp;
s = socket(AF_IPX, SOCK_DGRAM, AF_IPX);
if (s < 0)
{
perror("IPX: socket: ");
exit(-1);
}
result = setsockopt(s, SOL_SOCKET, SO_DEBUG, &val, 4);
if (result < 0)
{
perror("IPX: setsockopt: ");
exit(-1);
}
sipx.sipx_family = PF_IPX;
sipx.sipx_network = 0L;
sipx.sipx_port = htons(0x452);
sipx.sipx_type = 17;
result = bind(s, (struct sockaddr *) &sipx, sizeof(sipx));
if (result < 0)
{
perror("IPX: bind: ");
exit(-1);
}
while (1)
{
socklen_t len;
size_t rclen;
len = 1024;
result = recvfrom(s, msg, sizeof(msg), 0,
(struct sockaddr *) &sipx, &len);
if (result < 0)
{
perror("IPX: recvfrom: ");
exit(-1);
}
if (result < 2) {
fprintf(stderr, "Received packet is too short to be SAP packet (%d bytes)\n", result);
continue;
}
rclen = result - 2;
bptr = msg;
printf("SAP: OP is %x %x\n", bptr[0], bptr[1]);
printf("Length is %zu\n", rclen);
if (bptr[1] != 2)
continue;
bptr += 2;
sp = (struct sap_data *) bptr;
while (rclen >= sizeof(struct sap_data))
{
int i;
sp->sap_name[32] = '\0';
for (i = 31; (i > 0) && (sp->sap_name[i] == '_'); i--);
i++;
sp->sap_name[i] = '\0';
printf("NAME: %s TYPE: %x HOPS: %x\n", sp->sap_name,
ntohs(sp->sap_type), ntohs(sp->sap_hops));
printf("%x:%x %x %x %x %x %x: %x\n",
(u_int32_t)ntohl(sp->sap_net),
sp->sap_node[0],
sp->sap_node[1],
sp->sap_node[2],
sp->sap_node[3],
sp->sap_node[4],
sp->sap_node[5],
ntohs(sp->sap_sock));
rclen -= sizeof(struct sap_data);
sp++;
}
}
}

43
conf/Makefile.am Normal file
View File

@@ -0,0 +1,43 @@
ipxlibexecdir = $(libexecdir)/ipx
confd_dir = $(sysconfdir)/conf.d
edit = sed \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@libexecdir[@]|$(libexecdir)|g' \
-e 's|@ipxlibexecdir[@]|$(ipxlibexecdir)|g' \
-e 's|@systemdsystemunitdir[@]|$(systemdsystemunitdir)|g'
ipxlibexec_SCRIPTS = \
network-start.sh \
network-stop.sh
confd__DATA = ipx
if ENABLE_SYSTEMD
systemdsystemunit_DATA = ipx.service
endif
network-start.sh: network-start.sh.in Makefile
$(AM_V_GEN)$(edit) $(srcdir)/network-start.sh.in > $@ && chmod +x $@
network-stop.sh: network-stop.sh.in Makefile
$(AM_V_GEN)$(edit) $(srcdir)/network-stop.sh.in > $@ && chmod +x $@
ipx.service: ipx.service.in Makefile
$(AM_V_GEN)$(edit) $(srcdir)/ipx.service.in > $@
ipx: ipx.confd.in Makefile
$(AM_V_GEN)$(edit) $(srcdir)/ipx.confd.in > $@
EXTRA_DIST = \
network-start.sh.in \
network-stop.sh.in \
ipx.service.in \
ipx.confd.in
CLEANFILES = \
network-start.sh \
network-stop.sh \
ipx.service \
ipx

600
conf/Makefile.in Normal file
View File

@@ -0,0 +1,600 @@
# Makefile.in generated by automake 1.18.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = conf
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
}
am__installdirs = "$(DESTDIR)$(ipxlibexecdir)" \
"$(DESTDIR)$(confd_dir)" "$(DESTDIR)$(systemdsystemunitdir)"
SCRIPTS = $(ipxlibexec_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DATA = $(confd__DATA) $(systemdsystemunit_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemunitdir = @systemdsystemunitdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ipxlibexecdir = $(libexecdir)/ipx
confd_dir = $(sysconfdir)/conf.d
edit = sed \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@libexecdir[@]|$(libexecdir)|g' \
-e 's|@ipxlibexecdir[@]|$(ipxlibexecdir)|g' \
-e 's|@systemdsystemunitdir[@]|$(systemdsystemunitdir)|g'
ipxlibexec_SCRIPTS = \
network-start.sh \
network-stop.sh
confd__DATA = ipx
@ENABLE_SYSTEMD_TRUE@systemdsystemunit_DATA = ipx.service
EXTRA_DIST = \
network-start.sh.in \
network-stop.sh.in \
ipx.service.in \
ipx.confd.in
CLEANFILES = \
network-start.sh \
network-stop.sh \
ipx.service \
ipx
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign conf/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign conf/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-ipxlibexecSCRIPTS: $(ipxlibexec_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(ipxlibexec_SCRIPTS)'; test -n "$(ipxlibexecdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(ipxlibexecdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(ipxlibexecdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n' \
-e 'h;s|.*|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
if (++n[d] == $(am__install_max)) { \
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
else { print "f", d "/" $$4, $$1 } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(ipxlibexecdir)$$dir'"; \
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(ipxlibexecdir)$$dir" || exit $$?; \
} \
; done
uninstall-ipxlibexecSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(ipxlibexec_SCRIPTS)'; test -n "$(ipxlibexecdir)" || exit 0; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 's,.*/,,;$(transform)'`; \
dir='$(DESTDIR)$(ipxlibexecdir)'; $(am__uninstall_files_from_dir)
install-confd_DATA: $(confd__DATA)
@$(NORMAL_INSTALL)
@list='$(confd__DATA)'; test -n "$(confd_dir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(confd_dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(confd_dir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(confd_dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(confd_dir)" || exit $$?; \
done
uninstall-confd_DATA:
@$(NORMAL_UNINSTALL)
@list='$(confd__DATA)'; test -n "$(confd_dir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(confd_dir)'; $(am__uninstall_files_from_dir)
install-systemdsystemunitDATA: $(systemdsystemunit_DATA)
@$(NORMAL_INSTALL)
@list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemunitdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(systemdsystemunitdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemdsystemunitdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(systemdsystemunitdir)" || exit $$?; \
done
uninstall-systemdsystemunitDATA:
@$(NORMAL_UNINSTALL)
@list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(systemdsystemunitdir)'; $(am__uninstall_files_from_dir)
tags TAGS:
ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(SCRIPTS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(ipxlibexecdir)" "$(DESTDIR)$(confd_dir)" "$(DESTDIR)$(systemdsystemunitdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-$(am__rm_f) $(CLEANFILES)
distclean-generic:
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-confd_DATA install-systemdsystemunitDATA
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-ipxlibexecSCRIPTS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-confd_DATA uninstall-ipxlibexecSCRIPTS \
uninstall-systemdsystemunitDATA
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
ctags-am distclean distclean-generic distdir dvi dvi-am html \
html-am info info-am install install-am install-confd_DATA \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-ipxlibexecSCRIPTS \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip install-systemdsystemunitDATA \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags-am uninstall uninstall-am \
uninstall-confd_DATA uninstall-ipxlibexecSCRIPTS \
uninstall-systemdsystemunitDATA
.PRECIOUS: Makefile
network-start.sh: network-start.sh.in Makefile
$(AM_V_GEN)$(edit) $(srcdir)/network-start.sh.in > $@ && chmod +x $@
network-stop.sh: network-stop.sh.in Makefile
$(AM_V_GEN)$(edit) $(srcdir)/network-stop.sh.in > $@ && chmod +x $@
ipx.service: ipx.service.in Makefile
$(AM_V_GEN)$(edit) $(srcdir)/ipx.service.in > $@
ipx: ipx.confd.in Makefile
$(AM_V_GEN)$(edit) $(srcdir)/ipx.confd.in > $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%

140
conf/ipx.confd.in Normal file
View File

@@ -0,0 +1,140 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Configuration for the IPX network startup helpers.
#
# This file is used by:
# - /etc/init.d/ipx
# - @ipxlibexecdir@/network-start.sh
# - @ipxlibexecdir@/network-stop.sh
# - /etc/systemd/system/ipx.service
#
# Manual interface configuration:
# IPX_INTERFACES contains one entry per line.
#
# Format:
# <device>:<frame>:<netnum>
#
# Example:
# IPX_INTERFACES="
# enp0s31f6:802.2:1
# enp46s0u1u3u3:802.2:2
# wlp0s20f3:802.2:3
# "
#
# Behaviour:
# - The first successfully configured interface becomes the primary IPX
# interface.
# - Additional interfaces are configured as non-primary interfaces.
# - Each manually configured interface should use its own IPX network
# number.
# - Interfaces that are not currently present are skipped with a warning.
# - This is useful for optional hardware such as a docking station NIC.
#
# Link-state handling:
# If IPX_SKIP_LINK_DOWN=yes, interfaces that exist but currently do not
# have an active link are skipped as well.
#
# This is useful for cases such as:
# - a docking station NIC that exists but currently has no link
# - a physical Ethernet device with no cable attached
#
# Detection order:
# 1. /sys/class/net/<if>/carrier
# 2. /sys/class/net/<if>/operstate
#
# Example with an optional docking station interface:
# IPX_INTERFACES="
# enp46s0u1u3u3:802.2:1
# enp0s31f6:802.2:2
# wlp0s20f3:802.2:3
# "
#
# In that example:
# - if enp46s0u1u3u3 is present and usable, it will be configured first
# and become the primary IPX interface
# - if enp46s0u1u3u3 is missing, it will be skipped
# - if enp46s0u1u3u3 exists but has no active link and
# IPX_SKIP_LINK_DOWN=yes, it will also be skipped
# - the next successfully configured interface will become primary
#
# Static route configuration:
# IPX_ROUTES contains one entry per line.
#
# Format:
# <target_network>:<router_network>:<router_node>
#
# Example:
# IPX_ROUTES="
# 00000010:00000001:508140F6AC45
# 00000020:00000003:44E517C3D034
# "
#
# Route behaviour:
# - Routes are added after all interfaces have been configured
# - During shutdown, routes are removed again by target network
# - Empty lines and comment lines starting with '#' are ignored
#
# Automatic configuration:
# IPX_AUTO_PRIMARY and IPX_AUTO_INTERFACE are passed to ipx_configure.
#
# Recommended setting for manual interface definitions:
# - IPX_AUTO_INTERFACE=off
#
# This avoids mixing manual interface definitions with automatically created
# IPX interfaces.
#
# Internal network mode:
# If IPX_INTERNAL_NET=yes, no physical interfaces from IPX_INTERFACES are
# configured.
#
# Instead, an IPX internal network is created using IPX_NETNUM and
# IPX_NODENUM.
#
# The internal network does not use a physical device or frame type and
# automatically becomes the primary IPX interface.
#
# There can only be one internal network per host.
# Automatically select a primary IPX interface.
IPX_AUTO_PRIMARY=on
# Automatically create IPX interfaces.
# Recommended: off when using IPX_INTERFACES.
IPX_AUTO_INTERFACE=off
# Skip interfaces that are present but currently have no active link.
# Valid values: yes / no
IPX_SKIP_LINK_DOWN=yes
# Create a special internal IPX network instead of binding to physical NICs.
# Valid values: yes / no
IPX_INTERNAL_NET=no
# IPX network number for internal network mode only.
IPX_NETNUM=1
# IPX node number for internal network mode only.
IPX_NODENUM=1
# Manually configured IPX interfaces.
# Format: <device>:<frame>:<netnum>
#
# The first successfully configured interface becomes primary.
# Missing interfaces are skipped.
IPX_INTERFACES="
enp46s0u1u3u3:802.2:1
enp0s31f6:802.2:2
wlp0s20f3:802.2:3
"
# Static IPX routes.
# Format: <target_network>:<router_network>:<router_node>
#
# Example:
# IPX_ROUTES="
# 00000010:00000001:508140F6AC45
# 00000020:00000003:44E517C3D034
# "
IPX_ROUTES="
"

16
conf/ipx.service.in Normal file
View File

@@ -0,0 +1,16 @@
[Unit]
Description=IPX network setup
Documentation=man:systemd.service(5)
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=@sysconfdir@/conf.d/ipx
ExecStart=@ipxlibexecdir@/network-start.sh
ExecStop=@ipxlibexecdir@/network-stop.sh
ExecStopPost=@ipxlibexecdir@/network-stop.sh
[Install]
WantedBy=multi-user.target

176
conf/network-start.sh.in Normal file
View File

@@ -0,0 +1,176 @@
#!/bin/sh
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# IPX start helper for systemd and OpenRC.
#
# This script reads its configuration from environment variables, typically
# provided through /etc/conf.d/ipx.
#
# Manual interface format:
# <device>:<frame>:<netnum>
#
# Static route format:
# <target_network>:<router_network>:<router_node>
#
# Behaviour:
# - The first successfully configured interface becomes the primary IPX
# interface.
# - Missing interfaces are skipped.
# - Optionally, interfaces with no active link can also be skipped.
# - Static routes are added after interface configuration.
set -u
configured=0
retval=0
primary_set=0
log_warn() {
printf '%s\n' "ipx: $*" >&2
}
log_err() {
printf '%s\n' "ipx: $*" >&2
}
link_is_usable() {
local dev carrier_file operstate_file state
dev=$1
carrier_file="/sys/class/net/${dev}/carrier"
operstate_file="/sys/class/net/${dev}/operstate"
if [ "${IPX_SKIP_LINK_DOWN:-no}" != "yes" ]; then
return 0
fi
if [ -r "${carrier_file}" ]; then
state=$(cat "${carrier_file}")
if [ "${state}" = "0" ]; then
log_warn "interface ${dev} has no carrier, skipping"
return 1
fi
return 0
fi
if [ -r "${operstate_file}" ]; then
state=$(cat "${operstate_file}")
case "${state}" in
down)
log_warn "interface ${dev} is link-down, skipping"
return 1
;;
esac
fi
return 0
}
if [ "${IPX_INTERNAL_NET:-no}" = "yes" ]; then
if ! @sbindir@/ipx_internal_net add "${IPX_NETNUM}" "${IPX_NODENUM}"; then
log_err "failed to create internal IPX network"
retval=1
fi
else
oldifs=${IFS}
IFS='
'
for entry in ${IPX_INTERFACES:-}; do
[ -n "${entry}" ] || continue
case "${entry}" in
\#*)
continue
;;
esac
dev=${entry%%:*}
rest=${entry#*:}
frame=${rest%%:*}
netnum=${rest#*:}
if [ -z "${dev}" ] || [ -z "${frame}" ] || [ -z "${netnum}" ] || [ "${rest}" = "${entry}" ]; then
log_err "invalid IPX_INTERFACES entry: ${entry}"
retval=1
break
fi
if [ ! -d "/sys/class/net/${dev}" ]; then
log_warn "interface ${dev} is not present, skipping"
continue
fi
if ! link_is_usable "${dev}"; then
continue
fi
if [ "${primary_set}" -eq 0 ]; then
if @sbindir@/ipx_interface add -p "${dev}" "${frame}" "${netnum}"; then
configured=1
primary_set=1
else
log_err "failed to add primary IPX interface on ${dev}"
retval=1
fi
else
if @sbindir@/ipx_interface add "${dev}" "${frame}" "${netnum}"; then
configured=1
else
log_err "failed to add IPX interface on ${dev}"
retval=1
fi
fi
done
IFS=${oldifs}
if [ "${configured}" -eq 0 ] && [ "${retval}" -eq 0 ]; then
log_warn "no configured IPX interfaces were present"
fi
fi
if [ "${retval}" -eq 0 ]; then
oldifs=${IFS}
IFS='
'
for entry in ${IPX_ROUTES:-}; do
[ -n "${entry}" ] || continue
case "${entry}" in
\#*)
continue
;;
esac
target=${entry%%:*}
rest=${entry#*:}
router_net=${rest%%:*}
router_node=${rest#*:}
if [ -z "${target}" ] || [ -z "${router_net}" ] || [ -z "${router_node}" ] || [ "${rest}" = "${entry}" ]; then
log_err "invalid IPX_ROUTES entry: ${entry}"
retval=1
break
fi
if ! @sbindir@/ipx_route add "${target}" "${router_net}" "${router_node}"; then
log_err "failed to add IPX route to ${target}"
retval=1
fi
done
IFS=${oldifs}
fi
if ! @sbindir@/ipx_configure \
--auto_primary="${IPX_AUTO_PRIMARY}" \
--auto_interface="${IPX_AUTO_INTERFACE}"; then
log_err "failed to apply automatic IPX configuration"
retval=1
fi
if [ "${retval}" -ne 0 ]; then
log_warn "startup failed, cleaning up partial IPX configuration"
@ipxlibexecdir@/network-stop.sh || true
fi
exit "${retval}"

50
conf/network-stop.sh.in Normal file
View File

@@ -0,0 +1,50 @@
#!/bin/sh
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# IPX stop helper for systemd and OpenRC.
#
# This script disables automatic IPX behaviour, removes configured static
# routes, removes all configured IPX interfaces and deletes the internal IPX
# network if present.
set -u
retval=0
oldifs=${IFS}
IFS='
'
for entry in ${IPX_ROUTES:-}; do
[ -n "${entry}" ] || continue
case "${entry}" in
\#*)
continue
;;
esac
target=${entry%%:*}
if ! @sbindir@/ipx_route del "${target}"; then
printf '%s\n' "ipx: failed to remove route to ${target}" >&2
retval=1
fi
done
IFS=${oldifs}
if ! @sbindir@/ipx_configure --auto_primary=off --auto_interface=off; then
printf '%s\n' "ipx: failed to disable automatic IPX configuration" >&2
retval=1
fi
if ! @sbindir@/ipx_interface delall; then
printf '%s\n' "ipx: failed to remove IPX interfaces" >&2
retval=1
fi
if ! @sbindir@/ipx_internal_net del; then
:
fi
exit "${retval}"

View File

@@ -15,11 +15,26 @@ AC_CHECK_FUNCS([gettext bindtextdomain textdomain])
AC_DEFINE_UNQUOTED([LOCALEDIR], ["${datadir}/locale"], [Define location of message catalogs])
AC_ARG_WITH([systemdsystemunitdir],
[AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
[systemd system unit directory; use "no" to disable systemd unit installation])],
[systemdsystemunitdir="${withval}"],
[systemdsystemunitdir='${prefix}/lib/systemd/system'])
AS_IF([test "x${systemdsystemunitdir}" = "xno"],
[systemdsystemunitdir=''])
AC_SUBST([systemdsystemunitdir])
AM_CONDITIONAL([ENABLE_SYSTEMD], [test "x${systemdsystemunitdir}" != "x"])
AC_CONFIG_FILES([
Makefile
src/Makefile
tools/Makefile
ipxripd/Makefile
conf/Makefile
samples/Makefile
po/Makefile.in
])
AC_OUTPUT

View File

@@ -319,6 +319,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemunitdir = @systemdsystemunitdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@

24
samples/Makefile.am Normal file
View File

@@ -0,0 +1,24 @@
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = -Wall -Wextra
noinst_PROGRAMS = \
ipxrcv \
ipxsend \
rip \
sap
ipxrcv_SOURCES = \
ipxrcv.c \
samples.h
ipxsend_SOURCES = \
ipxsend.c \
samples.h
rip_SOURCES = \
rip.c \
samples.h
sap_SOURCES = \
sap.c \
samples.h

624
samples/Makefile.in Normal file
View File

@@ -0,0 +1,624 @@
# Makefile.in generated by automake 1.18.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
noinst_PROGRAMS = ipxrcv$(EXEEXT) ipxsend$(EXEEXT) rip$(EXEEXT) \
sap$(EXEEXT)
subdir = samples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_ipxrcv_OBJECTS = ipxrcv.$(OBJEXT)
ipxrcv_OBJECTS = $(am_ipxrcv_OBJECTS)
ipxrcv_LDADD = $(LDADD)
am_ipxsend_OBJECTS = ipxsend.$(OBJEXT)
ipxsend_OBJECTS = $(am_ipxsend_OBJECTS)
ipxsend_LDADD = $(LDADD)
am_rip_OBJECTS = rip.$(OBJEXT)
rip_OBJECTS = $(am_rip_OBJECTS)
rip_LDADD = $(LDADD)
am_sap_OBJECTS = sap.$(OBJEXT)
sap_OBJECTS = $(am_sap_OBJECTS)
sap_LDADD = $(LDADD)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/ipxrcv.Po ./$(DEPDIR)/ipxsend.Po \
./$(DEPDIR)/rip.Po ./$(DEPDIR)/sap.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(ipxrcv_SOURCES) $(ipxsend_SOURCES) $(rip_SOURCES) \
$(sap_SOURCES)
DIST_SOURCES = $(ipxrcv_SOURCES) $(ipxsend_SOURCES) $(rip_SOURCES) \
$(sap_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemunitdir = @systemdsystemunitdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = -Wall -Wextra
ipxrcv_SOURCES = \
ipxrcv.c \
samples.h
ipxsend_SOURCES = \
ipxsend.c \
samples.h
rip_SOURCES = \
rip.c \
samples.h
sap_SOURCES = \
sap.c \
samples.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign samples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign samples/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
-$(am__rm_f) $(noinst_PROGRAMS)
ipxrcv$(EXEEXT): $(ipxrcv_OBJECTS) $(ipxrcv_DEPENDENCIES) $(EXTRA_ipxrcv_DEPENDENCIES)
@rm -f ipxrcv$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(ipxrcv_OBJECTS) $(ipxrcv_LDADD) $(LIBS)
ipxsend$(EXEEXT): $(ipxsend_OBJECTS) $(ipxsend_DEPENDENCIES) $(EXTRA_ipxsend_DEPENDENCIES)
@rm -f ipxsend$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(ipxsend_OBJECTS) $(ipxsend_LDADD) $(LIBS)
rip$(EXEEXT): $(rip_OBJECTS) $(rip_DEPENDENCIES) $(EXTRA_rip_DEPENDENCIES)
@rm -f rip$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(rip_OBJECTS) $(rip_LDADD) $(LIBS)
sap$(EXEEXT): $(sap_OBJECTS) $(sap_DEPENDENCIES) $(EXTRA_sap_DEPENDENCIES)
@rm -f sap$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sap_OBJECTS) $(sap_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipxrcv.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipxsend.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rip.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sap.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@: >>$@
am--depfiles: $(am__depfiles_remade)
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/ipxrcv.Po
-rm -f ./$(DEPDIR)/ipxsend.Po
-rm -f ./$(DEPDIR)/rip.Po
-rm -f ./$(DEPDIR)/sap.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/ipxrcv.Po
-rm -f ./$(DEPDIR)/ipxsend.Po
-rm -f ./$(DEPDIR)/rip.Po
-rm -f ./$(DEPDIR)/sap.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-noinstPROGRAMS cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%

View File

@@ -2,9 +2,11 @@
int main(int argc, char **argv)
{
(void)argc;
(void)argv;
struct sockaddr_ipx sipx;
int s;
int rct;
int rc;
char msg[100];
socklen_t len;
@@ -32,7 +34,7 @@ int main(int argc, char **argv)
{
perror("IPX: recvfrom: ");
}
printf("From %08X:%02X%02X%02X%02X%02X%02X:%04X\n",
printf("From %08lX:%02X%02X%02X%02X%02X%02X:%04X\n",
(unsigned long)ntohl(sipx.sipx_network),
sipx.sipx_node[0], sipx.sipx_node[1],
sipx.sipx_node[2], sipx.sipx_node[3],

View File

@@ -2,6 +2,8 @@
int main(int argc, char **argv)
{
(void)argc;
(void)argv;
struct sockaddr_ipx sipx;
int s;
int rc;

View File

@@ -16,22 +16,28 @@ int main(int argc, char **argv)
char *bptr;
struct rip_data *rp;
(void)argc;
(void)argv;
s = socket(AF_IPX, SOCK_DGRAM, AF_IPX);
if (s < 0)
{
perror("IPX: socket: ");
exit(-1);
}
sipx.sipx_family = AF_IPX;
sipx.sipx_network = 0;
sipx.sipx_port = htons(0x453);
sipx.sipx_type = 17;
result = bind(s, (struct sockaddr *) &sipx, sizeof(sipx));
if (result < 0)
{
perror("IPX: bind: ");
exit(-1);
}
while (1)
{
socklen_t len;
@@ -45,22 +51,31 @@ int main(int argc, char **argv)
perror("IPX: recvfrom");
exit(-1);
}
if (result < 2) {
fprintf(stderr, "Received packet is too short to be RIP packet (%d bytes)\n", result);
if (result < 2)
{
fprintf(stderr,
"Received packet is too short to be RIP packet (%d bytes)\n",
result);
continue;
}
rclen = result - 2;
rclen = (size_t)result - 2;
bptr = msg;
printf("RIP packet from: %08X:%02X%02X%02X%02X%02X%02X\n",
(u_int32_t)htonl(sipx.sipx_network),
(uint32_t)ntohl(sipx.sipx_network),
sipx.sipx_node[0], sipx.sipx_node[1],
sipx.sipx_node[2], sipx.sipx_node[3],
sipx.sipx_node[6], sipx.sipx_node[5]);
sipx.sipx_node[4], sipx.sipx_node[5]);
bptr += 2;
rp = (struct rip_data *) bptr;
while (rclen >= sizeof(struct rip_data))
{
printf("\tNET: %08X HOPS: %d\n", (u_int32_t)ntohl(rp->rip_net),
printf("\tNET: %08X HOPS: %d\n",
(uint32_t)ntohl(rp->rip_net),
ntohs(rp->rip_hops));
rclen -= sizeof(struct rip_data);
rp++;

104
samples/sap.c Normal file
View File

@@ -0,0 +1,104 @@
#include "samples.h"
struct sap_data
{
uint16_t sap_type;
char sap_name[48];
uint32_t sap_net;
unsigned char sap_node[6];
uint16_t sap_sock;
uint16_t sap_hops;
} __attribute__ ((packed));
int main(int argc, char **argv)
{
struct sockaddr_ipx sipx;
int result;
int s;
char msg[1024];
char *bptr;
struct sap_data *sp;
(void)argc;
(void)argv;
s = socket(AF_IPX, SOCK_DGRAM, AF_IPX);
if (s < 0)
{
perror("IPX: socket: ");
exit(-1);
}
sipx.sipx_family = AF_IPX;
sipx.sipx_network = 0;
sipx.sipx_port = htons(0x452);
sipx.sipx_type = 0x4;
result = bind(s, (struct sockaddr *) &sipx, sizeof(sipx));
if (result < 0)
{
perror("IPX: bind: ");
exit(-1);
}
while (1)
{
socklen_t len;
size_t rclen;
len = sizeof(sipx);
result = recvfrom(s, msg, sizeof(msg), 0,
(struct sockaddr *) &sipx, &len);
if (result < 0)
{
perror("IPX: recvfrom");
exit(-1);
}
if (result < 2)
{
fprintf(stderr,
"Received packet is too short to be SAP packet (%d bytes)\n",
result);
continue;
}
rclen = (size_t)result - 2;
bptr = msg;
printf("SAP packet from: %08X:%02X%02X%02X%02X%02X%02X\n",
(uint32_t)ntohl(sipx.sipx_network),
sipx.sipx_node[0], sipx.sipx_node[1],
sipx.sipx_node[2], sipx.sipx_node[3],
sipx.sipx_node[4], sipx.sipx_node[5]);
bptr += 2;
sp = (struct sap_data *) bptr;
while (rclen >= sizeof(struct sap_data))
{
int i;
/* Keep output readable if the SAP name is blank-padded. */
sp->sap_name[47] = '\0';
for (i = 46; i > 0 && sp->sap_name[i] == '_'; i--)
;
sp->sap_name[i + 1] = '\0';
printf("NAME: %s TYPE: %x HOPS: %x\n",
sp->sap_name,
ntohs(sp->sap_type),
ntohs(sp->sap_hops));
printf("\tADDR: %08X:%02X%02X%02X%02X%02X%02X:%04X\n",
(uint32_t)ntohl(sp->sap_net),
sp->sap_node[0], sp->sap_node[1],
sp->sap_node[2], sp->sap_node[3],
sp->sap_node[4], sp->sap_node[5],
ntohs(sp->sap_sock));
rclen -= sizeof(struct sap_data);
sp++;
}
}
}

View File

@@ -330,6 +330,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemunitdir = @systemdsystemunitdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@

View File

@@ -313,6 +313,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
systemdsystemunitdir = @systemdsystemunitdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@