Re: Why both media and -mediaopt doesn't specify at the same time?
From: YASUOKA Masahiko Date: Thu, 14 Feb 2019 15:34:26 +0900 (JST) > On Thu, 14 Feb 2019 08:30:45 +0900 (JST) > Masato Asou wrote: >> From: Claudio Jeker >> Date: Wed, 13 Feb 2019 14:25:58 +0100 >> >>> On Wed, Feb 13, 2019 at 11:04:02AM +0900, Masato Asou wrote: Hi, When I execute `ifconfig media XX -mediaopt YY' command, it occured error as below. $ doas ifconfig em1 media 100baseTX -mediaopt full-duplex ifconfig: may not issue both `media' and `-mediaopt' $ echo $? 1 Does anyone knows this reason? >>> >>> This was done to prevent changing mediaopt while changing media at the >>> same time. Media and mediaopt are linked together and ifconfig fetches >>> the initial settings early on. Changing media and mediaopt at the same >>> time may end up with a results that puts the interface into an invalid >>> state. >> >> Thanks for your explanation. >> >> However, media and mediaopt (not `-') can specfy same time. Does this >> work valid? > > The reason isn't because we can assume all "mediaopt" are cleared when > changing "media"? Then clearing individual "mediaopt" when changing > "media" doesn't make sense. Oh! My thought was missing. Thanks > >>> Is there a particular reason why you need to use media and >>> -mediaopt at the same time? >> >> I have no particular reason. I just thiking that way. >> If specified media and -media same time, I only execute one command. >> I think following patch is works fine. $ cvs diff ifconfig.c Index: ifconfig.c === RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.379 diff -u -p -r1.379 ifconfig.c --- ifconfig.c 30 Sep 2018 18:19:24 - 1.379 +++ ifconfig.c 13 Feb 2019 01:58:18 - @@ -2797,10 +2797,6 @@ unsetmediaopt(const char *val, int d) if (actions & A_MEDIAOPTCLR) errx(1, "only one `-mediaopt' command may be issued"); - /* May not issue `media' and `-mediaopt'. */ - if (actions & A_MEDIA) - errx(1, "may not issue both `media' and `-mediaopt'"); - /* * No need to check for A_MEDIAINST, since the test for A_MEDIA * implicitly checks for A_MEDIAINST. -- ASOU Masato >>> >>> -- >>> :wq Claudio >> >> -- >> ASOU Masato >> > -- ASOU Masato
Re: Why both media and -mediaopt doesn't specify at the same time?
On Thu, 14 Feb 2019 08:30:45 +0900 (JST) Masato Asou wrote: > From: Claudio Jeker > Date: Wed, 13 Feb 2019 14:25:58 +0100 > >> On Wed, Feb 13, 2019 at 11:04:02AM +0900, Masato Asou wrote: >>> Hi, >>> >>> When I execute `ifconfig media XX -mediaopt YY' command, it occured >>> error as below. >>> >>> $ doas ifconfig em1 media 100baseTX -mediaopt full-duplex >>> ifconfig: may not issue both `media' and `-mediaopt' >>> $ echo $? >>> 1 >>> >>> Does anyone knows this reason? >> >> This was done to prevent changing mediaopt while changing media at the >> same time. Media and mediaopt are linked together and ifconfig fetches >> the initial settings early on. Changing media and mediaopt at the same >> time may end up with a results that puts the interface into an invalid >> state. > > Thanks for your explanation. > > However, media and mediaopt (not `-') can specfy same time. Does this > work valid? The reason isn't because we can assume all "mediaopt" are cleared when changing "media"? Then clearing individual "mediaopt" when changing "media" doesn't make sense. >> Is there a particular reason why you need to use media and >> -mediaopt at the same time? > > I have no particular reason. I just thiking that way. > If specified media and -media same time, I only execute one command. > >>> I think following patch is works fine. >>> >>> $ cvs diff ifconfig.c >>> Index: ifconfig.c >>> === >>> RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v >>> retrieving revision 1.379 >>> diff -u -p -r1.379 ifconfig.c >>> --- ifconfig.c 30 Sep 2018 18:19:24 - 1.379 >>> +++ ifconfig.c 13 Feb 2019 01:58:18 - >>> @@ -2797,10 +2797,6 @@ unsetmediaopt(const char *val, int d) >>> if (actions & A_MEDIAOPTCLR) >>> errx(1, "only one `-mediaopt' command may be issued"); >>> >>> - /* May not issue `media' and `-mediaopt'. */ >>> - if (actions & A_MEDIA) >>> - errx(1, "may not issue both `media' and `-mediaopt'"); >>> - >>> /* >>> * No need to check for A_MEDIAINST, since the test for A_MEDIA >>> * implicitly checks for A_MEDIAINST. >>> -- >>> ASOU Masato >>> >> >> -- >> :wq Claudio > > -- > ASOU Masato >
Re: Why both media and -mediaopt doesn't specify at the same time?
From: Claudio Jeker Date: Wed, 13 Feb 2019 14:25:58 +0100 > On Wed, Feb 13, 2019 at 11:04:02AM +0900, Masato Asou wrote: >> Hi, >> >> When I execute `ifconfig media XX -mediaopt YY' command, it occured >> error as below. >> >> $ doas ifconfig em1 media 100baseTX -mediaopt full-duplex >> ifconfig: may not issue both `media' and `-mediaopt' >> $ echo $? >> 1 >> >> Does anyone knows this reason? > > This was done to prevent changing mediaopt while changing media at the > same time. Media and mediaopt are linked together and ifconfig fetches > the initial settings early on. Changing media and mediaopt at the same > time may end up with a results that puts the interface into an invalid > state. Thanks for your explanation. However, media and mediaopt (not `-') can specfy same time. Does this work valid? > Is there a particular reason why you need to use media and > -mediaopt at the same time? I have no particular reason. I just thiking that way. If specified media and -media same time, I only execute one command. >> I think following patch is works fine. >> >> $ cvs diff ifconfig.c >> Index: ifconfig.c >> === >> RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v >> retrieving revision 1.379 >> diff -u -p -r1.379 ifconfig.c >> --- ifconfig.c 30 Sep 2018 18:19:24 - 1.379 >> +++ ifconfig.c 13 Feb 2019 01:58:18 - >> @@ -2797,10 +2797,6 @@ unsetmediaopt(const char *val, int d) >> if (actions & A_MEDIAOPTCLR) >> errx(1, "only one `-mediaopt' command may be issued"); >> >> - /* May not issue `media' and `-mediaopt'. */ >> - if (actions & A_MEDIA) >> - errx(1, "may not issue both `media' and `-mediaopt'"); >> - >> /* >> * No need to check for A_MEDIAINST, since the test for A_MEDIA >> * implicitly checks for A_MEDIAINST. >> -- >> ASOU Masato >> > > -- > :wq Claudio -- ASOU Masato
Re: Why both media and -mediaopt doesn't specify at the same time?
On Wed, Feb 13, 2019 at 11:04:02AM +0900, Masato Asou wrote: > Hi, > > When I execute `ifconfig media XX -mediaopt YY' command, it occured > error as below. > > $ doas ifconfig em1 media 100baseTX -mediaopt full-duplex > ifconfig: may not issue both `media' and `-mediaopt' > $ echo $? > 1 > > Does anyone knows this reason? This was done to prevent changing mediaopt while changing media at the same time. Media and mediaopt are linked together and ifconfig fetches the initial settings early on. Changing media and mediaopt at the same time may end up with a results that puts the interface into an invalid state. Is there a particular reason why you need to use media and -mediaopt at the same time? > I think following patch is works fine. > > $ cvs diff ifconfig.c > Index: ifconfig.c > === > RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v > retrieving revision 1.379 > diff -u -p -r1.379 ifconfig.c > --- ifconfig.c 30 Sep 2018 18:19:24 - 1.379 > +++ ifconfig.c 13 Feb 2019 01:58:18 - > @@ -2797,10 +2797,6 @@ unsetmediaopt(const char *val, int d) > if (actions & A_MEDIAOPTCLR) > errx(1, "only one `-mediaopt' command may be issued"); > > - /* May not issue `media' and `-mediaopt'. */ > - if (actions & A_MEDIA) > - errx(1, "may not issue both `media' and `-mediaopt'"); > - > /* > * No need to check for A_MEDIAINST, since the test for A_MEDIA > * implicitly checks for A_MEDIAINST. > -- > ASOU Masato > -- :wq Claudio
Why both media and -mediaopt doesn't specify at the same time?
Hi, When I execute `ifconfig media XX -mediaopt YY' command, it occured error as below. $ doas ifconfig em1 media 100baseTX -mediaopt full-duplex ifconfig: may not issue both `media' and `-mediaopt' $ echo $? 1 Does anyone knows this reason? I think following patch is works fine. $ cvs diff ifconfig.c Index: ifconfig.c === RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.379 diff -u -p -r1.379 ifconfig.c --- ifconfig.c 30 Sep 2018 18:19:24 - 1.379 +++ ifconfig.c 13 Feb 2019 01:58:18 - @@ -2797,10 +2797,6 @@ unsetmediaopt(const char *val, int d) if (actions & A_MEDIAOPTCLR) errx(1, "only one `-mediaopt' command may be issued"); - /* May not issue `media' and `-mediaopt'. */ - if (actions & A_MEDIA) - errx(1, "may not issue both `media' and `-mediaopt'"); - /* * No need to check for A_MEDIAINST, since the test for A_MEDIA * implicitly checks for A_MEDIAINST. -- ASOU Masato