[PATCHES] symbol visibility

2008-08-12 Thread Michael Biebl

Hi,

while looking through the TODO list for 0.7 [1], I decided that I should 
contribute a bit, especially as it was me, that complained about the 
long list of exported symbols by libnm-glib and libnm-util.


So I went ahead and studied the docs a bit.
There are basically two approaches, how to trim down the list of 
exported symbols:


a) GCC's visibility support [2]
 GCC extension, mostly used by C++ libraries

b) ld linker/version scripts  [3]
 b.1) either directly via LDFLAGS -Wl,--version-script
 b.2) or indirectly via libtools -export-symbols $FILE or 
-export-symbols-regex, which will create a version script on the fly.


Before trying to evaluate which approach is best, I analyzed the list of 
exported symbols (see attached *.symbols files) and checked which 
symbols are not part of the public API (see attached *.diff files).


There are basically 5 ways
GCC visibility
1.) Use -fvisibility=default (all symbols are exported by default) and 
augment all function declarations, which shall not be exported with 
__attribute__ ((visibility("hidden")))


Does not work, as we have autogenerated files, where we cannot add the 
visibility attribute.


2.) Use -fvisibility=hidden (all symbols are hidden by default) and 
augment all function declarations, which shall be exported with 
__attribute__ ((visibility("default"))).


Lots of code changes in the header files. To be manageable we'd have to 
define a macro like DLLEXPORT. All installed header files would either 
have to define such a macro or we would have to create a new header file 
(like visibility.h) which contains this macro and all other header files 
include that. Imho quite cumbersome


libtool
3.) -export-symbols-regex:
as you can see from the attached symbols and diff files, we can't use a 
common prefix like nm_.*. We'd have to rename private function to 
something like _nm_* -> looks of code changes.


4.) -export-symbols $FILE
List all exported symbols in a separate file and pass it to libtool.
I chatted with libtool's upstream a bit, and he recommended though, to 
directly use a ld version script. as this provides the most flexibility,


5.) LDFLAGS = -Wl,--version-script=$FILE
That's the way I implemented it in the patch. I listed each exported 
symbol explicitely (although the version script syntax would allow 
regexes). See patch 0001 and 0002 for the details.
Imho this is the nicest and cleanest approaches which requires the least 
changes.
I generated the version scripts automatically (by using objdump and 
grepping for the symbols in the installed header files, dropping all 
symbols which are not part of the public API), so a careful review would 
be very appreciated.
NOTE: I didn't enable symbol versioning as I didn't see the need for it 
yet, I only used the version script to control the list of exported symbols


After applying 0001 and 0002, the test-crypto binary will no longer 
build, as it uses private symbols from libnm-util. I simply removed it 
in patch 0003. An alternative would be, to add crypto.c and 
crypto_(gnutls|nss).c to test_crypto_SOURCES.

If someone has a need for this binary, I could change that.


Comments and feedback welcome.


Michael
P.S: As I have svn commit access now, I could commit those patches 
myself, if you ack the changes.



[1] http://live.gnome.org/NetworkManager07Release
[2] http://gcc.gnu.org/wiki/Visibility
[3] 
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gnu-linker/version.html


--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From d452ca3f3f2a9ea6fda182498128b16ea2467990 Mon Sep 17 00:00:00 2001
From: Michael Biebl <[EMAIL PROTECTED]>
Date: Wed, 13 Aug 2008 02:42:02 +0200
Subject: [PATCH] symbol visibility

Use a ld version script for libnm-util, libnm_glib and libnm_glib_vpn to
control the list of exported symbols.
---
 libnm-glib/Makefile.am |5 -
 libnm-util/Makefile.am |5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am
index d3c73b6..a8b4aca 100644
--- a/libnm-glib/Makefile.am
+++ b/libnm-glib/Makefile.am
@@ -91,6 +91,8 @@ libnm_glib_la_LIBADD = \
 	$(GCONF_LIBS)	\
 	$(GNOME_KEYRING_LIBS)
 
+libnm_glib_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm_glib.ver
+
 noinst_PROGRAMS = libnm-glib-test
 
 libnm_glib_test_SOURCES = libnm-glib-test.c
@@ -101,6 +103,7 @@ libnm_glib_test_LDADD = libnm_glib.la $(top_builddir)/libnm-util/libnm-util.la $
 libnm_glib_vpn_la_SOURCES = nm-vpn-plugin.c nm-vpn-plugin-ui-interface.c
 libnm_glib_vpn_la_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS)
 libnm_glib_vpn_la_LIBADD = $(top_builddir)/libnm-util/libnm-util.la $(GLIB_LIBS) $(DBUS_LIBS)
+libnm_glib_vpn_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm_glib_vpn.ver
 
 
 nm-client-bindings.h: $(top_srcdir)/introspection/nm-manager-client.xml
@@ -153,7 +156,7 @@ pkgconfig_DATA = libnm_glib.pc libnm_glib_vpn.pc
 
 DISTCLEANFILES = libnm_glib.pc lib

Re: vpn connection failure

