rpms/ladvd/F-9 ladvd-0.6.1-bonding.patch, NONE, 1.1 ladvd.fc, NONE, 1.1 ladvd.if, NONE, 1.1 ladvd.init, NONE, 1.1 ladvd.spec, NONE, 1.1 ladvd.sysconfig, NONE, 1.1 ladvd.te, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Andreas Thienemann ixs at fedoraproject.org
Wed Oct 29 10:22:18 UTC 2008


Author: ixs

Update of /cvs/pkgs/rpms/ladvd/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24897

Modified Files:
	.cvsignore sources 
Added Files:
	ladvd-0.6.1-bonding.patch ladvd.fc ladvd.if ladvd.init 
	ladvd.spec ladvd.sysconfig ladvd.te 
Log Message:
* Sat Oct 18 2008 Andreas Thienemann <andreas at bawue.net> 0.6.1-2
- Added SElinux support package
- Added patch to make it build on EL-4
- Added separate ladvd user


ladvd-0.6.1-bonding.patch:

--- NEW FILE ladvd-0.6.1-bonding.patch ---
--- src/netif.c	2008/10/19 19:17:36	329
+++ src/netif.c	2008/10/19 22:36:35	330
@@ -508,7 +508,7 @@
     }
 #endif /* HAVE_SYSFS */
 
-#ifdef HAVE_LINUX_IF_BONDING_H
+#if defined(HAVE_LINUX_IF_BONDING_H) && defined(BOND_MODE_8023AD)
     strncpy(ifr->ifr_name, master->name, IFNAMSIZ);
     memset(&ifbond, 0, sizeof(ifbond));
     ifr->ifr_data = (char *)&ifbond;
@@ -517,7 +517,7 @@
 	if (ifbond.bond_mode == BOND_MODE_8023AD)
 	    master->lacp = 1;
     }
-#endif /* HAVE_LINUX_IF_BONDING_H */
+#endif /* HAVE_LINUX_IF_BONDING_H && BOND_MODE_8023AD */
 
     if (master->lacp == 1)
 	my_log(INFO, "lacp enabled on %s", master->name);


--- NEW FILE ladvd.fc ---

/usr/sbin/ladvd	--	gen_context(system_u:object_r:ladvd_exec_t,s0)

/etc/rc.d/init.d/ladvd	--	gen_context(system_u:object_r:ladvd_script_exec_t,s0)


--- NEW FILE ladvd.if ---

## <summary>policy for ladvd</summary>

########################################
## <summary>
##	Execute a domain transition to run ladvd.
## </summary>
## <param name="domain">
## <summary>
##	Domain allowed to transition.
## </summary>
## </param>
#
interface(`ladvd_domtrans',`
	gen_require(`
		type ladvd_t;
                type ladvd_exec_t;
	')

	domtrans_pattern($1,ladvd_exec_t,ladvd_t)
')


########################################
## <summary>
##	Execute ladvd server in the ladvd domain.
## </summary>
## <param name="domain">
##	<summary>
##	The type of the process performing this action.
##	</summary>
## </param>
#
interface(`ladvd_script_domtrans',`
	gen_require(`
		type ladvd_script_exec_t;
	')

	init_script_domtrans_spec($1,ladvd_script_exec_t)
')

########################################
## <summary>
##	All of the rules required to administrate 
##	an ladvd environment
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
## <param name="role">
##	<summary>
##	The role to be allowed to manage the ladvd domain.
##	</summary>
## </param>
## <param name="terminal">
##	<summary>
##	The type of the user terminal.
##	</summary>
## </param>
## <rolecap/>
#
interface(`ladvd_admin',`
	gen_require(`
		type ladvd_t;
	')

	allow $1 ladvd_t:process { ptrace signal_perms getattr };
	read_files_pattern($1, ladvd_t, ladvd_t)
	        

	gen_require(`
		type ladvd_script_exec_t;
	')

	# Allow ladvd_t to restart the apache service
	ladvd_script_domtrans($1)
	domain_system_change_exemption($1)
	role_transition $2 ladvd_script_exec_t system_r;
	allow $2 system_r;

')


--- NEW FILE ladvd.init ---
#!/bin/bash
#
# ladvd        Startup script for the cdp/lldp sender
#
# chkconfig: - 85 15
# description: ladvd uses cdp / lldp frames to inform switches \
#              about connected hosts, which simplifies ethernet \
#              switch management.
# processname: ladvd
# pidfile: /var/run/ladvd.pid
#
### BEGIN INIT INFO
# Provides: ladvd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Short-Description: start and stop cdp/lldp sender
# Description: ladvd uses cdp / lldp frames to inform switches
#  about connected hosts, which simplifies ethernet
#  switch management.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

[ "${NETWORKING}" = "yes" ] || exit 0

[ -r /etc/sysconfig/ladvd ] && . /etc/sysconfig/ladvd

ARGS=""

[ "$CDP" != "yes" ] && [ "$LLDP" != "yes" ] && \
        echo "Need at least CDP or LDP activated" && \
        exit 1

[ "$CDP" == "yes" ] && ARGS=$ARGS" -c"
[ "$LLDP" == "yes" ] && ARGS=$ARGS" -l"
[ "$MGMT" != "" ] && ARGS=$ARGS" -m $MGMT"
[ "$COUNTRY" != "" ] && ARGS=$ARGS" -C $COUNTRY"
[ "$LOCATION" != "" ] && ARGS=$ARGS" -L $LOCATION"

start() 
{
	[ -z "$ARGS" ] && exit 6

        echo -n $"Starting ladvd: "
        daemon /usr/sbin/ladvd $ARGS $LADVDARGS
	RETVAL=$?
        echo
	[ $RETVAL = 0 ] && touch /var/lock/subsys/ladvd
	return $RETVAL
}

stop() 
{
        echo -n $"Shutting down ladvd: "
	killproc ladvd
	RETVAL=$?
	rm -f  /var/lock/subsys/ladvd
        echo
	return $RETVAL
}

[ -f /usr/sbin/ladvd ] || exit 0

# See how we were called.
case "$1" in
  start)
	start
        ;;
  stop)
	stop
        ;;
  force-reload|restart|reload)
	stop
	start
	;;
  try-restart|condrestart)
	[ -e /var/lock/subsys/ladvd ] && (stop; start)
	;;
  status)
  	status ladvd
	RETVAL=$?
	;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
        exit 3
