|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: Sysconfig_Route
|
|
Packit Service |
a2ae7a |
Parses /etc/sysconfig/network-scripts/route-${device}
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Author: Stephen P. Schaefer
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Reference
|
|
Packit Service |
a2ae7a |
This lens allows manipulation of *one* IPv4 variant of the
|
|
Packit Service |
a2ae7a |
/etc/sysconfig/network-scripts/route-${device} script found in RHEL5+, CentOS5+
|
|
Packit Service |
a2ae7a |
and Fedora.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
The variant handled consists of lines like
|
|
Packit Service |
a2ae7a |
"destination_subnet/cidr via router_ip", e.g.,
|
|
Packit Service |
a2ae7a |
"10.132.11.0/24 via 10.10.2.1"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
There are other variants; if you use them, please enhance this lens.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
The natural key would be "10.132.11.0/24" with value "10.10.2.1", but since
|
|
Packit Service |
a2ae7a |
augeas cannot deal with slashes in the key value, I reverse them, so that the
|
|
Packit Service |
a2ae7a |
key is "10.10.2.1[1]" (and "10.10.2.1[2]"... if multiple subnets are reachable
|
|
Packit Service |
a2ae7a |
via that router).
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: License
|
|
Packit Service |
a2ae7a |
This file is licenced under the LGPL v2+, like the rest of Augeas.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Lens Usage
|
|
Packit Service |
a2ae7a |
Sample usage of this lens in augtool
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
* Set the first subnet reachable by a router reachable on the eth0 subnet
|
|
Packit Service |
a2ae7a |
> set /files/etc/sysconfig/network-scripts/route-eth0/10.10.2.1[1] 172.16.254.0/24
|
|
Packit Service |
a2ae7a |
* List all the subnets reachable by a router reachable on eth0 subnet
|
|
Packit Service |
a2ae7a |
> match /files/etc/sysconfig/network-scripts/route-eth0/10.10.2.1
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Configuration files
|
|
Packit Service |
a2ae7a |
This lens applies to /etc/sysconfig/network-scripts/route-*
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Examples
|
|
Packit Service |
a2ae7a |
The <Test_Sysconfig_Route> file contains various examples and tests.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module Sysconfig_Route =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(******************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: USEFUL PRIMITIVES
|
|
Packit Service |
a2ae7a |
******************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: router
|
|
Packit Service |
a2ae7a |
A router *)
|
|
Packit Service |
a2ae7a |
let router = Rx.ipv4
|
|
Packit Service |
a2ae7a |
(* Variable: cidr
|
|
Packit Service |
a2ae7a |
A subnet mask can be 0 to 32 bits *)
|
|
Packit Service |
a2ae7a |
let cidr = /(3[012]|[12][0-9]|[0-9])/
|
|
Packit Service |
a2ae7a |
(* Variable: subnet
|
|
Packit Service |
a2ae7a |
Subnet specification *)
|
|
Packit Service |
a2ae7a |
let subnet = Rx.ipv4 . "/" . cidr
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(******************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: ENTRY TYPES
|
|
Packit Service |
a2ae7a |
******************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry
|
|
Packit Service |
a2ae7a |
One route *)
|
|
Packit Service |
a2ae7a |
let entry = [ store subnet . del /[ \t]*via[ \t]*/ " via "
|
|
Packit Service |
a2ae7a |
. key router . Util.del_str "\n" ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(******************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: LENS AND FILTER
|
|
Packit Service |
a2ae7a |
******************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: lns *)
|
|
Packit Service |
a2ae7a |
let lns = entry+
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: filter *)
|
|
Packit Service |
a2ae7a |
let filter = incl "/etc/sysconfig/network-scripts/route-*"
|
|
Packit Service |
a2ae7a |
. Util.stdexcl
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|