2008-08-12 Thread Eric Beversluis

On Tue, 2008-08-12 at 17:40 -0400, Dan Williams wrote:
> On Tue, 2008-08-12 at 17:27 -0400, Eric Beversluis wrote:
> > I'm trying to get VPN to work on my Ubuntu 7.04 installation with
> > NetworkManager Applet 0.6.4. I'm using the same IP address, user name
> > and password that works on a vpn connection on my Windows box, but here
> > I keep getting this error message:
> > 
> > "VPN Connection Failure
> > Could not start VPN connection due to a connection error.
> > VPN Connection failed."
> > 
> > I can't seem to find anything on the NetworkManager page or elsewhere
> > that gives any instructions on configuring the VPN connection. Can
> > anyone help with this? (PS--there is no firewall running on the box
> > right now and still no connection.)
> 
> Which VPN plugin?  openvpn, vpnc, or pptp?  Also, if openvpn, what
> version of openvpn are you using?
> 
> Dan

I don't see anywhere in the config window where it tells me. I think I
have a pptp plugin. On the connection page, the only connection type
option is Windows pptp, which is what I want to use. Just today I tried
the openvpn plugin (no idea which version). But the openvpn plugin
didn't make any difference in the behavior or the config options.

I don't find anywhere on the NetworkManager help page that tells me
anything about plugins, as I don't find anything that guides me through
the various config possibilities that appear on the VPN config dialog.
Am I missing a source of info somewhere?

Thanks.

EB

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: vpn connection failure

2008-08-12 Thread Dan Williams
On Tue, 2008-08-12 at 17:27 -0400, Eric Beversluis wrote:
> I'm trying to get VPN to work on my Ubuntu 7.04 installation with
> NetworkManager Applet 0.6.4. I'm using the same IP address, user name
> and password that works on a vpn connection on my Windows box, but here
> I keep getting this error message:
> 
> "VPN Connection Failure
> Could not start VPN connection due to a connection error.
> VPN Connection failed."
> 
> I can't seem to find anything on the NetworkManager page or elsewhere
> that gives any instructions on configuring the VPN connection. Can
> anyone help with this? (PS--there is no firewall running on the box
> right now and still no connection.)

Which VPN plugin?  openvpn, vpnc, or pptp?  Also, if openvpn, what
version of openvpn are you using?

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


vpn connection failure

2008-08-12 Thread Eric Beversluis
I'm trying to get VPN to work on my Ubuntu 7.04 installation with
NetworkManager Applet 0.6.4. I'm using the same IP address, user name
and password that works on a vpn connection on my Windows box, but here
I keep getting this error message:

"VPN Connection Failure
Could not start VPN connection due to a connection error.
VPN Connection failed."

I can't seem to find anything on the NetworkManager page or elsewhere
that gives any instructions on configuring the VPN connection. Can
anyone help with this? (PS--there is no firewall running on the box
right now and still no connection.)

Thanks.


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Recent NM API changes

2008-08-12 Thread Dan Williams
Hi,

Two API changes recently...

1) The OpenVPN plugin has had some key name changes:

proto -> proto-tcp
dev -> tap-dev
shared-key -> static-key
shared-key-direction -> static-key-direction

2) The vpn-properties setting was merged with the vpn setting.  The vpn
setting's 'data' member (analogous to the vpn-properties setting's
'data' member) is type "a{ss}", i.e. all VPN-service-specific property
values are now strings, instead of variants.  This change was made to
allow system settings plugins that cannot easily represent typed data to
save out vpn specific properties.  In reality, most properties for the
openvpn, pptp, and vpnc plugins were already strings.  Since the VPN
plugins already needed to know what type the value was, it's quite easy
for them to handle the conversion.

3) In libnm-util, the NMSettingVPNProperties class has been removed, as
it was merged with NMSettingVPN as described above.

I've updated the gnome applet to convert the VPN settings to the new
format.

Dan

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: wha is ipv4 prefix?? (why not netmask)

2008-08-12 Thread Tambet Ingo
On Fri, Aug 8, 2008 at 5:56 PM, Dan Williams <[EMAIL PROTECTED]> wrote:
> On Thu, 2008-08-07 at 19:11 -0400, Nathaniel McCallum wrote:
>> Derek Atkins wrote:
>> > Miguel Angel CaƱedo <[EMAIL PROTECTED]> writes:
>> >
>> >
>> >> I was pulling my hair trying to set static ipv4 settings.
>> >> Until I realized that NM 0.7 asks for PREFIX instead of NETMASK
>> >>
>> >> Now, my netmask should be 255.255.0.0
>> >> How do I transalte that into the Prefix?
>> >>
>> >
>> > /16 ?
>> >
>> I also thought the wording was less-than-clear.
>
> We should really be accepting a netmask in that field and autoconverting
> to a prefix when you hit tab or move out of the field.  There are quite
> a few rough edges to the connection editor that we do need to fix up.

One less rough edge, I renamed the column header to "Netmask" (from
"Prefix") and the column now accepts both prefix length and netmask.

Tambet
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list