From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] ppp: change MTU on TUN device when MRU option received
Date: Thu, 22 Apr 2010 17:10:11 -0500 [thread overview]
Message-ID: <201004221710.11515.denkenz@gmail.com> (raw)
In-Reply-To: <1271970911-9645-1-git-send-email-kristen@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]
Hi Kristen,
> ---
> gatchat/ppp_net.c | 16 ++++++++++++++++
> 1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
> index c1f2eb4..fc1f9fb 100644
> --- a/gatchat/ppp_net.c
> +++ b/gatchat/ppp_net.c
> @@ -50,10 +50,26 @@ struct ppp_net {
>
> void ppp_net_set_mtu(struct ppp_net *net, guint16 mtu)
> {
> + struct ifreq ifr;
> + int sock;
> +
> if (net == NULL)
> return;
>
> net->mtu = mtu;
> +
> + sock = socket(AF_INET, SOCK_DGRAM, 0);
> + if (sock < 0)
> + return;
> +
I think it would be a good idea to make this function return a gboolean
indicating success or failure instead of silently returning.
> + memset(&ifr, 0, sizeof(ifr));
> +
> + strncpy(ifr.ifr_name, net->if_name, sizeof(ifr.ifr_name));
> + ifr.ifr_mtu = mtu;
> + if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
> + g_printerr("Unable to change MTU\n");
Generally the preferred style is to not have a space after memset but do have
space before the if.
> +
> + close(sock);
> }
>
> void ppp_net_process_packet(struct ppp_net *net, guint8 *packet)
>
Otherwise patch looks good.
Regards,
-Denis
next prev parent reply other threads:[~2010-04-22 22:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-22 21:15 [PATCH] ppp: change MTU on TUN device when MRU option received Kristen Carlson Accardi
2010-04-22 22:10 ` Denis Kenzior [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-04-22 22:49 Kristen Carlson Accardi
2010-04-22 23:00 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201004221710.11515.denkenz@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox