diff options
Diffstat (limited to 'libnetutils/ifc_utils.c')
-rw-r--r-- | libnetutils/ifc_utils.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c index a3579a4..1832b92 100644 --- a/libnetutils/ifc_utils.c +++ b/libnetutils/ifc_utils.c @@ -1,5 +1,6 @@ /* * Copyright 2008, The Android Open Source Project + * Copyright (C) 2011, Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -981,3 +982,21 @@ int ifc_remove_route(const char *ifname, const char*dst, int prefix_length, cons { return ifc_act_on_route(SIOCDELRT, ifname, dst, prefix_length, gw); } + +int ifc_get_mtu(const char *name, int *mtuSz) +{ + struct ifreq ifr; + ifc_init_ifr(name, &ifr); + + if (mtuSz != NULL) { + if(ioctl(ifc_ctl_sock, SIOCGIFMTU, &ifr) < 0) { + *mtuSz = 0; + return -2; + } else { + *mtuSz = ifr.ifr_mtu; + return 0; + } + } + + return -1; +} |