Commit Graph

53 Commits (0a66b74b51f7d58916504e0e8bb01b6e981b489b)

Author SHA1 Message Date
Mike Gilbert 5899f2f516 Replace echo -n with printf in code with a /bin/sh shebang
POSIX does not mandate that echo support the -n parameter.
printf has more well-defined behavior.
2015-07-14 22:22:14 -04:00
Harald Hoyer 6d58fa27a4 change "while read x" to cope with EOF without newline
while read x || [ -n "$x" ]

should do the trick
2015-04-28 11:39:15 +02:00
Harald Hoyer 23446ef1e0 ifcfg/write-ifcfg.sh: unset vlan
clear the vlan flag, if a previous interface in the loop
was a vlan interface
2015-04-21 15:10:49 +02:00
Harald Hoyer 3947f07d93 ifcfg/write-ifcfg: only write DEVICE for non-kernel names
Rename an interface to the kernel namespace is not allowed, so don't add
DEVICE="<iface>", if HWADDR is given.
2014-10-28 15:13:35 +01:00
Harald Hoyer 80043e21c1 ifcfg/write-ifcfg.sh: bind bond and bridge interfaces to HW
either by s390 SUBCHANNELS or HWADDR, if the interface name is not
persistent.

Previously, this was bound unconditionally with HWADDR.
2014-09-12 09:49:58 +02:00
Harald Hoyer 967cc19ab1 remove all vim and emacs code format comments 2014-08-29 13:38:47 +02:00
Alex Harpin 32125a976b bridging: update the ifcfg files generated for bridge slaves
Update the ifcfg files generated for bridge slaves so they reference
the bridge they are part of.  Related to early patch submitted as a
fix for Bug #1123552.

Bug #1123552 https://bugzilla.redhat.com/show_bug.cgi?id=1123552
2014-08-11 20:16:06 +02:00
Harald Hoyer 2db6d71118 fixed bridge setup
renamed "ethnames" in bridge.info to "bridgeslaves"

fixed ifcfg generation
2014-08-01 13:16:29 +02:00
Harald Hoyer 7b46244bb9 network: add rd.route parameter 2014-07-22 11:52:52 +02:00
Alex Harpin 83c9ff7dbb bonding: use hwaddr of the slave rather than the master
When a bonded interface is brought up, any slaves included in the bond
have their hardware address set to that of the bond master.  Although
this allows an interface to be brought up on start up, when the
configuration file is imported into the booted system it prevents
the bonded interface being successfully restarted.

