Re: [PATCH] Initial IPv6 support



On Jun 23, 2008, at 2:22 PM, David Cantrell wrote:

Attached is a patch to libnm-util/ to add IPv6 support. I am currently working on modifications to system-settings/plugins/ifcfg- fedora/reader.c to read in IPv6 settings. The patch attached to this message defines NMSettingIP6Config and the backend support functions to work with it. The big differences from the IP4 type are:

1) Storing addresses at runtime as struct in6_addr, but converting them to GByteArray so we can put it in a GValue for storage.

2) More flags have been added, notably disable_ra to disable router advertisement autoconfiguration.

3) A dhcpv6_mode value is present to indicate how we should run the dhcpv6 client should the user enable it.

More debugging to come, consider this a first go at this patch. Some things I am unsure of:

- When adding a GByteArray to a GArray, do you free the byte array you just created? Looking at other examples in the code, it appears that GArray just holds a reference to the byte array so you don't want to free it once you add it, so I didn't. If this is incorrect, please let me know and feel free to explain how GArrays work because the documentation isn't spectacular.

- Since the _from_gvalue() and _to_gvalue() functions create GArrays of the address structure members, the GArray element size has to be consistent. This isn't a problem for IPv4 because the address structure members are all guint32 types. For IPv6, the address and gateway members are struct in6_addr and the prefix is guint32. So that's two 16-byte members and one 4-byte member. For the GArray conversion, I create a GArray large enough to hold 16-byte GByteArrays and add those. So the prefix, while unnecessary, is placed in a GByteArray, but only the first 4 bytes are used. I don't really see this as a problem since it's a backend conversion that happens, but if anyone sees _total failure_ written across this, let me know.

After this patch, I have:
* A patch for reader.c to read Fedora ifcfg files.
* A patch to create the NMIP6Config struct in src/

Comments welcome.

Updated patch attached to this message. Storing DNS server addresses [more] correctly.

Attachment: NetworkManager-libnm-util-ipv6.patch
Description: Binary data



--
David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]