Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37855997
en ru br
ALT Linux repositórios
S:0.2-alt1
5.0: 0.1-alt1

Group :: Sistema/Configurações/Rede
RPM: installer-feature-net-br-stage2

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

pax_global_header00006660000000000000000000000064112266127170014517gustar00rootroot0000000000000052 comment=b7c3ef7cbd98abfd9a05e2505f91d94107097b2e
installer-feature-net-br-stage2-0.2/000075500000000000000000000000001122661271700173545ustar00rootroot00000000000000installer-feature-net-br-stage2-0.2/.gear/000075500000000000000000000000001122661271700203505ustar00rootroot00000000000000installer-feature-net-br-stage2-0.2/.gear/rules000064400000000000000000000000071122661271700214220ustar00rootroot00000000000000tar: .
installer-feature-net-br-stage2-0.2/ifaddbr000075500000000000000000000025551122661271700207040ustar00rootroot00000000000000#! /bin/sh -e

[ -n "$1" ]
ifname="$1"
brname="br$ifname"

# create bridge and enslave an interface to it
/sbin/brctl addbr "$brname"
/sbin/brctl addif "$brname" "$ifname"
/sbin/ip link s dev "$brname" up

# clone settings from interface to bridge
# /sbin/ifclone "$ifname" "$brname"

# Now we want to extract ip address, broadcast address from source interface
# and found a default route for that interface. Then we want to delete them
# from source interface and add them to target bridge.
# XXX: This can fail into infinite loop now, but I hope that it will not be
# infinite in practice :)
# XXX: This code must be replaced by the call to ifclone above
# XXX: This code will fail if interface will have more than one ip address
inet_brd=$(ip a s "$ifname" | sed -n 's/\s\+inet \(.*\) scope.*$/\1/p')
if [ -n "$inet_brd" ]; then

read addr brd baddr <<<"$inet_brd"
[ "$brd" == "brd" ] || baddr=
default_route=$(ip r | sed -n "s/^default via \(.*\) dev $ifname/\1/p" | tr -d ' ')

ip addr del dev "$ifname" "$addr" $([ -z "$baddr" ] || echo "broadcast $baddr")

ip addr add dev "$brname" "$addr" $([ -z "$baddr" ] || echo "broadcast $baddr")
if [ -n "$default_route" ]; then
rc=8
while [ "$rc" = "8" ]; do
ip r add default via "$default_route" dev "$brname" 2>/dev/null &&
rc=0 || rc="$rc"
done
fi
fi
installer-feature-net-br-stage2-0.2/installer-feature-net-br-stage2.spec000064400000000000000000000017651122661271700262370ustar00rootroot00000000000000Name: installer-feature-net-br-stage2
Version: 0.2
Release: alt1

Summary: Enslave interface to bridge
License: GPL
Group: System/Configuration/Other
BuildArch: noarch
Source: %name-%version.tar
Requires: installer-common-stage2

%description
This package contains ifaddbr utility to create a bridge for
for each ethernet interface and to enslave interface to that bridge.

%prep
%setup

%install
mkdir -p %buildroot%_sbindir
install -pm755 ifaddbr %buildroot%_sbindir/

%files
%_sbindir/*

%changelog
* Mon Jul 13 2009 Dmitry V. Levin <ldv@altlinux.org> 0.2-alt1
- Build as noarch (closes: #20769).

* Tue Apr 28 2009 Dmitry V. Levin <ldv@altlinux.org> 0.1-alt1
- Reworked for installer-feature-net-br-stage2.

* Thu Apr 23 2009 Anton Protopopov <aspsk@altlinux.org> 0.02-alt1
- Imitate (virtual) ifclone functionality directly in ifaddbr

* Mon Apr 20 2009 Anton Protopopov <aspsk@altlinux.org> 0.01-alt1
- Build for Sisyphus

* Fri Apr 10 2009 Anton Protopopov <aspsk@altlinux.org> 0.01-alt0.1
- Initial build
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009