esac

exit $RETVAL


--- NEW FILE ladvd.spec ---
%global uid 47
%global username ladvd
%global homedir /tmp
%global gecos CDP/LLDP sender for unix

%define selinux_variants mls strict targeted
%global selinux_policyver %(%{__sed} -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp || echo 0.0.0)
%define modulename ladvd

Name:           ladvd
Version:        0.6.1
Release:        2%{?dist}
Summary:        CDP/LLDP sender for unix

Group:          Applications/Internet
License:        ISC
URL:            http://www.blinkenlights.nl/software/ladvd/
Source0:        http://www.blinkenlights.nl/software/ladvd/ladvd-%{version}.tar.gz
Source1:        ladvd.sysconfig
Source2:        ladvd.init
Source3:        %{modulename}.te
Source4:        %{modulename}.fc
Source5:        %{modulename}.if
Patch0:         ladvd-0.6.1-bonding.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%bcond_without  fedora
BuildRequires:  fedora-usermgmt-devel
%{?FE_USERADD_REQ}

Provides:       group(%username) = %uid
Provides:       user(%username)  = %uid

Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service


%description 
ladvd uses cdp / lldp frames to inform switches about connected hosts, which
simplifies ethernet switch management. Every 30 seconds it will transmit CDP/
LLDP packets reflecting the current system state. Interfaces (bridge, bonding,
wireless), capabilities (bridging, forwarding, wireless) and addresses (IPv4,
IPv6) are detected dynamically.


%package selinux
Summary:        SELinux policy module supporting %{name}
Group:          System Environment/Base
BuildRequires:  checkpolicy, selinux-policy-devel, hardlink
%if "%{selinux_policyver}" != ""
Requires:       selinux-policy >= %{selinux_policyver}
%endif
Requires:       %{name} = %{version}-%{release}
Requires(post):   /usr/sbin/semodule, /sbin/restorecon
Requires(postun): /usr/sbin/semodule, /sbin/restorecon


%description selinux
SELinux policy module supporting %{name}


%prep
%setup -q
%patch0 -p0 -b .bonding
mkdir SELinux
cp -p %{SOURCE3} %{SOURCE4} %{SOURCE5} SELinux

%build
%configure \
        --with-user=%username \
        --with-pid-dir=%{_localstatedir}/run
make %{?_smp_mflags}

cd SELinux
for selinuxvariant in %{selinux_variants}
do
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
mv %{modulename}.pp %{modulename}.pp.${selinuxvariant}
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
done
cd -


%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
rm -rf %{buildroot}%{_docdir}/ladvd
install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
install -D -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}

