~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/hv/hv_set_ifconfig.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 
  4 # This example script activates an interface based on the specified
  5 # configuration.
  6 #
  7 # In the interest of keeping the KVP daemon code free of distro specific
  8 # information; the kvp daemon code invokes this external script to configure
  9 # the interface.
 10 #
 11 # The only argument to this script is the configuration file that is to
 12 # be used to configure the interface.
 13 #
 14 # Each Distro is expected to implement this script in a distro specific
 15 # fashion. For instance, on Distros that ship with Network Manager enabled,
 16 # this script can be based on the Network Manager APIs for configuring the
 17 # interface.
 18 #
 19 # This example script is based on a RHEL environment.
 20 #
 21 # Here is the ifcfg format of the ip configuration file:
 22 #
 23 # HWADDR=macaddr
 24 # DEVICE=interface name
 25 # BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
 26 #                       or "none" if no boot-time protocol should be used)
 27 #
 28 # IPADDR0=ipaddr1
 29 # IPADDR1=ipaddr2
 30 # IPADDRx=ipaddry (where y = x + 1)
 31 #
 32 # NETMASK0=netmask1
 33 # NETMASKx=netmasky (where y = x + 1)
 34 #
 35 # GATEWAY=ipaddr1
 36 # GATEWAYx=ipaddry (where y = x + 1)
 37 #
 38 # DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc)
 39 #
 40 # IPV6 addresses will be tagged as IPV6ADDR, IPV6 gateway will be
 41 # tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
 42 # IPV6NETMASK.
 43 #
 44 # Here is the keyfile format of the ip configuration file:
 45 #
 46 # [ethernet]
 47 # mac-address=macaddr
 48 # [connection]
 49 # interface-name=interface name
 50 #
 51 # [ipv4]
 52 # method=<protocol> (where <protocol> is "auto" if DHCP is configured
 53 #                       or "manual" if no boot-time protocol should be used)
 54 #
 55 # address1=ipaddr1/plen
 56 # address2=ipaddr2/plen
 57 #
 58 # gateway=gateway1;gateway2
 59 #
 60 # dns=dns1;
 61 #
 62 # [ipv6]
 63 # address1=ipaddr1/plen
 64 # address2=ipaddr2/plen
 65 #
 66 # gateway=gateway1;gateway2
 67 #
 68 # dns=dns1;dns2
 69 #
 70 # The host can specify multiple ipv4 and ipv6 addresses to be
 71 # configured for the interface. Furthermore, the configuration
 72 # needs to be persistent. A subsequent GET call on the interface
 73 # is expected to return the configuration that is set via the SET
 74 # call.
 75 #
 76 
 77 echo "IPV6INIT=yes" >> $1
 78 echo "NM_CONTROLLED=no" >> $1
 79 echo "PEERDNS=yes" >> $1
 80 echo "ONBOOT=yes" >> $1
 81 
 82 cp $1 /etc/sysconfig/network-scripts/
 83 
 84 chmod 600 $2
 85 interface=$(echo $2 | awk -F - '{ print $2 }')
 86 filename="${2##*/}"
 87 
 88 sed '/\[connection\]/a autoconnect=true' $2 > /etc/NetworkManager/system-connections/${filename}
 89 
 90 
 91 /sbin/ifdown $interface 2>/dev/null
 92 /sbin/ifup $interface 2>/dev/null

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php