• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
changing MTU and disable PMTU in MacOS 9
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

changing MTU and disable PMTU in MacOS 9


  • Subject: changing MTU and disable PMTU in MacOS 9
  • From: Mauri <email@hidden>
  • Date: Tue, 7 Dec 2004 16:26:51 +0200

Hi all.

I must change the MTU and disable PMTU in MacOS 9 programmatically (not with IPNetTuner)
the "ip_pmtu_strategy" and "ip_interface_MTU" in IPNetTuner Interface..
I have tried using SInt32 Err = OTIoctl(Endpoint, I_STR, &sioctl);
in the following way


OSStatus ENetworkUtil::SetMTUValue(EndpointRef EndP, UInt32& Value, SInt32 ic_cmd)
{
ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
strcpy(ifr.ifr_name, "ppp0");
ifr.ifr_metric = Value;


	strioctl sioctl;

	sioctl.ic_cmd = ic_cmd;
	sioctl.ic_timout = 0;//INFTIM
	sioctl.ic_len = sizeof(ifreq);
	sioctl.ic_dp= (char*)&ifr;

	SInt32 Err = OTIoctl(EndP, I_STR, &sioctl);
	Value = ifr.ifr_ifru.ifru_metric;
 	return Err;
}
I Have tried also send the ifreq as argument OTIoctl(EndP, I_STR, &ifr);

Using the header that I found in the book of Stevens Network Programming: Sockets and XTI
----------------------------------------------sockio.h Begin----------------------------------------------------
#include <OpenTransportProviders.h>


struct sockaddr {
unsigned short sa_family; /* address family */
char sa_data[14]; /* up to 14 bytes of direct address */
};


struct	ifreq {
#define IFNAMSIZ	36
	char	ifr_name[IFNAMSIZ];
	union {
	struct	sockaddr ifru_addr;
	struct	sockaddr ifru_dstaddr;
	struct	sockaddr ifru_broadaddr;
	short	ifru_flags;
	int ifru_metric;
	char	*ifru_data;
	} ifr_ifru;
#define ifr_addr	ifr_ifru.ifru_addr	/* address */
#define ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-to-p link */
#define ifr_broadaddr	ifr_ifru.ifru_broadaddr /* broadcast address */
#define ifr_flags	ifr_ifru.ifru_flags /* flags */
#define ifr_metric	ifr_ifru.ifru_metric	/* metric */
#define ifr_data	ifr_ifru.ifru_data  /* for use by interface */
};

struct ifconf {
int ifc_len;
union {
caddr_t ifcu_buf;
struct ifreq *ifcu_req;
} ifc_ifcu;
#define ifc_buf ifc_ifcu.ifcu_buf
#define ifc_req ifc_ifcu.ifcu_req
};
----------------------------------------------sockio.h End----------------------------------------------------
Now in regards of the sioctl.ic_cmd value which should be SIOCGIFMTU have define multiple option


#define SIOCSIFMTUi	MIOC_CMD(MIOC_RESERVEDi,21)
#define SIOCGIFMTUi	MIOC_CMD(MIOC_RESERVEDi,22)
#define SIOCSIFMTUiB	MIOC_CMD(MIOC_RESERVEDi,51)
#define SIOCGIFMTUiB	MIOC_CMD(MIOC_RESERVEDi,52)

Which I found in the net I don't know which is right. I have tried every one I always get from OTIoctl error -3217
which isn't documented. and I have no Idea how to disable PMTU ..


Now I have also tried to change the values in the Profile using MoreNetworkSetup
I also not sure if MTU==MRU in OT context



OSStatus EConfigurationManager::ChangeMTUPreferences()
{
MNSDatabaseRef DB_Ref;
CfgEntityRef CurrentRemoteEntity;
Boolean ForWriting = true;
OSStatus Status = MNSOpenDatabase(&DB_Ref, ForWriting);
if (Status != noErr)
{
return Status;
}
Status = FindCurrentConnection(&DB_Ref, kOTCfgTypeRemote, &CurrentRemoteEntity);
if (Status == noErr)
{
UInt32* pCfgProtocolOptions;
Handle hCfgProtocolOptions = NewHandleClear(sizeof(UInt32));
Status = MNSGetPrefHandle(&DB_Ref, &CurrentRemoteEntity, kOTCfgProtocolOptionsPref, hCfgProtocolOptions);
pCfgProtocolOptions = (UInt32*)*hCfgProtocolOptions;
(*pCfgProtocolOptions) |= kOTCfgDontDoPMTUDiscoveryMask;
Status = MNSSetPrefHandle(&DB_Ref, &CurrentRemoteEntity, kOTCfgProtocolOptionsPref, hCfgProtocolOptions);
DisposeHandle(hCfgProtocolOptions);
}


if (Status == noErr)
{
OTCfgRemoteLCP* pRemoteLCP;
Handle hRemoteLCP = NewHandleClear(sizeof(OTCfgRemoteLCP));
Status = MNSGetPrefHandle(&DB_Ref, &CurrentRemoteEntity, kOTCfgRemoteLCPPref, hRemoteLCP);
pRemoteLCP = (OTCfgRemoteLCP*)*hRemoteLCP;
pRemoteLCP->mruSize = 1400;
Status = MNSSetPrefHandle(&DB_Ref, &CurrentRemoteEntity, kOTCfgRemoteLCPPref, hRemoteLCP);
DisposeHandle(hRemoteLCP);
}


	Boolean Commit = true;
	Status = MNSCloseDatabase(&DB_Ref, Commit);

	return Status;
}

Everything went ok but had no effect in the configuration of the connection. ;-)
I have to configure a PPPoE connection the know issue of the ISP blocking the ICMP packet and and as result
blocking the path MTU discovery.



Thanks in Advance. -- _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: FD_CLOSE event occurs on a socket
  • Next by Date: Re: CFHTTP functions (the CallBack funtion is never called...)
  • Previous by thread: Re: FD_CLOSE event occurs on a socket
  • Next by thread: Re: CFHTTP functions (the CallBack funtion is never called...)
  • Index(es):
    • Date
    • Thread