cd SELinux
for selinuxvariant in %{selinux_variants}
do
install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
install -p -m 644 %{modulename}.pp.${selinuxvariant} \
%{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp
done
cd -

/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux


%clean
rm -rf %{buildroot}


%pre
%__fe_groupadd %uid -r %username &>/dev/null || :
%__fe_useradd  %uid -r -s /sbin/nologin -d %homedir -M          \
-c '%gecos' -g %username %username &>/dev/null || :


%post
/sbin/chkconfig --add %{name}


%preun
if [ $1 = 0 ]; then
        /sbin/service %{name} stop >/dev/null 2>&1
        /sbin/chkconfig --del %{name}
fi


%postun
if [ "$1" -ge "1" ]; then
        /sbin/service %{name} condrestart >/dev/null 2>&1
fi
%__fe_userdel  %username &>/dev/null || :
%__fe_groupdel %username &>/dev/null || :


%post selinux
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -i \
%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || :
done
/sbin/restorecon %{_localstatedir}/cache/myapp || :

%postun selinux
if [ $1 -eq 0 ] ; then
for selinuxvariant in %{selinux_variants}
do
/usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || :
done
[ -d %{_localstatedir}/cache/myapp ]  && \
/sbin/restorecon -R %{_localstatedir}/cache/myapp &> /dev/null || :
fi


%files
%defattr(-,root,root,-)
%doc doc/ChangeLog doc/README LICENSE TODO
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%{_initrddir}/%{name}
%{_sbindir}/ladvd
%{_mandir}/man8/ladvd.8*


%files selinux
%defattr(-,root,root,0755)
%doc SELinux/*
%{_datadir}/selinux/*/%{modulename}.pp


%changelog
* Sat Oct 18 2008 Andreas Thienemann <andreas at bawue.net> 0.6.1-2
- Added SElinux support package
- Added patch to make it build on EL-4
- Added separate ladvd user

* Sat Oct 18 2008 Andreas Thienemann <andreas at bawue.net> 0.6.1-1
- Initial package


--- NEW FILE ladvd.sysconfig ---
# Cisco Discovery Protocol
CDP=no

# Link Layer Discovery Protocol
LLDP=no

# Management adress for unnumbered interfaces
# Can be specified for IPv4 and IPv6
MGMT=

# Two-letter ISO 3166 country code
# (required for LLDP location support)
COUNTRY=

# The physical location of the server
LOCATION=

# Other arguments to ladvd
LADVDARGS=


--- NEW FILE ladvd.te ---
policy_module(ladvd,1.0.0)

require {
	type net_conf_t;
	type sysctl_net_t;
	type var_run_t;
	type ladvd_t;
	type sysfs_t;
	type sysctl_t;
	class capability { setuid net_raw setgid };
	class file { write getattr read lock create };
	class netlink_route_socket { write getattr read bind create nlmsg_read };
	class packet_socket { write create };
	class lnk_file read;
	class udp_socket { create ioctl };
	class dir { write search add_name getattr };
}

########################################
#
# Declarations
#

type ladvd_t;
type ladvd_exec_t;
init_daemon_domain(ladvd_t, ladvd_exec_t)

type ladvd_script_exec_t;
init_script_file(ladvd_script_exec_t)

########################################
#
# ladvd local policy
#

# Init script handling
domain_use_interactive_fds(ladvd_t)

# internal communication is often done using fifo and unix sockets.
allow ladvd_t self:fifo_file rw_file_perms;
allow ladvd_t self:unix_stream_socket create_stream_socket_perms;

files_read_etc_files(ladvd_t)

libs_use_ld_so(ladvd_t)
libs_use_shared_libs(ladvd_t)

miscfiles_read_localization(ladvd_t)

logging_send_syslog_msg(ladvd_t)


allow ladvd_t net_conf_t:file { read getattr };
allow ladvd_t self:capability { setuid net_raw setgid };
allow ladvd_t self:netlink_route_socket { write getattr read bind create nlmsg_read };
allow ladvd_t self:packet_socket { write create };
allow ladvd_t self:udp_socket { create ioctl };
allow ladvd_t sysctl_net_t:dir search;
allow ladvd_t sysctl_net_t:file read;
allow ladvd_t sysctl_t:dir search;
allow ladvd_t sysfs_t:dir { search getattr };
allow ladvd_t sysfs_t:file { read getattr };
allow ladvd_t sysfs_t:lnk_file read;
allow ladvd_t var_run_t:dir { write add_name };
allow ladvd_t var_run_t:file { write lock create };


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/ladvd/F-9/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	27 Oct 2008 04:19:28 -0000	1.1
+++ .cvsignore	29 Oct 2008 10:21:48 -0000	1.2
@@ -0,0 +1 @@
+ladvd-0.6.1.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/ladvd/F-9/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	27 Oct 2008 04:19:28 -0000	1.1
+++ sources	29 Oct 2008 10:21:48 -0000	1.2
@@ -0,0 +1 @@
+90989dec5200d6cab48dc7a6cff3cbe6  ladvd-0.6.1.tar.gz




More information about the fedora-extras-commits mailing list