The fix involves obtaining the hardware address of the slaves before
they are added to the bond and then using this value in the
configuration file.
2014-06-03 12:26:01 +02:00
Harald Hoyer 8fa1afb65c ifcfg/write-ifcfg.sh: include net-lib.sh
otherwise is_persistent_ethernet_name() is missing
2014-05-16 13:33:17 +02:00
Harald Hoyer 1230f3bcff ifcfg/write-ifcfg.sh: "IPV6INIT=yes" check also for non-dhcp 2014-05-12 13:53:38 +02:00
Chapman Flack 2c19a5fa78 Specify strstr tightly, add strglob/strglobin.
By convention, strstr should be a literal string match. Previously, it
would match as a glob pattern. Some code used that, so add new
functions strglob and strglobin to do what that code expects, and
specify them tightly too. strglob tests whether the glob pattern
matches the entire string (the name strglob is also used in the yorick
language, and that's what it does there), while strglobin tests whether
the glob pattern matches anywhere in the string.

Also tightens str_starts, str_ends, and str_replace to deal with
literal strings only. In a quick grep I did not find code that depended
on these functions matching globs.

Changes the call sites where strstr was used with glob patterns to use
strglobin or strglob as the intention seemed to be (or, in one case,
strstr with the * removed as it did not affect the result anyway).
2014-04-07 10:49:07 +02:00
Harald Hoyer 2e094b20a6 ifcfg: only bind to HWADDR, if addr_assign_type == 0
/sys/class/net/$netif/addr_assign_type is != 0 for random MAC address
interfaces
2014-04-04 12:52:39 +02:00
Harald Hoyer fb0e5184a6 ifcfg: do not bind persistent interface names to HWADDR 2014-04-04 12:48:32 +02:00
Harald Hoyer d4dd3521bb ifcfg/write-ifcfg.sh: turn on IPV6INIT, if any inet6 address is found
If "ip -6 addr" finds any inet6 address, assume IPV6INIT=yes for the
ifcfg file.
2014-04-03 08:53:09 +02:00
Harald Hoyer 43a85a7365 network: merge setup_net_$netif.ok and net.$netif.did-setup
one marker per interface is enough
2014-02-28 12:10:41 +01:00
Harald Hoyer 79b3c8bfa1 ifcfg/write-ifcfg.sh: do not bind s390 to MAC if SUBCHANNELS set
If SUBCHANNELS are set, do not specify HWADDR, because the SUBCHANNELS
are the identifier for the interface.

https://bugzilla.redhat.com/show_bug.cgi?id=1056438
2014-02-26 15:02:46 +01:00
Radek Vykydal 030b00b8a5 Generate correct ifcfg file for vlan= option. 2013-07-31 15:47:33 +02:00
Harald Hoyer caf207afa7 ifcfg/write-ifcfg.sh: fixed logic
seems like nobody tested this with recent dracut versions.
2013-05-30 14:37:41 +02:00
Harald Hoyer 6625c085ae ifcfg/write-ifcfg.sh:
- fix ONBOOT for slaves
- set TYPE=Bond for bonding

https://bugzilla.redhat.com/show_bug.cgi?id=919001
2013-05-29 14:38:52 +02:00
Harald Hoyer 284d62da81 ifcfg/write-ifcfg.sh: proper NAME the interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=965842
2013-05-28 16:56:40 +02:00
Harald Hoyer d136ca4eeb network: support multiple bonding interfaces
Currently dracut only support 1 bond, namyly bond0 by default. However multiple
bonds configuration may be needed. For example in kdump, in 1st kernel, more
than one bonds may be configured, and bondX other than bond0 is used as output
interface to remote host which will store dump core. This patch can solve this
problem, to write real bond information to initramfs, 2nd kdump kernel will
use it to create the relevant bondX interface.

Tested-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
2013-04-09 10:52:22 +02:00
Harald Hoyer e0e99c59a5 ifcfg/write-ifcfg.sh: fixed typo 2013-03-14 18:30:35 +01:00
Radek Vykydal fd8e4aef90 Write BOOTPROTO=ibft for ip=ibft to ifcfg files 2013-03-14 10:54:28 +01:00
Radek Vykydal c5a742a3bf Don't write DHCPV6C=yes for each dhcp (ipv4) configuration.
Caused probably by commit 32ec0a762d
2013-03-14 10:54:28 +01:00
Radek Vykydal cbd60fcaaf Do not overwrite ifcfg files generated by Anaconda kickstart (#865192) 2012-10-16 14:43:13 +02:00
Harald Hoyer 32ec0a762d ifcfg/write-ifcfg.sh: add "IPV6INIT=yes" for IPv6
https://bugzilla.redhat.com/show_bug.cgi?id=852808
2012-09-06 11:38:48 +02:00
Will Woods 30430fbe30 ifcfg: fix output for ipv6 static addressing
IPV6 configuration is pretty different than IPV4; write out the correct
set of values to make static IPV6 addressing work.
2012-06-12 19:24:46 +02:00
Will Woods 31cfc9aa5e dracut-lib.sh: add copytree(), use it where applicable
copytree() recursively copies the contents of SRC into DEST.

If DEST doesn't exist it is created; if it exists the contents of SRC
get merged into it (duplicate files are overwritten).
2012-05-29 11:32:44 +02:00
Harald Hoyer 02805bd1fc ifcfg/write-ifcfg.sh: fixed IFS resetting 2012-05-22 11:36:41 +02:00
Harald Hoyer a82d207b8d ifcfg/write-ifcfg.sh: add s390 specific configuration options
https://bugzilla.redhat.com/show_bug.cgi?id=811521
2012-05-10 14:34:53 +02:00
Harald Hoyer 5bfbfbfc22 ifcfg/write-ifcfg.sh: use PREFIX for prefix netmask form
https://bugzilla.redhat.com/show_bug.cgi?id=820185
2012-05-09 14:58:52 +02:00
Will Woods 335bb5a35b ifcfg: fix resolv.conf
/etc/net.*.resolv.conf is not a useful filename; copy it to resolv.conf
2012-05-02 14:41:37 +02:00
Harald Hoyer eb6e141adb ifcfg: write DNS1=... for nameserver= args (RHBZ#815369)
If you're using a static network config, you'll want to keep your
nameservers around when NM starts. Write DNS1 (and DNS2, DNS3, etc..)
into the ifcfg file.

Thanks to Mark Hamzy <hamzy@us.ibm.com>
and Will Woods <wwoods@redhat.com> for the patch.
2012-04-24 13:08:57 +02:00
Harald Hoyer 990e945ffd add mtu and macaddr to ip= 2012-04-05 13:25:41 +02:00
Will Woods 66666c670a write-ifcfg.sh: add UUID=.. and save the lease files with the same uuid
As described in https://bugzilla.redhat.com/show_bug.cgi?id=541410#c2,
if you want NetworkManager to take over an interface that you're using
for NFS root (or other network root device), you need to:

a) set UUID=<uuid> in ifcfg-<iface>, and
b) save the lease file as /var/lib/dhclient-<uuid>-<iface>.lease

This patch should make write-ifcfg handle both these things.
2012-03-08 10:58:42 +01:00
Will Woods d37ad6aea0 write-ifcfg.sh: cleanups
mkdir -p creates intermediate directories and never returns an error, so
we don't need to create the intermediate directories ourself.
2012-03-08 10:58:42 +01:00
Harald Hoyer 3b403b32fc removed trailing whitespaces 2011-05-10 11:56:09 +02:00
Harald Hoyer da5f8554a4 ifcfg/write-ifcfg.sh: do not source net.*.override, if it doesn't exist 2011-05-10 10:55:48 +02:00
Harald Hoyer dbad9f4661 Move all files to /run/initramfs
Given that we boot into a modern Linux distribution with the "/run" toplevel
directory, we can easily mount move the whole /run directory to the real
root in the end and have the complete initramfs later on in
/run/initramfs. All log files and /run states are still accessible and
to save space /run/initramfs can be removed later on.

Because the kernel does not mount a tmpfs on /run prior to unpacking the
initramfs cpio image, we have to copy ourselves very early to a tmpfs
and mount it on /run.
Due to lazy umount the old initramfs binaries should
be removed in the end by switch_root.

This feature can be turned on with "--prefix".
2011-04-12 12:08:50 +02:00
Harald Hoyer d125a47061 mkdir always with -m 0755 2011-04-08 10:39:46 +02:00
Harald Hoyer 19f3a804e7 s#/dev/.run#/run#g
Move things where they really belong to.
2011-03-18 18:23:44 +01:00
Harald Hoyer b177e9133e move all /dev/.initramfs to /dev/.run/initramfs
We want all "/var/run" information to live in /dev/.run, until the real
root is mounted.
Therefore we mount a tmpfs on /dev/.run, which can/will be bind/move mounted
on /var/run later on.
2011-03-10 12:40:47 +01:00
Harald Hoyer 6ef8e5b4d3 mkdir /dev/.initramfs with "-p" 2010-10-28 17:11:35 +02:00
Vladislav Bogdanov 3afca618da ifcfg/write-ifcfg.sh: fixes typos and generated ifcfg files 2010-10-28 17:11:34 +02:00
Vladislav Bogdanov 96fb9c8dd7 add bonding
Format:
bond=<bondname>[:<bondslaves>:[:<options>]]

bondslaves is a comma-separated list of physical (ethernet) interfaces.

options is a comma-separated list on bonding options (modinfo bonding for
details) in format compatible with initscripts.

If options include multi-valued arp_ip_target option, then its values
should be separated by semicolon.

bond without parameters assumes bond=bond0:eth0,eth1:balance-rr
2010-10-18 16:10:41 +02:00
Harald Hoyer cc02093d69 reformat source code
removed tabs and set indention to 4 spaces
added emacs and vi format headers
2010-09-10 15:34:36 +02:00
Harald Hoyer 80a6943fc4 ifcfg: set mode 0755 for scripts 2010-03-04 18:03:36 +01:00
Harald Hoyer c98bcec89c add preliminary IPv6 support 2010-02-04 16:05:19 +01:00