Re: How to add pppoe connection in NM plug-in



On Mon, 2010-04-26 at 21:04 +0800, Mu Qiao wrote:
> Hi dear Dan and all,
> I've tried to find how to add pppoe connection in NM plug-in. But I
> didn't find any example in existing plugin source code. Is there
> anything I missed?

The connection editor does add PPPoE.  Note that until we fix a few
things, PPPoE is only available on Ethernet (ie wired) devices, not yet
on wifi.  Making that work is fairly high on the to-do list.

> Then I tried to write code in the way similar as adding a
> wired_connection_setting as following:
> 
>         NMSettingPPPOE *s_pppoe;
>         gchar *value;
>         s_pppoe = NM_SETTING_PPPOE(nm_setting_pppoe_new());
>         //NM_SETTING_PPPOE_SERVICE NM_SETTING_PPPOE_USERNAME
> NM_SETTING_PPPOE_PASSWORD
>         value = ifnet_getdata(block, "username");
>         if (!value) {
>                 g_set_error(error, ifnet_plugin_error_quark(), 0,
>                             "ppp requires at lease a username");
>                 return;
>         }
>         g_object_set(s_pppoe, NM_SETTING_PPPOE_USERNAME, value, NULL);
>         value = ifnet_getdata(block, "password");
>         if (!value) {
>                 value="";
>         }
>         g_object_set(s_pppoe, NM_SETTING_PPPOE_PASSWORD, value, NULL);
>         nm_connection_add_setting(connection, NM_SETTING(s_pppoe));
> 
> Am I doing in the right way? Is there any other thing I should take
> care of? Could please give me some direction.

That looks mostly right, actually.  But make sure to set the
NMSettingConnection's 'type' property to NM_SETTING_PPPOE_SETTING_NAME.

Try calling "nm_connection_verify()" on your final connection at some
point.  Does that return TRUE or FALSE, and if FALSE, what is the error
that it returns?

Dan




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