this patch fixes root on nfs for me.
The struct is not initialized correctly, the option for bind is wrong.
And the pad_len algorithm looks a bit odd:
int main(void)
{
int i;
for (i = 0; i < 42; i++) {
printf("%d %d %d\n", i, (i + 3) & ~3,
(i % 8) ? (i & 7) + 8 : i);
}
return 0;
}
1 4 9
2 4 10
3 4 11
4 4 12
5 8 13
6 8 14
7 8 15
8 8 8
9 12 9
10 12 10
11 12 11
12 12 12
13 16 13
14 16 14
15 16 15
16 16 16
17 20 9
18 20 10
19 20 11
20 20 12
21 24 13
22 24 14
23 24 15
24 24 24
25 28 9
26 28 10
diff -p -ppurN klibc-0.116/klibc/inet/bindresvport.c
klibc-0.116.nfsmount/klibc/inet/bindresvport.c
--- klibc-0.116/klibc/inet/bindresvport.c 2003-12-08 02:33:24.000000000 +0100
+++ klibc-0.116.nfsmount/klibc/inet/bindresvport.c 2004-05-24 20:01:50.000000000
+0200
@@ -23,7 +23,7 @@ int bindresvport(int sd, struct sockaddr
if (sin == NULL) {
sin = &me;
memset(sin, 0, sizeof(me));
- sin->sin_port = AF_INET;
+ sin->sin_family = AF_INET;
}
else if (sin->sin_family != AF_INET) {
errno = EPFNOSUPPORT;
@@ -37,7 +37,7 @@ int bindresvport(int sd, struct sockaddr
for (i = 0; i < NUM_PORTS; i++, port++) {
sin->sin_port = htons(port);
- if ((ret = bind(sd, (struct sockaddr *)&sin, sizeof(*sin))) != -1)
+ if ((ret = bind(sd, (struct sockaddr *)sin, sizeof(*sin))) != -1)
break;
if (port == END_PORT)
port = START_PORT;
diff -p -ppurN klibc-0.116/nfsmount/mount.c
klibc-0.116.nfsmount/nfsmount/mount.c
--- klibc-0.116/nfsmount/mount.c 2003-05-06 00:15:09.000000000 +0200
+++ klibc-0.116.nfsmount/nfsmount/mount.c 2004-05-24 18:52:35.000000000 +0200
@@ -77,9 +77,7 @@ static void get_ports(__u32 server, cons
static inline int pad_len(int len)
{
- if (len % 8)
- return (len & 7) + 8;
- return len;
+ return (len + 3) & ~3;
}
static inline void dump_params(__u32 server,
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n?RNBERG
On Mon, May 24, Olaf Hering wrote:> > this patch fixes root on nfs for me.Is there a reason why you did not apply this one?> The struct is not initialized correctly, the option for bind is wrong. > And the pad_len algorithm looks a bit odd: > > int main(void) > { > int i; > for (i = 0; i < 42; i++) { > printf("%d %d %d\n", i, (i + 3) & ~3, > (i % 8) ? (i & 7) + 8 : i); > } > return 0; > } > > 1 4 9 > 2 4 10 > 3 4 11 > 4 4 12 > 5 8 13 > 6 8 14 > 7 8 15 > 8 8 8 > 9 12 9 > 10 12 10 > 11 12 11 > 12 12 12 > 13 16 13 > 14 16 14 > 15 16 15 > 16 16 16 > 17 20 9 > 18 20 10 > 19 20 11 > 20 20 12 > 21 24 13 > 22 24 14 > 23 24 15 > 24 24 24 > 25 28 9 > 26 28 10 > > > diff -p -ppurN klibc-0.116/klibc/inet/bindresvport.c klibc-0.116.nfsmount/klibc/inet/bindresvport.c > --- klibc-0.116/klibc/inet/bindresvport.c 2003-12-08 02:33:24.000000000 +0100 > +++ klibc-0.116.nfsmount/klibc/inet/bindresvport.c 2004-05-24 20:01:50.000000000 +0200 > @@ -23,7 +23,7 @@ int bindresvport(int sd, struct sockaddr > if (sin == NULL) { > sin = &me; > memset(sin, 0, sizeof(me)); > - sin->sin_port = AF_INET; > + sin->sin_family = AF_INET; > } > else if (sin->sin_family != AF_INET) { > errno = EPFNOSUPPORT; > @@ -37,7 +37,7 @@ int bindresvport(int sd, struct sockaddr > > for (i = 0; i < NUM_PORTS; i++, port++) { > sin->sin_port = htons(port); > - if ((ret = bind(sd, (struct sockaddr *)&sin, sizeof(*sin))) != -1) > + if ((ret = bind(sd, (struct sockaddr *)sin, sizeof(*sin))) != -1) > break; > if (port == END_PORT) > port = START_PORT; > diff -p -ppurN klibc-0.116/nfsmount/mount.c klibc-0.116.nfsmount/nfsmount/mount.c > --- klibc-0.116/nfsmount/mount.c 2003-05-06 00:15:09.000000000 +0200 > +++ klibc-0.116.nfsmount/nfsmount/mount.c 2004-05-24 18:52:35.000000000 +0200 > @@ -77,9 +77,7 @@ static void get_ports(__u32 server, cons > > static inline int pad_len(int len) > { > - if (len % 8) > - return (len & 7) + 8; > - return len; > + return (len + 3) & ~3; > } > > static inline void dump_params(__u32 server, > > > -- > USB is for mice, FireWire is for men! > > sUse lINUX ag, n?RNBERG > > _______________________________________________ > klibc mailing list > klibc@zytor.com > http://www.zytor.com/mailman/listinfo/klibc >-- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG
On Sat, Aug 14, Olaf Hering wrote:> On Mon, May 24, Olaf Hering wrote: > > > > > this patch fixes root on nfs for me. > > Is there a reason why you did not apply this one?hmm, only the mount part is missing.> > diff -p -ppurN klibc-0.116/nfsmount/mount.c klibc-0.116.nfsmount/nfsmount/mount.c > > --- klibc-0.116/nfsmount/mount.c 2003-05-06 00:15:09.000000000 +0200 > > +++ klibc-0.116.nfsmount/nfsmount/mount.c 2004-05-24 18:52:35.000000000 +0200 > > @@ -77,9 +77,7 @@ static void get_ports(__u32 server, cons > > > > static inline int pad_len(int len) > > { > > - if (len % 8) > > - return (len & 7) + 8; > > - return len; > > + return (len + 3) & ~3; > > } > > > > static inline void dump_params(__u32 server, > >-- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG
Olaf Hering wrote:> On Sat, Aug 14, Olaf Hering wrote: > > >> On Mon, May 24, Olaf Hering wrote: >> >> >>>this patch fixes root on nfs for me. >> >>Is there a reason why you did not apply this one? > > > hmm, only the mount part is missing. > > > >>>diff -p -ppurN klibc-0.116/nfsmount/mount.c klibc-0.116.nfsmount/nfsmount/mount.c >>>--- klibc-0.116/nfsmount/mount.c 2003-05-06 00:15:09.000000000 +0200 >>>+++ klibc-0.116.nfsmount/nfsmount/mount.c 2004-05-24 18:52:35.000000000 +0200 >>>@@ -77,9 +77,7 @@ static void get_ports(__u32 server, cons >>> >>> static inline int pad_len(int len) >>> { >>>- if (len % 8) >>>- return (len & 7) + 8; >>>- return len; >>>+ return (len + 3) & ~3; >>> } >>> >>> static inline void dump_params(__u32 server, >>> > >Are you sure it should be aligned to a 4-byte boundary rather than an 8-byte boundary? -hpa
Dirk von Suchodoletz
2004-Aug-16 04:18 UTC
[klibc] problems with ipconfig command (no static config possible)
> Okay, I have pushed klibc-0.161 which should hopefully have the documentation > match reality, which in turn matches the kernel.Hi!! I tested the program - works fine! But question arises: The tools etherboot and PXElinux does not deliver a full ip=... line but limited one: Etherboot: ip=<own ip>:<server>:<gateway>:<netmask>:hostname PXElinux: ip=<own ip>:<server>:<gateway>:<netmask> So the user of the tool has to modify (fill up) the option, so that it suits the task. Thanks a lot! Dirk
On Sat, Aug 14, H. Peter Anvin wrote:> Olaf Hering wrote: > > On Sat, Aug 14, Olaf Hering wrote: > > > > > >>On Mon, May 24, Olaf Hering wrote: > >> > >> > >>>this patch fixes root on nfs for me. > >> > >>Is there a reason why you did not apply this one? > > > > > >hmm, only the mount part is missing. > > > > > > > >>>diff -p -ppurN klibc-0.116/nfsmount/mount.c > >>>klibc-0.116.nfsmount/nfsmount/mount.c > >>>--- klibc-0.116/nfsmount/mount.c 2003-05-06 00:15:09.000000000 +0200 > >>>+++ klibc-0.116.nfsmount/nfsmount/mount.c 2004-05-24 > >>>18:52:35.000000000 +0200 > >>>@@ -77,9 +77,7 @@ static void get_ports(__u32 server, cons > >>> > >>>static inline int pad_len(int len) > >>>{ > >>>- if (len % 8) > >>>- return (len & 7) + 8; > >>>- return len; > >>>+ return (len + 3) & ~3; > >>>} > >>> > >>>static inline void dump_params(__u32 server, > >>> > > > > > > Are you sure it should be aligned to a 4-byte boundary rather than an > 8-byte boundary?I saw failures with nfs tcp mount. Olaf Kirch came up with that patch, so I guess its ok. -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG