summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* policy: delegate IPv6 configuration to ipv6.method=shared connectionslr/ipv6-sharingLubomir Rintel2016-11-091-1/+281
| | | | | | | | | | | | | | The policy listens to signals from shared devices that need subnets and requesting devices that provide prefixes. Whenever a subnet is needed, policy tries to obtain a subnets from all of default6 device's prefixes. When it fails to get any, it asks for more prefixes. This way we make it possible for the delegating router to either provide us with a /64 for each of our shared interfaces, or provide a larger prefix that we could subnet. The policy also updates the shared device's DNS information to keep it in sync with the best requesting device changes.
* device: add IPv6 configuration delegation machineryLubomir Rintel2016-11-092-1/+144
| | | | | | | | | | | | | | | There's two parts of the configuration involved: the subnet addresses and the DNS information. For the addressing, the shared (downlink) device signals the policy needs for a /64 subnet. When it gets one, it merges it into the autoconf configuration and forwards to the NDisc. When more prefixes are needed, the (uplink) device asks the DHCP manager and eventually signals delegation (reception) of a prefix. The NMDevice only provides the mechanism, the actual subnetting needs to be done by the NMPolicy. For the DNS configuration, the shared device just copies it from whichever device the policy deems suitable.
* dhcp-manager: add ability to specify the number of IPv6 prefixes to requestLubomir Rintel2016-11-0910-28/+117
| | | | | | Utilizes RFC 3633 prefix option in role of requesting router to ask the delegating router for prefixes. In future we'll be able to use the addresses from those prefixes on ipv6.method=shared connections.
* dhcp-manager: move the options logging one level upLubomir Rintel2016-11-092-8/+9
| | | | | | | | | It will make sense to log the options even if we're not creating an ip6_config (e.g. we got a prefix option, not an address). Also, guard it with a logging enable conditional. That way we save precious microseconds so that we'll feel less guilty about the demise of mankind and universe.
* manager: allow ipv6.medhod=shared connectionsLubomir Rintel2016-11-091-12/+0
|
* device: enable the IPv6 forwarding for shared connectionsLubomir Rintel2016-11-091-0/+13
| | | | Useful when they have internet-routable prefixes, consistent with IPv4.
* device: announce the managed IPv6 configuration with ipv6.method=sharedLubomir Rintel2016-11-091-9/+111
| | | | | | | | | This esentially causes us to announce the prefixes of the addresses we own and the DNS configuration. Currently the only way to get the IPv6 configuration on such device is manual setting in the connection. This will change with IPv6 prefix delegation.
* settings: allow method=shared with manual IPv6 configurationLubomir Rintel2016-11-092-34/+41
| | | | | | IPv4 already allows setting an address, reusing its prefix for the network it shares connection with. Additionally, for IPv6, the NDP can also share the DNS configuration.
* ifcfg: add ability to save/restore ipv6.method=sharedLubomir Rintel2016-11-092-4/+6
| | | | We use IPV6_AUTOCONF=shared for this.
* ndisc/lndp: add ability to announce the managed IPv6 configurationLubomir Rintel2016-11-097-6/+205
| | | | Announce the prefixes and DNS configuration.
* ndisc: rename the config-changed signalLubomir Rintel2016-11-095-9/+9
| | | | | | The ndisc config can now be changed by NMDevice as well when the NDisc is in ROUTER mode. But what we're really interested in is when we receive a new one from the outside.
* ndisc: add logic for acting as a routerLubomir Rintel2016-11-095-24/+199
|
* ndisc: move the logging deduplication into a macroLubomir Rintel2016-11-091-13/+16
| | | | We'll want to use it elsewhere.
* ndisc: avoid calling start() multiple timesLubomir Rintel2016-11-093-7/+8
| | | | | It hooks on ndp event callbacks and we'll end up in them being done redundantly, leaking them on dispose and potentially even calling them.
* ndisc/trivial: move nm_ndisc_set_iid upwardsLubomir Rintel2016-11-091-47/+49
|
* ndisc/lndp: drop an unused variableLubomir Rintel2016-11-091-1/+0
|
* ndisc/trivial: add a couple of comments of where do the constants come fromLubomir Rintel2016-11-091-2/+2
|
* device: the domain list from DNSSL is in fact a search listLubomir Rintel2016-11-091-2/+2
|
* rdisc: rename to ndiscLubomir Rintel2016-11-0920-876/+877
| | | | | | We'll soon not only do the router discovery, but announce ourselves as a reouter. "Neighbor discovery" sounds to be a more appropriate name for the class than "Router discovery".
* device: avoid a crash when L3 configuration failsLubomir Rintel2016-11-091-1/+5
| | | | | Don't call the IP check until at either IPv4 or IPv6 is actually configured.
* ifcfg-rh: avoid parsing the IPV6_PRIVACY string twiceLubomir Rintel2016-11-091-1/+1
| | | | | This saves a couple of CPU cycles that would be better used for something more useful, such as looking for transmissions from aliens.
* ifcfg-rh: get rid of an extra unused variableLubomir Rintel2016-11-091-15/+14
| | | | | This saves a couple of bits we could instead use to save memories of the better days.
* linux: don't assume short write when the kernel ignores the trailing whitespaceLubomir Rintel2016-11-091-3/+3
| | | | | | | | Certain sysctls don't appreciate the final newline. That's completely fine. 17941 open("/proc/sys/net/ipv6/conf/eth2/forwarding", O_WRONLY|O_TRUNC) = 21 17941 write(21, "1\n", 2) = 1
* client: don't do g_criticalsLubomir Rintel2016-11-091-1/+1
| | | | | | | | Also, be a bit more careful about the layers of errors. Just don't do this: (process:236): nmcli-CRITICAL **: Error: Could not create NMClient object: Permissions request failed: Authorization check failed: The name org.freedesktop.PolicyKit1 was not provided by any .service files.
* utils: allow valid_lft=0 addressesLubomir Rintel2016-11-091-6/+7
| | | | | | | | | | | | | | | | We use the lifetime of 0 to indicate permanent addresses while DHCP uses that lifetime to indicate the addresses should be removed. Use the presence of a timestamp to differentiate the two. dhclient[10867]: XMT: Rebind on wls1, interval 1030ms. dhclient[10867]: RCV: Reply message on wls1 from fe80::21e:8cff:feec:3ca2. NetworkManager[10481]: <info> [1478020967.7634] dhcp6 (wls1): valid_lft 0 NetworkManager[10481]: <info> [1478020967.7634] dhcp6 (wls1): preferred_lft 0 NetworkManager[10481]: <info> [1478020967.7636] dhcp6 (wls1): address fd25:d463:2f14::927 NetworkManager[10481]: <info> [1478020967.7636] dhcp6 (wls1): nameserver 'fe80::21e:8cff:feec:3ca2' NetworkManager[10481]: <info> [1478020967.7637] dhcp (wls1): domain search 'venom.' NetworkManager[10481]: <info> [1478020967.7637] dhcp6 (wls1): state changed unknown -> bound, event ID="fa:cd:2c:86|1478020967" NetworkManager[10481]: ((src/nm-core-utils.c:3521)): assertion '<dropped>' failed
* device: ipv6.method=link-local does not need slavesLubomir Rintel2016-11-091-4/+2
| | | | | It already waits for carrier, which is sufficient -- DAD won't start until there's carrier.
* device: don't fail the device if IPv4 forwarding failsLubomir Rintel2016-11-091-3/+3
| | | | | | Just fail the IPv4 method. Plus improve some comments.
* ifcfg-rh: add parenthesesLubomir Rintel2016-11-091-2/+2
| | | | The code is now perfect.
* device: make some asserts less harshLubomir Rintel2016-11-091-4/+4
| | | | We're terrible programmers, but we don't need anyone to notice!
* ifcfg-rh: drop an unused variableLubomir Rintel2016-11-091-1/+0
| | | | Fixes: ecda08e1d13154c991bd54ae9159254584afc4a5
* ifcfg-rh: merge branch 'th/ifcfg-rh-shell-parsing-rh1369380'Thomas Haller2016-11-0925-1961/+2153
|\ | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1369380
| * ifcfg-rh: optimize checking character types during svEscape()Thomas Haller2016-11-091-14/+15
| | | | | | | | | | | | | | I don't think that the compiler is able to optimize strchr($SET_AS_STR, $CHAR) Use NM_IN_SET() which expands to something that should be easy for the compiler to optimize.
| * ifcfg-rh: restore previous behavior for svUnescape() stripping backslash ↵Thomas Haller2016-11-092-3/+60
| | | | | | | | | | | | | | | | | | from double-quoting Now we could parse simple shell variable assignment properly, but old versions of svEscape() wrote invalid double-quoted strings. Add a hack to restore the broken behavior for that case only.
| * ifcfg-rh/tests: some refactoring of testsThomas Haller2016-11-091-974/+353
| | | | | | | | | | | | | | | | | | When introducing the macro _svGetValue_check() we replace the call to svGetValueString() with svGetValue(). That makes a difference only when asserting against a %NULL value. It's fair to assume that in such case we actually want to assert that the value is unset, and not possibly empty.
| * ifcfg-rh: remove unused keyfile argument from writer_update_connection()Thomas Haller2016-11-094-10/+2
| | | | | | | | | | writer_update_connection() retrieves the keyfile name based on the ifcfg-name. No need to pass it in separately, the argument was unused.
| * ifcfg-rh: set errno in svGetValueInt64() in case key does not existThomas Haller2016-11-091-1/+3
| |
| * ifcfg-rh/tests: add test for handling multiple occurances of a variableThomas Haller2016-11-094-1/+89
| | | | | | | | This tests commit "ifcfg-rh: handle multiple definitions of the same key".
| * ifcfg-rh: let reader create lineList in O(n) using g_list_prepend() and ↵Thomas Haller2016-11-091-2/+3
| | | | | | | | g_list_reverse()
| * ifcfg-rh: let reader preserve the last line even without newline at end of fileThomas Haller2016-11-093-1/+21
| |
| * ifcfg-rh: modify svGetString() signature to avoid copying of temporary valueThomas Haller2016-11-093-40/+30
| | | | | | | | | | Modify the signature of svGetString() to allow getting the internal string without cloning the string after unescaping.
| * ifcfg-rh: avoid copying temporary value after unescapingThomas Haller2016-11-091-28/+50
| | | | | | | | | | | | | | | | | | | | svUnescape() can return a pointer to the input argument (if the input argument requires no unescaping or truncation). That is actually the predominant case because most often we store values that don't require escaping. Optimize for that case.
| * ifcfg-rh: comment out invalid lines during svWriteFileThomas Haller2016-11-0910-6/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is especially important because we don't support line continuation. Thus, with FOO='val bar=3' wrong line F2=b F3='b XXX=adf' XXX2=val2 ' we now write FOO= #NM: FOO='val bar= #NM: bar=3' #NM: wrong line F2=b F3= #NM: F3='b XXX= #NM: XXX=adf' XXX2=val2 #NM: ' Basically, the writer will comment out any line that is - not all-whitespace - not a '#' comment (possibly proceeded by whitespace) - not a valid variable assignment This avoids that writer writes lines that are not understood by ifcfg-rh plugin, but interferes with initscripts. E.g. NAME=old-name' rm -rf / ' becomes NAME=new-name #NM: rm -rf / #NM: '
| * ifcfg-rh: fix svEscape() to properly handle double quotingThomas Haller2016-11-092-7/+22
| | | | | | | | | | | | | | | | | | | | '\'', '~': must not be escaped with backslash. Also, within double quotes the backslash escape character is only removed before special caracters like '$' or '`'. Not in general. Yes, it means that older versions of svEscape produced invalid escape sequences that we now treat differently. But that is not realy avoidable, it was a bug that needs to be fixed.
| * ifcfg-rh: use macro _char_in_strset() for svEscape()Thomas Haller2016-11-091-4/+6
| |
| * ifcfg-rh: support storing newline '\n' and other ANSI control caractersThomas Haller2016-11-092-10/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is especially important for the team config JSON, which is expected to contain newlines. ANSI C quotation is bash specific, but initscripts already use #!/bin/bash. Unfortunately, g_strescape() doesn't escape '\'' and can thus not be used. Also add a test that svEscape() and svUnescape() do a round-trip. Not only consider \r and \n as candidates for ANSI C quotation, but all ANSI control characters.
| * ifcfg-rh: rework parsing of shell (svUnescape())Thomas Haller2016-11-092-102/+547
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Better support parsing of shell. Now we support: - combining values, like FOO=a"b" FOO=$'\n'b - bash style ANSI C quotation ($''). This will allow us to properly handle newlines in string values. - comments at the end of a line (after whitespace) FOO=val #comment Note that this is different from a # without space FOO=val#with#hashes - trailing spaces are ignored like FOO=a[space] FOR=[space] - history expansion via ! is not done (this is not new). We don't support: - line continuation like FOO=' ' FOO=a\ b - any form of shell expansion via $, ``. FOO="$a" Such values are recognized to name a variable FOO, but with an empty value, like FOO=%{nil} which is not the same as a valid empty value FOO= - any other form of (unquoted) shell meta characters, like ; < > ( ). This especially means, that the command invocations are invalid, like ls -1 LANG=C ls -1 FOO1=a; FOO2=b This also means, that spaces immidiately after the assignment are invalid: FOO= val Also, svUnescape() can now return %NULL to signal an invalid line like FOO='
| * ifcfg-rh: handle multiple definitions of the same keyThomas Haller2016-11-091-7/+48
| | | | | | | | | | | | | | | | | | | | When - reading a key that is defined multiple times, accept the last occurrence. - when deleting such a key, delete all occurrences. - when overwriting such a key, overwrite the last occurrence and delete any previous definitions.
| * ifcfg-rh: get rid of the internal "current" pointerThomas Haller2016-11-091-47/+66
| | | | | | | | | | | | It was not used and it is bad style. Especially, because in the next commit we want to remove multiple definitions of a key. Thus, we usually always iterate until the end.
| * ifcfg-rh: refactor svUnescape()Thomas Haller2016-11-093-56/+24
| | | | | | | | | | | | | | | | | | Move the g_strchomp() inside svUnescape(). It is part of the escaping process (although of course wrong to do, because it accepts "FOO= bar". That will be fixed later). Thereby, change the signature to allow in the future to do unescape without additional copy.
| * ifcfg-rh: allow leading spaces before variable namesThomas Haller2016-11-091-0/+5
| |